本文整理汇总了Python中pymel.core.duplicate函数的典型用法代码示例。如果您正苦于以下问题:Python duplicate函数的具体用法?Python duplicate怎么用?Python duplicate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了duplicate函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __mirrorBlendShape
def __mirrorBlendShape(self,*args):
pm.select(self.baseShape)
baseShape = pm.ls(sl = 1)[0]
pm.select(self.sculptedShape)
sculptedShape = pm.ls(sl = 1)[0]
baseWarp = pm.duplicate(baseShape,n = nameUtils.setUniqueName(baseShape + 'Warp','geo'))
baseScaleNeg = pm.duplicate(baseShape,n = nameUtils.setUniqueName(baseShape + 'ScaleNeg','geo'))
#flip scale
pm.setAttr(baseScaleNeg[0] + '.scaleX', -1)
tempBlend = pm.blendShape(sculptedShape,baseScaleNeg[0],n = nameUtils.setUniqueName(sculptedShape + 'TempBlend','geo'))
#create warp between warp and neg
pm.select(cl=True)
pm.select(baseWarp)
pm.select(baseScaleNeg,add = 1)
pm.runtime.CreateWrap()
pm.setAttr(tempBlend[0] + '.' + sculptedShape, 1)
#Duplicate Wrapped shape for final result
pm.duplicate(baseWarp)
#Clean up setup
pm.delete(baseWarp,baseScaleNeg)
开发者ID:RyugasakiHu,项目名称:AT_Rigging,代码行数:27,代码来源:toolModule.py
示例2: buildChains
def buildChains(self, *args):
"""
Build joint chains based on locator positions.
"""
self.jointChain = []
self.ikChain = []
self.fkChain = []
loc1Pos = pm.xform(self.loc1, q=True, ws=True, t=True)
loc2Pos = pm.xform(self.loc2, q=True, ws=True, t=True)
loc3Pos = pm.xform(self.loc3, q=True, ws=True, t=True)
jnt1='%s_shldrJnt'%self.prefix
jnt2='%s_elbow1Jnt'%self.prefix
jnt3='%s_wristJnt'%self.prefix
self.jointChain.append(pm.PyNode(pm.joint(p=loc1Pos, n=jnt1)))
self.jointChain.append(pm.PyNode(pm.joint(p=loc2Pos, n=jnt2)))
self.jointChain.append(pm.PyNode(pm.joint(p=loc3Pos, n=jnt3)))
#--- Orient the chain
self.orientChain()
#--- Creating duplicate ik/fk joint chains
for each in pm.duplicate(self.jointChain, rc=True):
# Slice off number maya adds during duplication
each.rename('%s_ik' % each[:-1])
self.ikChain.append(pm.PyNode(each))
for each in pm.duplicate(self.jointChain, rc=True):
each.rename('%s_fk' % each[:-1])
self.fkChain.append(pm.PyNode(each))
开发者ID:Mauricio3000,项目名称:MSH_Maya,代码行数:32,代码来源:ms_armRig.py
示例3: create_deltaMush
def create_deltaMush(bindGeo, iterations = [5, 10, 20, 30, 40]):
smoothGeo = pm.duplicate( bindGeo, rr=True, ic=True, name=bindGeo.name() + "_smooth") [0]
smoothGeo.addAttr("envelope", at='long', min=0, max=1, dv=1, k=True)
smoothGeo.addAttr("partitions", at='message')
deltaGeo = pm.duplicate( bindGeo, rr=True, ic=False, name="BS_" + bindGeo.name() + "_delta") [0]
pm.select(deltaGeo, smoothGeo)
pm.mel.eval("CreateWrap")
smoothNodes = []
smoothNodeSets = []
for i in range(0, len(iterations)):
smoothNode = pm.deformer([smoothGeo], type='smooth')[0]
smoothNode.iterations.set(iterations[i])
smoothGeo.envelope >> smoothNode.envelope
smoothNodes.append(smoothNode)
smoothNodeSet = smoothNode.message.listConnections()[0]
smoothNodeSet.clear()
smoothNodeSets.append(smoothNodeSet)
for smoothNodeSet in smoothNodeSets:
smoothNodeSet.clear()
partition = pm.partition(smoothNodeSets)
partition.message >> smoothGeo.partitions
skinCls = bindGeo.getShape().listConnections(type='skinCluster')[0]
joints = skinCls.getInfluence()
assign_iteration_set(joints, bindGeo, skinCls, deltaGeo)
开发者ID:adamfok,项目名称:afok_toolset,代码行数:32,代码来源:utils_deltaMush.py
示例4: instance
def instance(self, source_transform_node):
"""instances the given nodes hierarchy
"""
# duplicate the given node
# then replace the instanceable nodes with instances
# find instanceable nodes in the node and dupNode
source_hierarchy = self.walk_hierarchy(source_transform_node)
# if there is no node in the sourceHierarchy just return
# the instance of the given node
if len(source_hierarchy) < 1:
dup_node = pm.duplicate(source_transform_node, ilf=1, rc=True)[0]
pm.select(dup_node)
return
dup_node = pm.duplicate(source_transform_node, rc=True)[0]
dup_hierarchy = self.walk_hierarchy(dup_node)
for i, node in enumerate(dup_hierarchy):
shape = node.getShape()
if shape is not None and isinstance(shape,
tuple(self._instanceables)):
# instance the corresponding sourceNode
source_node = source_hierarchy[i]
new_instance_node = pm.duplicate(source_node, ilf=True)[0]
pm.parent(new_instance_node, node.getParent(), r=False)
pm.delete(node)
pm.select(dup_node)
return dup_node
开发者ID:sergeneren,项目名称:anima,代码行数:34,代码来源:hierarchy_instancer.py
示例5: duplicateArray
def duplicateArray(objA=None, noCopies=9, direction="+x", adj=0):
""" Duplicate Array of Objects """
if objA == None:
objA = getSelection()
else:
objA = pm.PyNode(objA)
if isinstance(objA, pm.nodetypes.Transform):
result = [objA]
width = getWidth(objA)
dup = pm.duplicate(objA)[0]
result.append(dup)
if "+x" in direction or "+X" in direction:
pos = dup.t.get()
pm.move(pos.x + width[0] + adj, pos.y, pos.z)
elif "-x" in direction or "-X" in direction:
pos = dup.t.get()
pm.move(pos.x - width[0] + adj, pos.y, pos.z)
if "+y" in direction or "+Y" in direction:
pos = dup.t.get()
pm.move(pos.x, pos.y + width[1] + adj, pos.z)
elif "-y" in direction or "-Y" in direction:
pos = dup.t.get()
pm.move(pos.x, pos.y - width[1] + adj, pos.z)
if "+z" in direction or "+Z" in direction:
pos = dup.t.get()
pm.move(pos.x, pos.y, pos.z + width[2] + adj)
elif "-z" in direction or "-Z" in direction:
pos = dup.t.get()
pm.move(pos.x, pos.y, pos.z - width[2] + adj)
for i in xrange(noCopies - 1):
dup = pm.duplicate(st=True)[0]
result.append(dup)
return result
开发者ID:atvKumar,项目名称:mkUtils,代码行数:33,代码来源:mkUtils.py
示例6: gimbal
def gimbal(**kwargs):
final = pm.nt.Transform(name = 'Gimbal')
circle1 = pm.modeling.circle(
constructionHistory = False,
normal = kwargs['normal'] if 'normal' in kwargs else [0, 1, 0],
radius = kwargs['radius'] if 'radius' in kwargs else 1
)[0]
circle2 = pm.duplicate(circle1, returnRootsOnly = True)[0]
circle2.rotateBy((90, 0, 0))
circle3 = pm.duplicate(circle1, returnRootsOnly = True)[0]
circle3.rotateBy((0, 0, 90))
for circle in [circle1, circle2, circle3]:
pm.makeIdentity(circle, apply = True)
shape = circle.getShape()
pm.parent(shape, final, shape = True, relative = True)
shape.rename('{0}Circle1Shape'.format(final.nodeName()))
pm.delete(circle)
return final
开发者ID:jenosavel,项目名称:jhRigBuilder,代码行数:28,代码来源:controls.py
示例7: bdSwitchFKIK
def bdSwitchFKIK(self):
if 'arm' in self.limb:
print self.side + ' arm FK->IK switch '
for loc in self.ikArmCons:
shadowLoc = pm.ls(self.namespace + self.side + loc + 'LOC')[0]
tempLoc = pm.duplicate(shadowLoc)
pm.parent(tempLoc,w=True)
ikCon = pm.ls(self.namespace + self.side + loc + 'CON',type='transform')[0]
if ikCon.name().find('armIK') > 0:
tempCnstr = pm.parentConstraint(tempLoc,ikCon)
else:
tempCnstr = pm.pointConstraint(tempLoc,ikCon)
pm.delete([tempCnstr,tempLoc])
self.armSwitchCon.attr('ikFkBlend').set(0)
elif 'leg' in self.limb:
print self.side + ' leg FK->IK switch '
for loc in self.ikLegCons:
shadowLoc = pm.ls(self.namespace + self.side + loc + 'LOC')[0]
tempLoc = pm.duplicate(shadowLoc)
pm.parent(tempLoc,w=True)
ikCon = pm.ls(self.namespace + self.side + loc + 'CON',type='transform')[0]
if ikCon.name().find('legIK') > 0:
tempCnstr = pm.parentConstraint(tempLoc,ikCon)
else:
tempCnstr = pm.pointConstraint(tempLoc,ikCon)
pm.delete([tempCnstr,tempLoc])
self.legSwitchCon.attr('ikFkBlend').set(0)
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:34,代码来源:bdFrogIKFK.py
示例8: rig_ctrlDuplicate
def rig_ctrlDuplicate(ctrl, name):
"""Creates a hub set
Args:
ctrl (pm.PyNode): maya objects to rename
name (str): new name
Returns:
list: [offset_grp, ctrl, con_grp]
"""
orig_name = ctrl.split('_')[0]
grp_offset,grp_con = None,None
if str(ctrl.getParent()) == orig_name+'Offset_GRP':
grp_offset = pm.PyNode(orig_name + 'Offset_GRP')
if orig_name+'Con_GRP' in ctrl.getChildren():
grp_con = pm.PyNode(orig_name+'Con_GRP')
if grp_offset:
grp_offsetDup = pm.duplicate(grp_offset,n=name+'Offset_GRP',po=True)
ctrl_dup = pm.duplicate(ctrl,n=ctrl.replace(orig_name, name))
ctrl_dup[0].setParent(grp_offsetDup)
for child in ctrl_dup[0].getChildren():
if child.type() != 'nurbsCurve':
pm.delete(child)
if grp_con:
grp_conDup = pm.duplicate(grp_con,n=name+'Con_GRP',po=True)
grp_conDup[0].setParent(ctrl_dup)
if grp_offset:
return [grp_offsetDup[0],ctrl_dup[0],grp_conDup[0]]
else:
return [None,ctrl_dup[0],grp_conDup[0]]
开发者ID:AndresMWeber,项目名称:aw,代码行数:28,代码来源:lib_mpc.py
示例9: bdSwitchIKFK
def bdSwitchIKFK(self):
if 'arm' in self.limb:
print self.side + ' arm IK -> FK switch'
for loc in self.fkArmCons:
shadowLoc = pm.ls(self.namespace + self.side + loc + 'LOC')[0]
tempLoc = pm.duplicate(shadowLoc)
pm.parent(tempLoc,w=True)
fkCon = pm.ls(self.namespace + self.side + loc + 'CON',type='transform')[0]
tempCnstr = pm.orientConstraint(tempLoc,fkCon)
pm.delete([tempCnstr,tempLoc])
self.armSwitchCon.attr('ikFkBlend').set(1)
elif 'leg' in self.limb:
print self.side + ' leg IK->FK switch '
for loc in self.fkLegCons:
shadowLoc = pm.ls(self.namespace + self.side + loc + 'LOC')[0]
tempLoc = pm.duplicate(shadowLoc)
pm.parent(tempLoc,w=True)
fkCon = pm.ls(self.namespace + self.side + loc + 'CON',type='transform')[0]
tempCnstr = pm.orientConstraint(tempLoc,fkCon)
pm.delete([tempCnstr,tempLoc])
self.legSwitchCon.attr('ikFkBlend').set(1)
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:32,代码来源:bdFrogIKFK.py
示例10: createIKSpline
def createIKSpline( jntList ):
pymelLogger.debug('Starting: createIKSpline()...')
# Make IK Spline
ikHandleTorso = pm.ikHandle( startJoint=jntList[0], endEffector=jntList[-1], solver = 'ikSplineSolver', numSpans = 4, name = jntList[-1]+'_'+Names.suffixes['ikhandle'])
# we should probably rename the object created to know names ......
# CAREFULL // inherits Transform OFF, to avoid double transformation when grouped later on
pm.setAttr(ikHandleTorso[2] + '.inheritsTransform', 0)
# Duplicate last and first joint to use as Drivers of the spine Ik curve
print jntList
drvStart = pm.duplicate(jntList[0], parentOnly=True, name = Names.prefixes['driver']+'_'+ jntList[0] +'_'+Names.suffixes['start'])
drvEnd = pm.duplicate(jntList[-1], parentOnly=True, name = Names.prefixes['driver']+'_'+ jntList[-1] +'_'+Names.suffixes['end'])
pm.parent(drvEnd, w=1)
# Make radius bigger
pm.joint(drvStart, edit = True, radius = 1)
pm.joint(drvEnd, edit = True, radius = 1)
# Skin hip/shldr jnt's to back curve
pm.skinCluster(drvStart,drvEnd,ikHandleTorso[2],dr=4)
# return nedded elements
rList = [ikHandleTorso, drvStart, drvEnd ]
pymelLogger.debug('End: createIKSpline()...')
return rList
开发者ID:Mauricio3000,项目名称:MSH_Maya,代码行数:26,代码来源:Torso.py
示例11: copy_correctiveToBlend
def copy_correctiveToBlend(base, corrective):
'''Bakes a static mesh that can be used as a corrective to what you've posed
Args:
base (pm.PyNode): base object with bad shape from skinCluster or blendShapes
corrective (pm.PyNode): sculpted fixed shape
Returns:
[pm.PyNode]: new corrected shape
Usage:
copy_correctiveToBlend(pm.ls(sl=True)[0], pm.ls(sl=True)[1])
'''
#Duplicate your deformed mesh twice, calling one positive and one negative. Move them a little away from your model
positive = corrective
negative = pm.duplicate(base, n=corrective.name()+"_negative")[0]
inputs = pm.listConnections(base.getShape(), type=['skinCluster','blendShape'])
for input in inputs:
input.attr('envelope').set(0)
corrected = pm.duplicate(base, n=corrective.name()+"_corrective")[0]
#Make a new blend-shape node on your character containing the two duplicate meshes. This blend shape must use the parallel blending mode.
blend = pm.blendShape(corrected, n='corrector_BS')[0]
pm.blendShape(blend, e=True, t=(corrected, 0, positive, 1.0))
pm.blendShape(blend, e=True, t=(corrected, 1, negative, 1.0))
set=1
for alias in blend.listAliases():
alias[1].set(set)
set=-1
#Move your character back to bind-pose and in the parallel blend-node, set the positive mesh to 1 and the negative to -1. This should blend your mesh so that you only have the deformations you made to the positive mesh, but now in a neutral pose.
#bindPose
#Duplicate this new mesh and call it something with the letters BS is the name because this is infinitely funny. This mesh can now be used as a corrective blend-shape
#Delete the parallel blend-node and repeat these steps for all your shapes. Yes, really.
#pm.delete(p_bs)
#pm.delete(base)
for input in inputs:
input.attr('envelope').set(1)
return corrected
开发者ID:AndresMWeber,项目名称:aw,代码行数:35,代码来源:lib_blends.py
示例12: makeFkIk
def makeFkIk(*args):
bindRoot = pm.ls(selection = True)[0]
bindChain = pm.ls(bindRoot, dag = True)
fkChain = pm.duplicate(bindRoot)
replaceSuffix(fkChain, 'fk')
makeFk(False, fkChain)
ikChain = pm.duplicate(bindRoot)
replaceSuffix(ikChain, 'ik')
makeIk(False, ikChain)
fkChainList = pm.ls(fkChain, dag = True)
ikChainList = pm.ls(ikChain, dag = True)
createPad(bindRoot)
suffixIndex = bindChain[0].rfind('_')
hanldeName = bindChain[0][:suffixIndex] + '_switch'
handle = createHandle(hanldeName)
pm.rename(handle, hanldeName)
pm.parentConstraint(bindChain[-1], handle)
constraintList = []
for i, item in enumerate(bindChain):
newConstraint = pm.orientConstraint(fkChainList[i], ikChainList[i], bindChain[i], mo = False)
fkCon = pm.orientConstraint(newConstraint, q = True, wal = True)[1]
ikCon = pm.orientConstraint(newConstraint, q = True, wal = True)[0]
pm.setDrivenKeyframe(fkCon, cd = handle + '.switch', v = 1, dv = 10)
pm.setDrivenKeyframe(fkCon, cd = handle + '.switch', v = 0, dv = 0)
pm.setDrivenKeyframe(ikCon, cd = handle + '.switch', v = 0, dv = 10)
pm.setDrivenKeyframe(ikCon, cd = handle + '.switch', v = 1, dv = 0)
开发者ID:kudiaborm,项目名称:mkScripts,代码行数:31,代码来源:riggingtoolkit.py
示例13: createJnts
def createJnts( LegJnts, side ):
pymelLogger.debug('Starting: createJnts()...')
# duplicate joints
listJnts = []
print LegJnts
for jnt in LegJnts:
pm.select(clear=1)
newJnt = pm.duplicate(jnt,rr=True,po=True, name=jnt+'_'+Names.suffixes['ik'])[0]
try:
newJnt.setParent(world=1)
except: pass
listJnts.append(newJnt)
print listJnts
# parent joints
listJnts.reverse()
index = 0
for jnt in listJnts:
if index+1 == len(listJnts): break
jnt.setParent(listJnts[index+1])
index = index + 1
listJnts.reverse()
# joints for inverse foot
ankleFloorJnt = '%s%s' %(side,'AnkleFloor_if')
# duplicate only joints ww for inverse foot
pm.select(clear=1)
toeBaseWW = listJnts[-3]
invfootname = str(toeBaseWW).replace('_'+Names.suffixes['ik'], '_inversefoot')
invfootjnt = pm.duplicate( toeBaseWW, name=invfootname )[0]
invfootjnt.setParent(w=1)
index = 1
invjntlist = invfootjnt.listRelatives(ad=1)
invjntlist.reverse()
for jnt in invjntlist:
jnt.rename(invfootname+str(index))
jnt.setParent(w=1)
index += 1
invjntlist.reverse()
invjntlist.append(invfootjnt)
invjntlist.reverse()
index = 0
for jnt in invjntlist:
if index+1 == len(invjntlist): break
jnt.setParent(invjntlist[index+1])
index = index + 1
# make them child of the Ankle floor jnt
invjntlist[-1].setParent(ankleFloorJnt)
pm.select(clear=1)
pymelLogger.debug('End: createJnts()...')
print listJnts
return listJnts
开发者ID:Mauricio3000,项目名称:MSH_Maya,代码行数:58,代码来源:CanidaeLeg.py
示例14: duplicateJointChain
def duplicateJointChain( *joints ):
'''
update : 2015-04-04
'''
if joints:
pm.select(joints)
joints = pm.selected(type='joint')
# 입력된게 없으면 에러
if not joints:
raise
# 선택된게 하나이면?
if len(joints)==1 :
dupJnt = pm.duplicate( joints[0], po=True )[0]
dupJnt.setParent( w=True )
pm.select(dupJnt)
return [dupJnt]
else:
startJoint = joints[0]
endJoint = joints[-1]
# endJoint가 startJoint의 parent가 아니면 에러
if endJoint not in startJoint.getChildren( allDescendents=True ):
raise
# 복사할 조인트 리스트 만듦
jointList = [ endJoint ]
p = endJoint.getParent()
while p!=startJoint:
jointList.append( p )
p = p.getParent()
jointList.append( startJoint )
# 새로운 조인트 복사
newJoint = []
for jnt in jointList:
jnt = pm.duplicate(jnt, returnRootsOnly=True, renameChildren=True, parentOnly=True)[0]
newJoint.append(jnt)
# parent
for i in range( len(newJoint[:-1]) ):
newJoint[i].setParent( newJoint[i+1])
# 루트로 옮김
newJoint[-1].setParent(w=True)
#
newJoint.reverse()
return newJoint
开发者ID:kyuhoChoi,项目名称:mayaTools,代码行数:54,代码来源:joint.py
示例15: bdBuildSplineSolverScale
def bdBuildSplineSolverScale():
selection = pm.ls(sl=1,type='transform')
startJoint = ''
if selection:
startJoint = selection[0]
else:
return
print startJoint
ikSpline = pm.listConnections(startJoint,type='ikHandle')[0]
print ikSpline
solver = ikSpline.ikSolver.inputs()[0]
if 'ikSplineSolver' in solver.name():
sclChain = pm.duplicate(startJoint,name = startJoint.name() + '_SCL')[0]
sclChainAll = sclChain.listRelatives(f=True, ad=True,type='joint')
print sclChainAll
for sclJnt in sclChainAll:
pm.rename(sclJnt,sclJnt+'_SCL')
splineCurve = pm.listConnections(ikSpline, type = 'nurbsCurve')[0]
effector = pm.listConnections(ikSpline ,source=True, type='ikEffector')[0]
endJoint = pm.listConnections(effector,source=True, type='joint')[0]
jointChain = startJoint.listRelatives(f=True, ad=True,type='joint')
jointChain = jointChain + [startJoint]
jointChain.reverse()
print jointChain
splineCurveScl = pm.duplicate(splineCurve,name = splineCurve.name().replace('crv','crv_scl'))
strArclenSCL = pm.arclen(splineCurveScl,ch=True)
strArclenCRV = pm.arclen(splineCurve,ch=True)
arclenSCL = pm.ls( strArclenSCL ) [0]
arclenCRV = pm.ls( strArclenCRV ) [0]
arclenSCL.rename(splineCurveScl[0].name() + '_length')
arclenCRV.rename(splineCurve.name() + '_length')
mdScaleFactor = pm.createNode('multiplyDivide', name = splineCurve.name().replace('crv','crv_scaleFactor_md'))
arclenCRV.arcLength.connect(mdScaleFactor.input1X)
arclenSCL.arcLength.connect(mdScaleFactor.input2X)
mdScaleFactor.operation.set(2)
for jnt in jointChain[1:]:
mdJntTr = pm.createNode('multiplyDivide', name = jnt + '_trX_MD')
#mdJntTr.operation.set(2)
sclJnt = pm.ls(jnt + '_SCL')[0]
mdScaleFactor.outputX.connect(mdJntTr.input2X)
sclJnt.translateX.connect(mdJntTr.input1X)
mdJntTr.outputX.connect(jnt.translateX)
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:53,代码来源:bdRigUtils.py
示例16: build_tweek_ctrls
def build_tweek_ctrls(self, follicles):
"""
Args:
None
Returns (None)
"""
base_name = '%s_flexiPlane' % self.flexiPlaneNameField.getText()
follicle_prefix = '%s_flexiPlane_' % self.flexiPlaneNameField.getText()
mainCTRLGRP = self.flexiPlaneNameField.getText() + '_flexiPlane_main_CTRLCon_GRP'
main_crv_name = '%s_main_CTRL' % base_name
tweekCTRLGRP = pm.group( em = True, name = self.flexiPlaneNameField.getText() + '_flexiPlane_tweakCTRL_GRP' )
tweekCTRLGRP.setAttr( 'inheritsTransform', 0 )
pm.parent( tweekCTRLGRP, mainCTRLGRP )
for index,follicle in enumerate(follicles):
tweek_crv_name = self.format_string.format(PREFIX = self.flexiPlaneNameField.getText(),
INDEX = 'flexiPlane_tweak%03d' % (index+1),
SUFFIX = 'CTRL')
pm.circle( c = (0, 0, 0 ), nr = ( 0, 1, 0 ), sw = 360, r = 1, d = 3, ut = 0, tol = 0.000129167, s = 8, n = tweek_crv_name, ch = 0 )
pm.setAttr( tweek_crv_name + '.scaleX', .5 )
pm.setAttr( tweek_crv_name + '.scaleY', .5 )
pm.setAttr( tweek_crv_name + '.scaleZ', .5 )
pm.setAttr( tweek_crv_name + '.overrideEnabled', 1 )
pm.setAttr( tweek_crv_name + '.overrideColor', 17 )
pm.makeIdentity( tweek_crv_name, apply=True, translate=True, rotate=True, scale=True )
pm.setAttr( tweek_crv_name + '.overrideEnabled', 1 )
pm.setAttr( tweek_crv_name + '.overrideColor', 17 )
pm.duplicate( tweek_crv_name, n= tweek_crv_name + 'A' )
pm.setAttr( tweek_crv_name + 'A.rotateZ', -90 )
pm.makeIdentity( tweek_crv_name + 'A', apply=True, translate=True, rotate=True, scale=True )
pm.duplicate( tweek_crv_name, n= tweek_crv_name + 'B' )
pm.setAttr( tweek_crv_name + 'B.rotateZ', -90 )
pm.setAttr( tweek_crv_name + 'B.rotateX', -90 )
pm.makeIdentity( tweek_crv_name + 'B', apply=True, translate=True, rotate=True, scale=True )
pm.parent( tweek_crv_name + 'AShape', tweek_crv_name + 'BShape', tweek_crv_name, add = True, shape = True )
pm.delete( tweek_crv_name + 'A', tweek_crv_name + 'B')
pm.select(tweek_crv_name, r=True)
offSetGRP.add_offset_grps()
conGRP.add_con_grps()
pm.select(clear = True)
pm.connectAttr( follicle + '.translate', tweek_crv_name + 'Offset_GRP.translate' )
pm.connectAttr( follicle + '.rotate', tweek_crv_name + 'Offset_GRP.rotate' )
pm.parent( tweek_crv_name + 'Offset_GRP', tweekCTRLGRP )
pm.scaleConstraint( main_crv_name, tweek_crv_name + 'Offset_GRP' )
pm.select( clear = True)
开发者ID:michaelanieves,项目名称:Rigging,代码行数:52,代码来源:flexi_plane.py
示例17: bdMirrorCon
def bdMirrorCon(self):
print 'Mirror Controller'
mirrorType = self.mirrorRadioBtn.checkedId()
selection = pm.ls(sl=True)
if selection.count > 0:
for sel in selection:
if ('L_' in sel.name()) or ('R_' in sel.name()):
conGrp = sel.getParent()
conGrpPos = conGrp.getTranslation(space='world')
conGrpRot = conGrp.getRotation(space='world')
exp = ['L_','R_']
if 'R_' in conGrp.name():
exp.reverse()
mirrorConGrp = ''
if mirrorType == -2:
mirrorConGrp = pm.duplicate(conGrp,name = conGrp.name().replace(exp[0],exp[1]))[0]
scaleGrp = pm.group(mirrorConGrp)
scaleGrp.setPivots([0,0,0])
scaleGrp.scaleX.set(-1)
pm.parent(mirrorConGrp,world=True)
pm.makeIdentity(mirrorConGrp,apply=True,t=0,r=0,s=1)
pm.delete(scaleGrp)
mirrorConGrpRot = mirrorConGrp.getRotation(space='world')
print mirrorConGrpRot
mirrorConGrp.setRotation([mirrorConGrpRot[0],-1 * mirrorConGrpRot[1],180 - abs(mirrorConGrpRot[2])])
elif mirrorType == -3:
mirrorConGrp = pm.duplicate(conGrp,name = conGrp.name().replace(exp[0],exp[1]))[0]
mirrorConChildren = mirrorConGrp.getChildren(ad=True,type='transform')
for child in mirrorConChildren :
child.rename(child.name().replace(exp[0],exp[1]))
if mirrorType == -3:
mirrorConGrp.setTranslation([conGrpPos[0]*-1,conGrpPos[1],conGrpPos[2]])
for child in mirrorConChildren :
for shape in child.getChildren(type='shape'):
shape.overrideEnabled.set(1)
shape.overrideColor.set(self.conColors[exp[1]])
targetShape = pm.ls(child.name().replace(exp[1],exp[0]) + '*',type='shape')[0]
if mirrorType == -3:
self.bdMirrorShape(shape,targetShape)
else:
pm.warning( 'Central controller, no need (sic) to mirror it!')
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:51,代码来源:bdAnimCon_v04.py
示例18: bdBuildJointStructure
def bdBuildJointStructure(self,target,ctrlName,ikName):
startDrv = pm.duplicate(target,po=True,name=target.replace('jnt','side_drv_jnt'))
drvChain = pm.duplicate(target,name=target.replace('jnt','drv_jnt'))
drvChainChildren = pm.listRelatives(drvChain[0], c=True,type='joint',f=True)
for child in drvChainChildren:
if '02' in child.name():
child.rename(child.name().replace('bnd_jnt','drv_jnt'))
pm.parentConstraint(child,ctrlName.replace('anim','anim_CON'),mo=True,w=1)
pm.parent(drvChain[0],startDrv[0])
if 'upper' in startDrv[0].name():
pm.parent(startDrv[0],startDrv[0].split('_')[0] + '_eyelid_upper_blink_jnt')
elif 'lower' in startDrv[0].name():
pm.parent(startDrv[0],startDrv[0].split('_')[0] + '_eyelid_lower_blink_jnt')
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:14,代码来源:bdRigEyeRD_v01.py
示例19: create_deltaMush
def create_deltaMush(bindGeo, iterations=10):
smoothGeo = pm.duplicate( bindGeo, rr=True, ic=True, name=bindGeo.name() + "_smooth") [0]
deltaGeo = pm.duplicate( bindGeo, rr=True, ic=False, name=bindGeo.name() + "_delta") [0]
pm.select(deltaGeo, smoothGeo)
pm.mel.eval("CreateWrap")
smoothNode = pm.deformer([smoothGeo], type='smoothSimple')[0]
smoothNode.iterations.set(iterations)
newBaseGeo = pm.duplicate( smoothGeo, rr=True, ic=False, name=bindGeo.name() + "_smoothBase") [0]
wrapNode = deltaGeo.inMesh.listConnections()[0]
swap_wrap_deformer_base(wrapNode, newBaseGeo)
开发者ID:pombredanne,项目名称:pixo_rigging_dev,代码行数:15,代码来源:utils_deltaMush.py
示例20: bdRigEye
def bdRigEye(self):
#create IK handles for the bind joints, for now getting the joints based on the name
parts = []
if self.templateSide == 'both':
parts = ['left','right']
else:
parts = [self.templateSide]
for side in parts:
eyeLidsJnt = pm.ls(side + '*eyelid_*_01_jnt')
eyeJoint = pm.ls(side + "*eye*jnt")[0]
eyeCorners = pm.ls(side + "*eye*corner*01_jnt")
eyeAnim = pm.ls(side + '_eye_anim')
pm.select(cl=True)
eyeAnimGrp = pm.group(n=side + '_eyelids_anim_GRP')
pm.select(cl=True)
pm.aimConstraint(eyeAnim[0],eyeJoint,offset = [0, 0, 0] ,weight=1 , aimVector =[0 ,0 ,1] ,upVector=[0, 1, 0] ,worldUpType="vector" ,worldUpVector= [0,1,0])
blinkUpJnt = pm.duplicate(eyeJoint,name = side + '_eyelid_upper_blink_jnt',po=True)
blinkLowJnt = pm.duplicate(eyeJoint,name = side + '_eyelid_lower_blink_jnt',po=True)
baseLidsJnt = pm.ls(side + '*lids*base')
pm.parent([blinkUpJnt[0],blinkLowJnt[0]],baseLidsJnt[0])
for joint in (eyeLidsJnt + eyeCorners):
endJoint = pm.listRelatives(joint,c=True,type='joint')
ikName = endJoint[0].name().replace('02_bnd_jnt','ikHandle')
ctrlName = endJoint[0].name().replace('02_bnd_jnt','anim')
bdRigUtils.bdAddIk(joint.name(),endJoint[0].name(),'ikSCsolver',ikName)
eyelidAnim,eyelidAnimGrp = bdRigUtils.bdBuildSquareController(endJoint[0].name(),ctrlName,0.2)
pm.parent(eyelidAnimGrp , eyeAnimGrp)
#bdRigUtils.bdBuildBoxController(endJoint[0].name(),ctrlName,0.2)
if 'corner' not in ctrlName:
bdRigUtils.bdAddAttributeMinMax(ctrlName,['BlinkPosition'],'double',-5,5,1)
pm.parent(ikName,ctrlName)
self.bdBuildJointStructure(joint,ctrlName,ikName)
'''
allAnimsGrps = pm.ls(self.templateSide + '*eye*CON_??',type='transform')
globalAnimGrp = pm.ls('controllers')
pm.parent(allAnimsGrps,globalAnimGrp[0])
'''
self.bdAddEyeAttr(eyeAnim[0])
self.bdCreateVerticalFollow(side)
self.bdCreateSideFollow(side)
self.bdCreateBlink(side)
self.bdCleanupGuides(side)
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:48,代码来源:bdRigEyeRD_v01.py
注:本文中的pymel.core.duplicate函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论