View usd_import_layer.py
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
from collections.abc import Callable | |
from pxr import Sdf | |
def import_layer( | |
path: str, | |
target_layer: Sdf.Layer, | |
target_path: Sdf.Path, | |
copy_spec_fn: Callable[[Sdf.Layer, Sdf.Path, Sdf.Layer, Sdf.Path], bool] = Sdf.CopySpec | |
): |
View usd_print_simple_diff_to_layer_on_disk.py
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 difflib | |
from pxr import Sdf | |
# Purely as an example, say this `layer` is one that's currently already | |
# available and is dirty currently | |
identifier = r"C:\Users\User\Desktop\asset.usd" | |
layer = Sdf.Layer.FindOrOpen(identifier) | |
layer.Reload() # just so we can re-run this script | |
layer.subLayerPaths.append("./hello_world.usd") # making a change, making it dirty |
View usd_get_registered_prim_type_schemas.py
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
from pxr import Usd, Plug, Tf | |
from collections import defaultdict | |
NICE_NAMES = { | |
"usdGeom": "Geometry", | |
"usdLux": "Lighting", | |
"mayaUsd_Schemas": "Maya Reference", | |
"usdMedia": "Media", | |
"usdRender": "Render", | |
"usdRi": "RenderMan", |
View usd_sdf_move_prim_spec.py
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
from pxr import Sdf, Usd | |
LIST_ATTRS = ['addedItems', 'appendedItems', 'deletedItems', 'explicitItems', | |
'orderedItems', 'prependedItems'] | |
def repath_properties(layer, old_path, new_path): | |
"""Re-path property relationship targets and attribute connections. | |
This will replace any relationship or connections from old path |
View ayon_insert_ffmpeg_path_prelaunchhook.py
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 | |
from openpype.lib.applications import PreLaunchHook, LaunchTypes | |
from openpype.lib.vendor_bin_utils import get_ffmpeg_tool_path | |
class AddFFMPEGToPath(PreLaunchHook): | |
"""Insert Ayon FFMPEG in `PATH`""" | |
# Should be as last hook because must change launch arguments to string | |
app_groups = {"*"} | |
platforms = {"*"} |
View openpype_extractor_mixin.py
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
class ExtractorMixin: | |
"""OpenPype Extractor helper methods""" | |
def add_representation(self, instance, name, | |
files, staging_dir, ext=None, | |
output_name=None, | |
frame_start=None, | |
frame_end=None, |
View houdini_lop_python_add_turntable_spin_anim.py
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
from pxr import UsdGeom, Usd | |
node = hou.pwd() | |
stage = node.editableStage() | |
path = "/cube" | |
prim = stage.GetPrimAtPath(path) | |
start = node.evalParm("start") | |
end = node.evalParm("end") |
View houdini_node_attachments.py
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 hou | |
import json | |
class Attachments: | |
user_data_key = "attachednodes" | |
@staticmethod | |
def attach_node(node, node_to_follow): |
View openpype_get_thumbnail.py
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
from openpype.pipeline.thumbnail import get_thumbnail_binary | |
from openpype.client import get_thumbnail_id_from_source, get_thumbnail | |
def get_entity_thumbnail(project_name, entity_id, entity_type): | |
thumbnail_id = get_thumbnail_id_from_source(project_name, entity_type, entity_id) | |
if not thumbnail_id: | |
return | |
thumbnail_entity = get_thumbnail(project_name, thumbnail_id, entity_type, entity_id) | |
if not thumbnail_entity: |
View maya_usd_import_chaser_cbId_to_transform.py
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 logging | |
import mayaUsd.lib as mayaUsdLib | |
from maya import cmds | |
import maya.api.OpenMaya as OpenMaya | |
def create_cbid_attr(default_value): | |
default = OpenMaya.MFnStringData().create(default_value) | |
return OpenMaya.MFnTypedAttribute().create("cbId", |
NewerOlder