def groupParent(groups, prefix, suffix):grps = []for i in range(len(groups)):grps.append(mc.createNode('transform', n="%s%s%s_%s" % (prefix, suffix, groups[i], GROUP)))if i > 0:mc.parent(grps[i], grps[i - 1])
def matchPosition(objectOri, object):mc.delete(mc.parentConstraint(objectOri, object, mo=False))
def createControl(suffix='ctrl',groups=['zro'],gimbal=None,gimbalSize=0.5,shape=SQUARE,connect=[]):for obj in mc.ls(sl=1):ctrl = controller(shape)renCtrl = mc.rename(ctrl, prefixName(obj))grpPrnt = groupParent(groups, renCtrl, suffix.title())mc.parent(renCtrl, grpPrnt)finName = mc.rename(renCtrl, '%s_%s' % (prefixName(obj), suffix))doMatch = matchPosition(obj, grpPrnt)
def groupParent(groups, prefix, suffix):
grps = []
for i in range(len(groups)):
grps.append(mc.createNode('transform', n="%s%s%s_%s" % (prefix, suffix, groups[i], GROUP)))
if i > 0:
mc.parent(grps[i], grps[i - 1
])
return grps
def foo(myList=None):
if myList is None:
myList = ['default']
--
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/4129465e-02e4-4ef6-94fe-8abf14c225c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
if connect:
def parentObject(ctrl, obj):
mc.parent(obj, ctrl)
dic = {'parentCons': mc.parentConstraint,
'pointCons': mc.pointConstraint,
'orientCons': mc.orientConstraint,
'scaleCons': mc.scaleConstraint,
'parent': parentObject}
for con in connect:
dic[con](parCtrl, obj)
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/4129465e-02e4-4ef6-94fe-8abf14c225c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1k5CRuC%2B4g9Y2uf3kfsNjqrVZVbgCYBL9ZNu30sos3UQ%40mail.gmail.com.
Hi Justin,Thanks for the solved! It works now. Regarding the function I didn't get about createControl function that you mentioned. Can you explaining means about more growing on every call?!
def foo(aList=[]):
aList.append(1)
return aList
foo()
# [1]
foo()
# [1, 1]
foo()
# [1, 1, 1]
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/4129465e-02e4-4ef6-94fe-8abf14c225c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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/CAPGFgA1k5CRuC%2B4g9Y2uf3kfsNjqrVZVbgCYBL9ZNu30sos3UQ%40mail.gmail.com.
--
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/CAE5XL93dmFDEcSCDvm%2Brr_XtnSEn_B6ZVc9Z73cyAET5-C6M_A%40mail.gmail.com.