Joe Hultgren - Technical Artist
  • Blog
  • Demo reel
  • About Me
  • Maya Scripts (bitbucket)

Using utility shading nodes in Pymel

8/14/2013

3 Comments

 
When building a rig utility nodes like mulipyDivide or reverse are a handy way of setting up functionality of controls. But after you've setup an IKFK blend for what feels like the hundredth time you start looking for a way to automate connecting up all those attributes. 

If you go to the pymel docs and search for how to create these nodes you probably wont find what you where hoping for. While the latest docs have information on the nodes themselves there aren't any good examples like there are for most of the  other pymel commands.  

Since the docs aren't helping lets go back to Maya and look at what is output to the script editor when we make these nodes by hand. Open up the hypershade or node editor and make some of the nodes we want. You should see something like this.
 shadingNode -asUtility reverse;
shadingNode -asUtility multiplyDivide;
shadingNode -asUtility vectorProduct;
Looking at these they are all made with the shadingNode command. If we go back to the pymel docs we can find a command that matches up in rendering/shadingNode. The examples are still pretty sparse but essentially we use the command like this.
 import pymel.core as pm
pm.shadingNode('[NODETYPE]', [NODECLASSIFICATION]=True)
For [NODETYPE] we enter what node we want as a string, in our case 'reverse' or 'multiplyDivide'. [NODECLASSIFICATION] is needed to tell maya where to put this node in the hypershade. We use as asUtility=True since we are making utility nodes, if you are making a light or shader you should use asLight or asShader respectively following the docs. So when we fill those things in our code will look like this.
  utility = pm.shadingNode('reverse', asUtility=True)  
The command returns a pynode which contains the node made which we can store in a variable in this case utility. With our node safely in a variable we can use it however we want.

Now that we have our utility nodes how do we hook it up? 

To do this we have to look into pymel's attribute system which I'll be getting into next time.
3 Comments

Reorganized scripts site

8/13/2013

0 Comments

 
I've been meaning to do this for awhile but I've gone back and reorganized my maya scripts site. There are now folders that group things into different categories and some of the files have been renamed to be more descriptive. I've also started adding some newer things I've worked on. The wiki page over at bitbucket explains what the folders are.
0 Comments

    Archives

    September 2017
    February 2017
    April 2016
    October 2013
    September 2013
    August 2013
    March 2012
    February 2012
    August 2011
    July 2011
    May 2011
    April 2011
    February 2011
    October 2010
    August 2010
    July 2010
    June 2010
    April 2010
    January 2010
    October 2009
    July 2009
    June 2009

    Categories

    All
    Art
    Blender
    Code
    Flash
    Free
    Maya
    Personal
    Pymel
    Python
    Rig
    School
    Siggraph
    Vancouver
    Vfs
    Website
    Work

    RSS Feed

    View my profile on LinkedIn
Powered by Create your own unique website with customizable templates.