This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
maya.cmds.listHistory() will always include the node itself when history is returned. | |
Here we're testing whether it's always the first node returned, if not a RuntimeError is raised. | |
We're also checking whether all nodes in the scene will return a valid history list, which isn't True. | |
The 'defaultColorMgtGlobals' node returns None instead of an empty list. | |
""" | |
from maya import cmds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.OpenMaya as om | |
import maya.cmds as mc | |
def callback(node, clientData): | |
fnDep = om.MFnDependencyNode(node) | |
node_name = fnDep.name() | |
print node_name | |
if __name__ == '__main__': | |
# Delete previous run (testing only) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.OpenMaya as om | |
import maya.cmds as mc | |
import uuid | |
def get_name(node): | |
"""Get the long name from the MObject where appropriate""" | |
if node.hasFn(om.MFn.kDagNode): | |
return om.MFnDagNode(node).fullPathName() | |
else: | |
return om.MFnDependencyNode(node).name() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.cmds as mc | |
def offsets_to_input(mesh): | |
num_pts = mc.getAttr('{0}.pnts'.format(mesh), size=True) | |
for i in range(num_pts): | |
# Get the internal offset | |
offset = mc.getAttr('{0}.pnts[{1}]'.format(mesh, i))[0] | |
# Move the vertex position by the internal offset value (relative) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cls.__path__ = None | |
if cls.__module__ != '__main__': # if not local (in-memory) | |
try: | |
cls.__path__ = inspect.getfile(cls) | |
except RuntimeError, e: | |
print e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyblish.api | |
import logging | |
log = logging.getLogger(__name__) | |
def get_family_options(plugins, family): | |
"""Return the user-specifiable options for this family | |
The options name and types are gathered through |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import shutil | |
import pyblish.api | |
import pyblish.util | |
import pyblish_magenta.api | |
class IntegrateAssetsSimple(pyblish.api.Integrator): | |
"""Name and position instances on disk for shots |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For each selected tool | |
tools = comp.GetToolList(True).values() | |
for tool in tools: | |
print tool.Name | |
# For each input | |
inputs = tool.GetInputList().values() | |
for input in inputs: | |
name = input.Name # ui friendly name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""This is a custom MPxFileTranslator that can be loaded as plug-in into Maya. | |
With this loaded as plug-in you can reference any `.txt` file on disk. | |
To make this work save a `.ma` scene next to the text file with the same name | |
and reference the txt file. What should happen is that the `.ma` should be | |
loaded three times within a single reference node in Maya. | |
Note: it crashes in Maya 2018 when saving the scene and then reopening the scene. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Example pseudocode to collect dependencies and publish them in Avalon database. | |
- Collect dependencies of what is included/used as representation at time of publish (example shows Maya implementation) | |
- Store in database under version[data][dependencies] | |
- Debug print dependencies for a representation (see psuedocode at end) | |
""" | |
import maya.cmds as mc | |
import avalon.api as api |
OlderNewer