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
string targetpath = "/focus_point"; // Target prim to focus on | |
// Compute Z-plane distance to target prim transform from camera transform | |
matrix cam = usd_worldtransform(0, @primpath); | |
matrix target = usd_worldtransform(0, targetpath); | |
vector origin = set(0, 0, 0); | |
matrix local_diff = target * invert(cam); | |
vector local_pos = ptransform(origin, local_diff); | |
float dist = -local_pos.z; // inverted, because -Z is direction camera looks at |
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 logging | |
from maya.api import OpenMaya | |
import mayaUsd.lib as mayaUsdLib | |
from pxr import Sdf | |
def log_errors(fn): | |
"""Decorator to log errors on error""" | |
def wrap(*args, **kwargs): | |
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 | |
def get_fn_mesh(mesh): | |
sel = om.MSelectionList() | |
sel.add(mesh) | |
dag = sel.getDagPath(0) | |
return om.MFnMesh(dag) | |
hard_edged_meshes = [] |
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 pxr import UsdUtils, Sdf | |
stage = hou.pwd().editableStage() | |
# Given a Sdf.Layer you can use UsdUtils.ComputeAllDependencies | |
# which returns the layers, assets and any unresolved paths | |
layer = stage.Flatten() | |
layers, assets, unresolved_paths = UsdUtils.ComputeAllDependencies(layer.identifier) | |
for path in assets: | |
print(path) |
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
"""Connect objects (transforms) to a nurbsCurve by pointOnCurve node. | |
Select the objects, then select the nurbsCurve last. | |
Run the script. | |
Voila. | |
Updated version of: https://polycount.com/discussion/161754/eye-rig-script-problem | |
""" |
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 openpype.pipeline.load.plugins import discover_loader_plugins | |
from openpype.pipeline.load.utils import loaders_from_representation, load_container | |
loader_name = "GpuCacheLoader" | |
representation_id = '6b7b5b6e-c677-11ee-b580-18c04d958ef6' | |
all_loaders = discover_loader_plugins() | |
loaders = loaders_from_representation(all_loaders, representation_id) | |
Loader = next((i for i in loaders if i.__name__ == loader_name), None) |
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
// Remove any scaling from parent prims | |
matrix transform = usd_worldtransform(0, @primpath); | |
vector scale = cracktransform(0, 0, 2, {0, 0, 0}, transform); | |
if (scale != {1, 1, 1}) { | |
usd_addscale(0, @primpath, "remove_scale", 1 / scale); | |
} |
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 logging | |
from typing import Dict | |
import hou | |
log = logging.getLogger(__name__) | |
def get_material_library_paths(material_lib: hou.LopNode) -> Dict[str, str]: | |
"""Return Houdini material node path to USD path mapping |
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 logging | |
from typing import List | |
import hou | |
import loputils | |
from pxr import Usd, UsdShade | |
log = logging.getLogger(__name__) |