I needed to use the functionality of a method in an outside python script that I could look at, but not alter at all. This method used a GUI to gather some information before acting[…]
Category: Scripting
Unlocking Maya nodes
Unlocking Maya nodes is straightforward. import maya.cmds as cmds lockedList = [‘PxrCamera’, ‘PxrDebugShadingContext’, ‘PxrDefault’, ‘PxrDirectLighting’, ‘PxrOcclusion’, ‘PxrPathTracer’, ‘PxrValidateBxdf’, ‘PxrVCM’, ‘PxrVisualizer’, ‘TurtleBakeLayerManager’, ‘TurtleDefaultBakeLayer’, ‘TurtleRenderOptions’, ‘TurtleUIOptions’, ‘OmnidirectionalStereo’] for locked in lockedList: cmds.lockNode(locked, lock[…]
Turn thumbnail updates on/off
If you have a Maya file with a lot of materials with textures, opening the Hypershade can be a huge gamble. It can take a ridiculously long time for Maya to calculate and load all[…]
List Comprehensions
List Comprehensions are wonderful things. What is a list comprehension? It’s a bit of syntactic sugar that helps you filter and/or alter a list to create a new list. It makes your code shorter, more[…]
Listing Python class attributes
If you have a class (let’s call it TestClass) and you need to see what attriutes are defined in it, make a class object and then use the __dict__ command. m = TestClass() m.__dict__ that[…]
Finding a module’s path
If you’re working on a script that has imported a bunch of modules, and you need to know where they actually live so you can take a look at them then use the __file__ command.[…]
Connect/Disconnet UI
When you want to create a Maya UI, every modern Maya tutorial will chastise you if you don’t put that UI in a class. It makes sense… that way once you’ve initialized the UI class,[…]
Exploring Maya API
I decided to mess around with the MayaAPI a little bit, just to see what it could do. This is by no means a finished script! You can NOT undo, so only test it out[…]
Get Nuke version
Reports the Nuke version information print nuke.NUKE_VERSION_STRING versionMaj = nuke.NUKE_VERSION_MAJOR versionMin = nuke.NUKE_VERSION_MINOR versionRel = nuke.NUKE_VERSION_RELEASE if versionMaj < 9: print “Old version!” else: print “Newer version!”
Roto Recursion
I needed to change the motion blur attribute for a long list of roto splines in Nuke. Note here that all of the roto nodes I’m searching for are by convention, contained in groups. If[…]