This entry was posted on Friday, June 15th, 2012 at 7:13.am and is filed under Blackboard. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.
Adding attributes to sets in maya…
So got a couple of queries on how you actually add attributes to sets in practice.
When cgm.setTools creates a set with selected channel box attributes on the fly, there are a couple of processes going on.
- A set is created
- The channel boxes are queried for selection via the function cgm.lib.search.returnSelectedAttributesFromChannelBox
- There’s an active selection query for regular objects
- Objects and selected attributes are added to that set
Sometimes you just wanna do stuff yourself so here’s a few examples. Here’s an example of adding an attribute to an existing set. So in this case, the existing set is ‘point_lightSet’ and the attribute is ‘nurbsSphere1.translateX’:
import maya.cmds as mc setName = 'point_lightSet' attribute = 'nurbsSphere1.translateX' mc.sets(attribute,add =setName)
If you just wanted to create a set from a list of attributes, you’d wanna call that list into the sets command like this:
mc.sets([listOfAttributes])
I’m curious if anyone out there has an older version of maya (<2011) that this doesn’t work on. Maybe it didn’t allow for this at one point in time and I missed when it changed.

