I have a list of Groups with a curve as a child object. I want to parent the group to the cild (curve) of the previous group. Images attached as an example. How do I do it wit python?
Thanks in advance ๐
Solved! Go to Solution.
I have a list of Groups with a curve as a child object. I want to parent the group to the cild (curve) of the previous group. Images attached as an example. How do I do it wit python?
Thanks in advance ๐
Solved! Go to Solution.
Solved by jarombrand. Go to Solution.
There are several ways you could do it, but here is one way with PyMel:
import pymel.core as pm
sel = pm.selected()
for x, s in enumerate(sel):
if x:
pm.parent(s, sel[x-1].getChildren())
Simply selected the groups in the order you want them parented and run this code. Let me know if you have questions about it
There are several ways you could do it, but here is one way with PyMel:
import pymel.core as pm
sel = pm.selected()
for x, s in enumerate(sel):
if x:
pm.parent(s, sel[x-1].getChildren())
Simply selected the groups in the order you want them parented and run this code. Let me know if you have questions about it
I'm getting this error:
# Error: line 1: MayaAttributeError: file /Applications/Autodesk/maya2017/Maya.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python2.7/site-packages/pymel/core/general.py line 2200: Maya Attribute does not exist (or is not unique):: u"[nt.Transform(u'nurbsCircle2')]" #
I'm getting this error:
# Error: line 1: MayaAttributeError: file /Applications/Autodesk/maya2017/Maya.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python2.7/site-packages/pymel/core/general.py line 2200: Maya Attribute does not exist (or is not unique):: u"[nt.Transform(u'nurbsCircle2')]" #
Because Maya is dependent on node names, if there are duplicate node names in the scene it can screw things up. I would suggest properly naming your nodes before using this script.
Because Maya is dependent on node names, if there are duplicate node names in the scene it can screw things up. I would suggest properly naming your nodes before using this script.
Can't find what you're looking for? Ask the community or share your knowledge.