Skip to content

Commit

Permalink
First version for AL_omx
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Gao committed Nov 30, 2023
1 parent b8faee6 commit 37ad5dc
Show file tree
Hide file tree
Showing 102 changed files with 3,271 additions and 1,107 deletions.
15 changes: 15 additions & 0 deletions AL/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# Copyright © 2023 Animal Logic. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.#
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


"""
This file will not be used. It is a proxy for the real AL.__init__.py declared in PythonLibs source code
"""
Expand Down
31 changes: 19 additions & 12 deletions AL/omx/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# Copyright (C) Animal Logic Pty Ltd. All rights reserved.
# Copyright © 2023 Animal Logic. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.#
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""
OMX is a thin wrapper around Maya OM2.
OMX's goal is to make OM2 more user-friendly but still retain the API's performance.
Main entry points are:
:py:func:`omx.createDagNode` and :py:func:`omx.createDGNode` which return instances of :py:class:`omx.XNode`
See :doc:`/topics/omx` for more information.
"""
from ._xplug import XPlug # NOQA: F401
from ._xnode import XNode # NOQA: F401
from ._xmodifier import (
Expand All @@ -25,6 +26,9 @@
XModifier,
queryTrackedNodes,
TrackCreatedNodes,
setJournalToggle,
isJournalOn,
JournalContext,
) # NOQA: F401

try:
Expand All @@ -48,4 +52,7 @@
"XModifier",
"queryTrackedNodes",
"TrackCreatedNodes",
"setJournalToggle",
"isJournalOn",
"JournalContext",
]
37 changes: 32 additions & 5 deletions AL/omx/_xcommand.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
# Copyright (C) Animal Logic Pty Ltd. All rights reserved.
# Copyright © 2023 Animal Logic. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.#
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import logging
from maya import cmds
from maya.api import OpenMaya as om2
from AL.maya2.omx import _xmodifier

from AL.omx.utils._stubs import cmds
from AL.omx.utils._stubs import om2
from AL.omx import _xmodifier

logger = logging.getLogger(__name__)


class XCommand(om2.MPxCommand):
"""An internal dynamic command plugin class called by createAL_Command, it is an undoable
MPxCommand omx uses to support undo/redo in Maya.
"""Dynamic command plugin called by createAL_Command
Notes:
You don't need to ever touch this command or manually call it. It is completely for
internal use only.
"""

PLUGIN_CMD_NAME = "AL_OMXCommand"
Expand Down Expand Up @@ -50,5 +68,14 @@ def undoIt(self):
def ensureLoaded(cls):
if cls._CMD_PLUGIN_LOADED:
return

# to ensure plugin is loadable outside AL:
pluginDirEnvName = "MAYA_PLUG_IN_PATH"
pluginDir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "plugin")
plugInDirs = os.environ.get(pluginDirEnvName, "").split(";")
if pluginDir not in plugInDirs:
plugInDirs.append(pluginDir)
os.environ[pluginDirEnvName] = ";".join(plugInDirs)

cmds.loadPlugin(cls.PLUGIN_CMD_NAME, quiet=True)
cls._CMD_PLUGIN_LOADED = True
Loading

0 comments on commit 37ad5dc

Please sign in to comment.