Weird pymel hierarchy results

63 views
Skip to first unread message

Aren Voorhees

unread,
Oct 18, 2015, 11:40:19 PM10/18/15
to Python Programming for Autodesk Maya
Hey all,

I've noticed this sort of thing sometimes when using pymel.  If I run something like: curSel = pm.selected()[0] with a joint selected it will normal return: 

// Result: nt.Joint(u'Hand_L_Result_JNT) //

That result is expected, but then other times it returns the entire hierarchy like this: 

// Result: nt.Joint(u'Arm_L_Upper_Result_JNT|Arm_L_UpperRoll_Result_JNT|Arm_L_Lower_Result_JNT|Arm_L_LowerRoll_Result_JNT|Hand_L_Result_JNT') //

It seems to happen randomly and I haven't figured out how to get rid of it.  Does anyone know what causes this, and how to prevent it?

Thanks!  

Chris Lesage

unread,
Oct 19, 2015, 12:05:58 AM10/19/15
to python_in...@googlegroups.com
Hey Aren,

That (usually) happens when you have more than one node with the same name. Maya resolves the conflict by showing the entire path. 

You can still use .nodeName() if you need to grab just the name without the path. But watch out for conflicts.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/02b926c5-91cc-466a-a875-3c6bea34330d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Geordie Martinez

unread,
Oct 19, 2015, 1:51:57 AM10/19/15
to python_in...@googlegroups.com
Or you can always use .longName()
So if you try and select that joint later you don't get an error resulting from having two identical node names. 

It's probably better to have unique joint names in the first place.

Aren Voorhees

unread,
Oct 19, 2015, 11:44:39 PM10/19/15
to Python Programming for Autodesk Maya
Wow, what a goofy mistake on my part! - I had mirrored some arm joints, but hadn't renamed them before messing about with the script, hence the repeat names.

Anyway, thank you both for helping out!

Reply all
Reply to author
Forward
0 new messages