Skip to content

Instantly share code, notes, and snippets.

View BigRoy's full-sized avatar

Roy Nieterau BigRoy

View GitHub Profile
@dbr
dbr / nuke_dot_arrange.py
Created October 1, 2011 08:44
Using graphviz's "dot" to arrange a Nuke node graph
"""Test of using graphviz's "dot" layout algorithm to arrange a Nuke node-graph
Example: http://i.imgur.com/f1mK7.png
Left is dot, right is Nuke's builtin nuke.autoplace
"""
import nuke
# http://code.google.com/p/pydot/
import pydot
@mfessenden
mfessenden / applyMayaMaterial.py
Last active May 17, 2024 08:49
Maya command to create a lambert shader & shading group node named for the object
import maya.cmds as mc
def applyMaterial(node):
if mc.objExists(node):
shd = mc.shadingNode('lambert', name="%s_lambert" % node, asShader=True)
shdSG = mc.sets(name='%sSG' % shd, empty=True, renderable=True, noSurfaceShader=True)
mc.connectAttr('%s.outColor' % shd, '%s.surfaceShader' % shdSG)
mc.sets(node, e=True, forceElement=shdSG)
applyMaterial("pSphere1")
@kalebo
kalebo / Instructions.md
Created October 4, 2017 17:35
Instructions on setting up a FlexLM daemon for SystemD

Setting up a FlexLM service for SystemD

Create directory structure

  1. Create the directory for the flexlm user to use, e.g., /opt/flexlm
  2. Place all the binaries for the licence manager and the licence in a vendor specific subdirectory

At this point you should have something similar to following directory structure:

/opt/flexlm/
└── VENDOR
@hdlx
hdlx / getClosestVertex.py
Last active September 21, 2023 08:19
Maya get closest vertex
import maya.api.OpenMaya as om
import maya.cmds as cmds
#returns the closest vertex given a mesh and a position [x,y,z] in world space.
#Uses om.MfnMesh.getClosestPoint() returned face ID and iterates through face's vertices.
def getClosestVertex(mayaMesh,pos=[0,0,0]):
mVector = om.MVector(pos)#using MVector type to represent position
selectionList = om.MSelectionList()
selectionList.add(mayaMesh)
dPath= selectionList.getDagPath(0)
@davidlatwe
davidlatwe / renderSetup_util.py
Last active June 1, 2023 10:12
Query renderSetup overrided attribute value without switching layer
import re
import itertools
from maya import cmds
from maya.app.renderSetup.model import selector as rs_selector
from maya.app.renderSetup.model import renderSettings as rs_render_settings
if float(cmds.about(version=True)) >= 2020.0:
_attr_highest_col = "containerHighest"
@tbttfox
tbttfox / mayaToNumpy.py
Last active May 23, 2024 09:43
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),
@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
@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
@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":
@BigRoy
BigRoy / avalon_cgwire_qtazu_link.py
Last active February 27, 2024 23:21
Example API for linking CG-Wire with Avalon with Qtazu