PDA

View Full Version : Python Listing Transform Nodes


gunner89
11-11-2010, 09:45 PM
Hi, im trying to learn coding GUI's for Maya using Python and im trying to write a function which will list all of the transform nodes within a scene. I would greatly appreciate any help, thanks.

p, li { white-space: pre-wrap; }

# function to list the transform nodes in a scene
import maya.cmds as cmds
AllTransform = cmds.ls(tr=True)
print AllTransform

mduvekot
11-12-2010, 03:38 PM
Here's a VERY simplistic example that will get you started.


from maya import cmds as mc

def listTransformsUI():
i= 0
mc.window(width=150, height= 150, title="transforms")
layoutForm = mc.formLayout()
tsl = mc.textScrollList()
items = mc.ls(tr=True)
while (i < len(items)):
mc.textScrollList(tsl, edit=True, append=items[i])
i = i + 1
mc.formLayout( layoutForm, edit=True, attachForm=[(tsl, 'top', 0), (tsl, 'left', 5), (tsl, 'bottom', 5), (tsl, 'right', 5)] )
mc.showWindow()

listTransformsUI()

CGTalk Moderation
11-12-2010, 03:38 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.