Skip to content

Instantly share code, notes, and snippets.

View BigRoy's full-sized avatar

Roy Nieterau BigRoy

View GitHub Profile
@BigRoy
BigRoy / usd_get_registered_prim_type_schemas.py
Created November 19, 2023 22:59
Get all registered prim types to create by a nice plug-in grouping
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",
@BigRoy
BigRoy / usd_sdf_move_prim_spec.py
Last active November 16, 2023 11:52
USD API move prim spec including repathing relationships and connections to it and its children in a single Sdf Layer
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
@mcoliver
mcoliver / migratecinesync.py
Created January 18, 2023 01:33
migrate cinesync v4 to v5
import uuid
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
# Download cinesync v4 list by saving the html at https://www.cinesync.com/dashboard
# cat cineSync.html | grep c-callout__heading | grep -o -P '(?<=\>).*(?=\<)' | sort | uniq | grep '@' > useraccounts.txt
# Run this script once and sign in to set your cinesync login credentials
# send an email to the list to have them reset their password @ https://5.cinesync.com/auth/password_reset/
@BigRoy
BigRoy / pyblish_debug_stepper.py
Last active December 28, 2023 20:33
Pyblish debug stepper - pauses between each plug-in process and shows the Context + Instances with their data at that point in time
import pprint
import inspect
import html
import copy
import pyblish.api
from Qt import QtWidgets, QtCore, QtGui
TAB = 4* "&nbsp;"
@zachlewis
zachlewis / package.py
Last active February 14, 2022 03:25
alternate python rez package
name = "python"
version = "3.8.6"
authors = [
"Guido van Rossum"
]
description = \
"""
@BigRoy
BigRoy / avalon_cgwire_qtazu_link.py
Last active February 27, 2024 23:21
Example API for linking CG-Wire with Avalon with Qtazu
@Muream
Muream / bake_to_opm.py
Last active April 29, 2024 16:50
This script bakes the transformation of a node to its offset parent matrix which then acts as its rest matrix. Only works with maya 2020 and up.
import maya.api.OpenMaya as om
import maya.cmds as cmds
TRANSFORM_NODETYPES = ["transform", "joint"]
def has_non_default_locked_attributes(node):
locked_attributes = []
for attribute in ["translate", "rotate", "scale", "jointOrient"]:
default_value = 1 if attribute == "scale" else 0
for axis in "XYZ":
@tokejepsen
tokejepsen / otio_to_ffmpeg.py
Last active November 24, 2020 08:48
OTIO to FFMPEG
import subprocess
import sys
import os
import json
import shutil
import requests
import opentimelineio as otio
@davidlatwe
davidlatwe / plugins.py
Created September 1, 2019 10:17
Maya scene modification aware via Pyblish
"""Implement scene modification awareness
By tracking Maya's undo queue, if there are any undo command that is not
a simple select after collecting completed, consider this scene has been
modified and require to reset Pyblish.
"""
import collections
@tbttfox
tbttfox / mayaToNumpy.py
Last active May 8, 2024 07:50
Blazing fast maya api types to Numpy conversion
from maya import OpenMaya as om
import numpy as np
from ctypes import c_float, c_double, c_int, c_uint
_CONVERT_DICT = {
om.MPointArray: (float, 4, c_double, om.MScriptUtil.asDouble4Ptr),
om.MFloatPointArray: (float, 4, c_float , om.MScriptUtil.asFloat4Ptr),
om.MVectorArray: (float, 3, c_double, om.MScriptUtil.asDouble3Ptr),
om.MFloatVectorArray: (float, 3, c_float , om.MScriptUtil.asFloat3Ptr),
om.MDoubleArray: (float, 1, c_double, om.MScriptUtil.asDoublePtr),