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
"""These are utilities for connecting open-source pipeline Avalon with CG-Wire using Qtazu | |
See: | |
- https://github.com/getavalon/core | |
- https://github.com/Colorbleed/qtazu | |
References: | |
- https://github.com/getavalon/docker/blob/master/volume/sync.py#L227 | |
# How it works: |
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 contextlib | |
import hou | |
def add_output_processor(ropnode, processor): | |
"""Add USD Output Processor to USD Rop node. | |
Args: | |
ropnode (hou.RopNode): The USD Rop node. | |
processor (str): The output processor name. This is the basename of | |
the python file that contains the Houdini USD Output Processor. |
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
"""Snap multiple objects by vertex index to target vertex. | |
1. Select all objects you want to snap | |
2. Add the target vertex to your selection. | |
3. Run script | |
Make sure each object has the same topological order because | |
this just simply snaps the same vertex number of each object | |
to the selected target vertex. |
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
"""When using maya.cmds.listRelatives with allDescendents=True it will only return the first instanced child. | |
Below are some example functions that correctly return all instanced children where they are "somewhat" optimized to rapidly return a result as opposed to slow recursive queries. | |
""" | |
import maya.api.OpenMaya as om | |
from maya import cmds | |
import time | |
import re |
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 alembic | |
def _print_properties(property, depth=1): | |
# Property name | |
print ("\t" * depth) + property.getName() | |
# Metadata | |
metadata = property.getMetaData() | |
if metadata.size(): |
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
# Tested December 21st, 2020 | |
# This is just a test example of how one could use the USD Api against a mayaUsdProxyShape and its USD stage. | |
# Note: The outliner doesn't really like it when you change the stage | |
# so you might need to toggle shape display off and on to get it to update. | |
import mayaUsd | |
from maya import cmds | |
from pxr import Usd, UsdGeom | |
shape = cmds.ls(type="mayaUsdProxyShape", long=True)[0] # make sure to use long full paths | |
stage = mayaUsd.ufe.getStage('|world' + shape) |
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 maya import cmds | |
import maya.api.OpenMaya as om | |
import pymel.core as pm | |
import maya.app.renderSetup.model.utils as utils | |
from maya.app.renderSetup.model import ( | |
override, | |
selector, | |
collection, | |
renderLayer, |
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 maya import cmds | |
import maya.app.renderSetup.model.initialize as init | |
# Get node types from Render Setup | |
node_types = init.renderSetupNodeNamesToShowInOutliner | |
display = True | |
for node_type in node_types: | |
cmds.setNodeTypeFlag(node_type, display=display) |
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 contextlib | |
from maya import cmds | |
from maya.app.renderSetup.model import renderSetup | |
# Custom library functions, see: https://github.com/Colorbleed/colorbleed-config | |
from colorbleed.maya import lib | |
from colorbleed.lib import pairwise |
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 on how to load latest `modelDefault` of an asset by `cbId` value using `AbcLoader` (alembic) | |
import avalon.io as io | |
import avalon.api as api | |
from maya import cmds | |
node = "my_node" | |
cbid = cmds.getAttr("%s.cbId" % node) | |
# Get asset object id from cbId | |
object_id = cbid.split(":", 1)[0] # The part before the : is the asset id |