This is my outliner, eg. '|hie1|cube1' and 'cube2'
If I select cube1 and did:
cmds.parent("|hie1|cube1", world=True)
This will unparent my cube1 out of hie1 and into 'world' level? Sorry,
can't think of a better term.
But if I did the same thing to cube2:
cmds.parent("cube2", world=True)
I will get an error:
# Warning: Object, 'cube2', skipped. It is already a child of the parent,
'world'. #
# Error: Maya command error
# Traceback (most recent call last):
# File "<maya console>", line 2, in <module>
# RuntimeError: Maya command error #
Even as I used `try...except...` it does not stops my tool function but you
can explicitly see in the status line that there is a quick flash of red
color before it disappears.
Is there any command that enables me to check if the object is already in
'world' or better ways to get around this problem?
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/3405f3cc-b1f3-4fd5-9f41-4f091f6f5013%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.