Hello i can`t figure out how to merge list of shapes under one transform
If to open a new scene the create 4 nurbsCircles move rotate scale them
then run this script:
import maya.cmds as mc
#----------------------------------------ShapeCombiner---------------------------------------------#
#Desctiption : create circle with parameters
class ShapeCombiner ():
# constructor
def __init__ ( self, curves = ['']):
#private members
self.shapes = ['']
mc.makeIdentity (curves, apply = True, t =1, r = 1, s = 1, n = 0, pn = 1)
# appending shapes to array
for curve in curves :
for shape in mc.listRelatives(curve, fullPath = 1, shapes = 1) :
self.shapes.append(shape)
#collect all shapes exept first one
tmpChildShapes = ['']
for i in range (2, len (self.shapes)):
tmpChildShapes.append( self.shapes[i])
i = 0
#combining shapes under one transform
for shape in tmpChildShapes:
i = i + 1
if i > 1:
mc.parent(shape, curves[0], add = 1, shape = 1)
#deleting old transform nodes
i = 0
for xform in curves:
i = i + 1
if i > 1:
mc.delete(xform)
#clear selection
mc.select(clear = 1)
#end ifif len (curves) > 0:
#combined shapes are all under this member
self.CombinedCurve = curves[0]
#----------------------------------------------------------------------------------------------#
# Test Build
c = ShapeCombiner(mc.ls (sl = 1))
# Status : stable