This file contains hidden or 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 hidden or 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 hidden or 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 sys | |
import os | |
from Qt import QtWidgets, QtCore, QtGui | |
def main(): | |
app = QtWidgets.QApplication(sys.argv) | |
path = r"C:\test\subfolder\file.txt" |
This file contains hidden or 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 hidden or 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
def seq_to_glob(path): | |
"""Takes an image sequence path and returns it in glob format, | |
with the frame number replaced by a '*'. | |
Image sequences may be numerical sequences, e.g. /path/to/file.1001.exr | |
will return as /path/to/file.*.exr. | |
Image sequences may also use tokens to denote sequences, e.g. | |
/path/to/texture.<UDIM>.tif will return as /path/to/texture.*.tif. |
This file contains hidden or 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 |
This file contains hidden or 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 cmds | |
def get_shader_overrides_in_renderlayer(layer): | |
"""Return shader assignment overrides in renderlayer""" | |
attr = "{layer}.outAdjustments".format(layer=layer) | |
indices = cmds.getAttr(attr, multiIndices=True) | |
overrides = {} | |
for index in indices: |
This file contains hidden or 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 cmds | |
def get_shader_in_layer(node, layer): | |
"""Return the assigned shader in a renderlayer without switching layers. | |
This has been developed and tested for Legacy Renderlayers and *not* for | |
Render Setup. | |
Returns: | |
list: The list of assigned shaders in the given layer. |
This file contains hidden or 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
try: | |
import logging | |
import pyblish.api | |
import pyblish.util | |
except ImportError as exc: | |
# Ensure Deadline fails by output an error that contains "Fatal Error:" | |
raise ImportError("Fatal Error: %s" % exc) | |
handler = logging.basicConfig() |
This file contains hidden or 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
from avalon import api | |
from avalon import io | |
import alembic.Abc | |
def get_alembic_paths(filename): | |
"""Return all full hierarchy paths from alembic file""" | |
# Normalize alembic path | |
path = os.path.normpath(filename) |