本文整理汇总了Python中maya.cmds.orientConstraint函数的典型用法代码示例。如果您正苦于以下问题:Python orientConstraint函数的具体用法?Python orientConstraint怎么用?Python orientConstraint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了orientConstraint函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: makeRoll
def makeRoll(firstJoint, lastJoint, rollJoint):
# place root group under its rig group
if "elbow" in firstJoint:
rigGroup = nameLib.groupNames.leftArmRigGroup["name"]
if "right" in firstJoint:
rigGroup = nameLib.groupNames.rightArmRigGroup["name"]
else:
rigGroup = nameLib.groupNames.leftLegRigGroup["name"]
if "right" in firstJoint:
rigGroup = nameLib.groupNames.rightLegRigGroup["name"]
rollSuffix = "_roll_null"
rootGroup = makeGroup.MakeGroup(name=rollJoint + "_rig" + nameLib.prefixNames.groupSuffix, snapTo=firstJoint, parent=rigGroup)
firstJointNull = makeGroup.MakeGroup(name=firstJoint + rollSuffix, snapTo= firstJoint, parent=rootGroup.groupName)
rollJointNull = makeGroup.MakeGroup(name=rollJoint + rollSuffix, snapTo= rollJoint, parent=rootGroup.groupName)
lastJointNull = makeGroup.MakeGroup(name=lastJoint + rollSuffix, snapTo= lastJoint, parent=rootGroup.groupName)
# make constraint setup
mc.parentConstraint(firstJoint, rootGroup.groupName, maintainOffset=True)
mc.parentConstraint(lastJoint, lastJointNull.groupName)
mc.orientConstraint(firstJointNull.groupName, rollJointNull.groupName, maintainOffset=True)
mc.orientConstraint(lastJointNull.groupName, rollJointNull.groupName, maintainOffset=True)
rollConstraint = mc.orientConstraint(rollJointNull.groupName, rollJoint, skip=["y", "z"])[0]
mc.setAttr(rollConstraint + ".interpType", 2)
开发者ID:robertvari,项目名称:rvRigTools,代码行数:28,代码来源:rollSetup.py
示例2: setupSw
def setupSw(self):
for joint in self._joints:
name = joint.replace(nameLib.prefixNames.jointSuffix, "") + nameLib.prefixNames.locator
# create locators
worldLocator = mc.spaceLocator(name="world_" + name)
localLocator = mc.spaceLocator(name="local_" + name)
# group for locators
rootGroup = utils.makeGroup.MakeGroup(name=name + nameLib.prefixNames.offsetGroup)
mc.parent(worldLocator, rootGroup.groupName)
mc.parent(localLocator, rootGroup.groupName)
# snap locators to posittion
mc.delete(mc.parentConstraint(joint, rootGroup.groupName))
# put them into root group
mc.parent(rootGroup.groupName, self._parent)
# orient constrain from global control
mc.orientConstraint(nameLib.prefixNames.globalControl + nameLib.prefixNames.controlSuffix, worldLocator, maintainOffset=True)
# constraint from parent
parent = mc.listRelatives(joint, parent=True)[0].replace(nameLib.prefixNames.jointSuffix, "")
parentControl = nameLib.prefixNames.fkPrefix + parent + nameLib.prefixNames.controlSuffix
mc.parentConstraint(parentControl, rootGroup.groupName, maintainOffset=True)
# create constraint for cotroller's driven group
drivenGroup = nameLib.prefixNames.fkPrefix + name.replace(nameLib.prefixNames.locator, "") + nameLib.prefixNames.controlSuffix + nameLib.prefixNames.drivenGroup
localWorldConstraint = mc.parentConstraint(worldLocator, drivenGroup)
localWorldConstraint = mc.parentConstraint(localLocator, drivenGroup)
# create connections from controller
weightList = [worldLocator[0] + "W0", localLocator[0] + "W1"]
self.connectSW(localWorldConstraint[0], parentControl, weightList)
开发者ID:robertvari,项目名称:rvRigTools,代码行数:35,代码来源:makeFKcontrol.py
示例3: __init__
def __init__(self, objs = [], vertices = []):
self.objs = objs
self.vertices = vertices
#lattice -divisions 2 3 2 -objectCentered true -ol 1;
#mc.select( self.objs, self.vertices )
#CREATION
grp = mn.Node( mc.group( n = "head_toon_GRP", em = True ) )
deGrp = mn.Node( mc.group( n = "head_toon_deformer_GRP", em = True ) )
deGrp.parent = grp
deGrp.a.v.v = False
deGrp.a.v.locked = True
latNods = mc.lattice( self.objs, self.vertices, divisions = [ 2,3,2], objectCentered = True, ol = 1, n = 'head_toon_LAT' )
latBase = mn.Node( latNods[2] )
latBase.parent = deGrp
lat = mn.Node( latNods[1] )
lat.parent = deGrp
#mc.select( lat + ".pt[0:1][2][0]", lat + ".pt[0:1][2][1]" )
topClus = mn.Node( mc.cluster( lat.shape.name + ".pt[0:1][2][0]", lat.shape.name + ".pt[0:1][2][1]", n = 'top_face_toon_CLU' )[1] )
topClus.a.v.v = False
topClus.a.v.locked = True
#mc.select( lat + ".pt[0:1][1][0]", lat + ".pt[0:1][1][1]" )
midClus = mn.Node( mc.cluster( lat.shape.name + ".pt[0:1][1][0]", lat.shape.name + ".pt[0:1][1][1]", n = 'mid_face_toon_CLU' )[1] )
#mc.select( lat + ".pt[0:1][0][0]", lat + ".pt[0:1][0][1]" )
lowClus = mn.Node( mc.cluster( lat.shape.name + ".pt[0:1][0][0]", lat.shape.name + ".pt[0:1][0][1]", n = 'low_face_toon_CLU' )[1] )
ctl = crv.Curve( "head_toon_CTL" )
ctl = ctl.create( "sphere" )
ctl.a.t.v = topClus.worldPosition
mc.makeIdentity( ctl.name, apply = True, t = 1, r = 1, s = 1, n = 2 )
topClus.parent = ctl
midClus.parent = deGrp
lowClus.parent = deGrp
ctl.parent = grp
#CONSTRAINS
midClus.a.r >> topClus.a.r
mc.pointConstraint( topClus.name, lowClus.name, midClus.name, mo = True )
#SCALE FOR MID CLUSTER
dist = mn.createNode( 'distanceBetween', n = 'head_toon_DIS' )
ctl.a.worldMatrix >> dist.a.inMatrix1
ctl.a.rp >> dist.a.point1
lowClus.a.worldMatrix >> dist.a.inMatrix2
lowClus.a.rp >> dist.a.point2
mul = mn.createNode( 'multiplyDivide', n = 'head_toon_scale_MUL' )
mul.a.input1.v = [dist.a.distance.v]*3
mul.a.operation.v = 2
dist.a.distance >> mul.a.input2X
dist.a.distance >> mul.a.input2Y
dist.a.distance >> mul.a.input2Z
mul.a.output >> midClus.a.s
#AIM CONSTRAINT
upLocGrp = mn.Node( mc.group( n = "head_upVector_GRP", em = True ) )
upLocGrp.a.t.v = midClus.worldPosition
mc.makeIdentity( upLocGrp.name, apply = True, t = 1, r = 1, s = 1, n = 2 )
upLocGrp.parent = deGrp
mc.orientConstraint( ctl.name, lowClus.name, upLocGrp.name, mo = True )
upLoc = mn.Node( mc.spaceLocator( n = 'head_upVector_LOC' )[0] )
upLoc.a.t.v = midClus.worldPosition
upLoc.a.tz.v = upLoc.a.tz.v + 5
mc.aimConstraint( topClus.name, midClus.name, mo = True, weight = 1, aimVector = [1, 0, 0], upVector = [0, 1, 0], worldUpType = "object", worldUpObject = upLoc.name )
upLoc.parent = upLocGrp
mc.pointConstraint( topClus.name, lowClus.name, upLoc.name, mo = True )
开发者ID:skarone,项目名称:PipeL,代码行数:60,代码来源:head.py
示例4: create_ik_setup
def create_ik_setup(self):
"""Creates the IK setup."""
ik = cmds.ikHandle(sj=self.result_jnts[0], ee=self.result_jnts[-1], sol='ikSplineSolver', ns=1)
cmds.rename(ik[1], '%s_%s_%s' % (self.side, 'neck', self.nc.effector))
curve = cmds.rename(ik[2], '%s_%s_%s' % (self.side, 'neck', self.nc.curve))
cmds.setAttr('%s.inheritsTransform' % curve, 0)
ik = cmds.rename(ik[0], '%s_%s_%s' % (self.side, 'neck', self.nc.ikhandle))
cmds.select(self.additional_jnts, curve)
cmds.skinCluster(tsb=True)
cmds.parent(ik, self.top_grp)
cmds.setAttr('%s.dTwistControlEnable' % ik, 1)
cmds.setAttr('%s.dWorldUpType' % ik, 4)
cmds.setAttr('%s.dWorldUpAxis' % ik, 4)
cmds.setAttr('%s.dWorldUpVectorY' % ik, -1)
cmds.setAttr('%s.dWorldUpVectorEndY' % ik, 1)
cmds.setAttr('%s.dWorldUpVectorEndZ' % ik, -1)
cmds.connectAttr('%s.worldMatrix[0]' % self.additional_jnts[0], '%s.dWorldUpMatrix' % ik, f=True)
cmds.connectAttr('%s.worldMatrix[0]' % self.additional_jnts[1], '%s.dWorldUpMatrixEnd' % ik, f=True)
self.head_grp = cmds.group(self.controls['head'])
self.head_grp = cmds.rename(self.head_grp, '%s_head_CTL_%s' % (self.side, self.nc.group))
cmds.parent(self.head_grp, self.top_grp)
self.c.move_pivot_to(self.guides['neckEnd'][0], self.guides['neckEnd'][1], self.guides['neckEnd'][2], self.head_grp)
cmds.parentConstraint(self.controls['head'], self.additional_jnts[-1], mo=True, weight=1)
cmds.orientConstraint(self.controls['head_rot'], self.result_jnts[-1], mo=True, weight=1)
开发者ID:jonntd,项目名称:Rigganator,代码行数:25,代码来源:dragonneck.py
示例5: fkFingerSetup
def fkFingerSetup(self):
"""
#- fk finger setup
"""
cmds.select(cl = True)
for fingerElement in self.allfingers:
for lr in self.lrPrefix:
for elem in fingerElement[0:-1]:
if lr == self.left:
ctlColor = 6
else:
ctlColor = 12
ctl = controller.circleController('%s%s_ctl' %(lr, elem), 'yz', 0.5, ctlColor, ['tr', 'sc', 'vi'], doublePadding = True)
cmds.select('%s%s_jnt' %(lr, elem), r = True)
cmds.select('%s_grp' %ctl, tgl = True)
cmds.pointConstraint(mo = False, weight = 1)
cmds.orientConstraint(mo = False, weight = 1)
cmds.delete('%s_grp_pointConstraint1' %ctl)
cmds.delete('%s_grp_orientConstraint1' %ctl)
#- constrain joints
cmds.select(ctl, r = True)
cmds.select('%s%s_jnt' %(lr, elem), tgl = True)
cmds.orientConstraint(mo = False, weight = 1)
fingerElementTmp = fingerElement[:-1]
fingerElementTmp.reverse()
for i in range(len(fingerElementTmp)-1):
self.util.parent('%s%s_ctl_grp' %(lr, fingerElementTmp[i]), '%s%s_ctl' %(lr, fingerElementTmp[i+1]))
开发者ID:darkuress,项目名称:arNew,代码行数:30,代码来源:handSetup.py
示例6: create_joints
def create_joints():
'''Subelements: vertecies, faces, edges should be selected'''
# Get selected object name
selection_list = cmds.ls(selection=True)
for selection in selection_list:
selected_object = selection.split('.')[0]
break
old_loc_list = cmds.ls('*LOC*', flatten=True)
#Create locators constrained to subelements
HZrivet.UI.HZrivet_finalCC()
current_loc_list = cmds.ls('*LOC*', flatten=True)
#Filter created locators
new_loc_list = [loc for loc in current_loc_list if loc not in old_loc_list]
# Get list of locators names and apply it as a prefix to a joint name
loc_list = [loc for loc in new_loc_list if 'Shape' not in loc]
root_joint = 'root'
if not cmds.objExists(root_joint):
cmds.select(clear=True)
cmds.joint(name=root_joint)
root_p_constraint = cmds.pointConstraint(selected_object, root_joint)
root_o_constraint = cmds.orientConstraint(selected_object, root_joint)
cmds.delete(root_p_constraint, root_o_constraint)
for loc in loc_list:
joint_prefix = re.sub("\D", "", loc)
joint_name = 'JNT_' + joint_prefix
cmds.select(clear=True)
cmds.joint(name=joint_name)
cmds.pointConstraint(loc, joint_name)
cmds.orientConstraint(loc, joint_name)
cmds.parent(joint_name, 'root')
开发者ID:AndreySibiryakov,项目名称:coding,代码行数:30,代码来源:create_joints.py
示例7: Neck_Control
def Neck_Control(*args, **kwargs):
NeckJt = "Neck_Jt"
NeckCtrl = [mc.curve(name="Neck_Ctrl",degree=3,point=[(-0.801407, 0, 0.00716748),(-0.802768, 0.023587, -0.220859), (-0.805489, 0.0707609, -0.676912),
(0.761595, -0.283043, -0.667253), (1.045492, -0.194522, -0.0218101), (1.046678, -0.194804, 0.0403576),(0.758039, -0.282198, 0.63974),
(-0.806291, 0.0676615, 0.650803),(-0.803035, 0.0225538, 0.221713),(-0.801407, 0, 0.00716748)]),
mc.setAttr("Neck_Ctrl.overrideColor",18),mc.setAttr("Neck_Ctrl.overrideEnabled",1)]
mc.scale(2.1,3.16,2.8)
mc.makeIdentity( 'Neck_Ctrl', apply=True, translate=True,scale=True)
lockScaling = mc.setAttr("Neck_Ctrl.scale",lock=True)
# xform translation
valNeck = mc.xform(NeckJt,ws=True,query=True,translation=True)
mc.xform(NeckCtrl,ws=1,t = (valNeck[0],valNeck[1],valNeck[2]))
mc.orientConstraint("Neck_Ctrl", NeckJt)
mc.pointConstraint("Neck_Ctrl", NeckJt)
grpNeck = mc.group("Neck_Ctrl", name="GRP_Neck")
mc.parent("GRP_Neck","Front_Spine_Ctrl")
#Lock translation for curve
lockTranslation = mc.setAttr("Neck_Ctrl.translate",lock=True)
return NeckCtrl,NeckJt
开发者ID:PaulElmo,项目名称:Quad_Rig_Tool,代码行数:25,代码来源:Q_RigWindow.py
示例8: Jaw_Control
def Jaw_Control(*args,**kwargs):
prefix = "_"
JawJt = "Lower_Jaw_Jt"
JawCtrl = [mc.curve(name="Jaw"+prefix+"Ctrl",d=1,
p=[(-0.484806, -0.465148, -0.560784 ),(-0.484806, -0.465148, 0.595512),
(-0.275612, 0.538987, 0.636341),(1.356108, 0.120597, 0.636341 ),
(2.161106, 0.0592024, 0.01008 ),(1.356108, 0.120597, -0.610974),
(-0.275612, 0.538987, -0.610974),(-0.484806, -0.465148, -0.560784),
(1.146913, -0.67078, -0.560784 ),(1.951911, -0.670601, 0.01008),
(1.146913, -0.67078, 0.595512),(1.356108, 0.120597, 0.636341),
(2.161106, 0.0592024, 0.01008),(1.356108, 0.120597, -0.610974),
(1.146913, -0.67078, -0.560784),(1.146913, -0.67078, 0.595512),
(-0.484806, -0.465148, 0.595512),(1.146913, -0.67078, 0.595512),
(1.951911, -0.670601, 0.01008),(2.161106, 0.0592024, 0.01008)]),
mc.setAttr("Jaw"+prefix+"Ctrl.overrideColor",18),
mc.setAttr("Jaw"+prefix+"Ctrl.overrideEnabled",1),mc.scale(0.5,1,1.15)]
#xform translation
valPos = mc.xform(JawJt,query=True,ws=True,translation=True)
mc.xform(JawCtrl[0],ws=1,t=(valPos[0],valPos[1],valPos[2]))
#xform rotation
valRot = mc.xform(JawJt,query=True,ws=True,rotation=True)
mc.xform(JawCtrl[0],ws=1,ro=(valRot[0],valRot[1],valRot[2]))
mc.setAttr("Jaw"+prefix+"Ctrl.rotateZ",-22)
mc.makeIdentity(JawCtrl[0],a=True,r=True,t=True,s=True)
mc.orientConstraint(JawCtrl[0], JawJt, mo=True)
mc.pointConstraint(JawCtrl[0], JawJt, mo=True)
mc.parent(JawCtrl[0],"Head_Ctrl")
#Lock attributes for Jaw rig
for lock in JawJt:
mc.setAttr("Jaw"+prefix+"Ctrl.scale",lock=True),
mc.setAttr("Jaw"+prefix+"Ctrl.translate",lock=True)
开发者ID:PaulElmo,项目名称:Quad_Rig_Tool,代码行数:33,代码来源:Q_RigWindow.py
示例9: _create_wrist
def _create_wrist(self):
"""Creates the special wrist setup for the 3 different rotation axes of
Dave's wrist.
@todo: change the constraining to the PLY GRP to something save
"""
hand = '%s_hand_result_%s' % (self.side, self.nc.joint)
hand_end = '%s_handEnd_result_%s' % (self.side, self.nc.joint)
fore_arm = '%s_foreArm_result_%s' % (self.side, self.nc.joint)
# joints
cmds.select(cl=True)
root_jnt = cmds.joint(n='%s_wristRoot_%s' % (self.side, self.nc.joint))
end_jnt = cmds.joint(n='%s_wristEnd_%s' % (self.side, self.nc.joint))
tmp_end_jnt = cmds.joint(n='%s_wristTmpEnd_%s' % (self.side, self.nc.joint))
self.c.snap_a_to_b(root_jnt, hand)
self.c.snap_a_to_b(end_jnt, hand_end)
self.c.snap_a_to_b(tmp_end_jnt, hand_end)
# orient joints properly
self.orient_joint(root_jnt)
cmds.delete(tmp_end_jnt)
cmds.parent(end_jnt, w=True)
# constrain joints
cmds.parentConstraint(hand, root_jnt, mo=True)
cmds.pointConstraint(root_jnt, end_jnt, mo=True)
cmds.orientConstraint(root_jnt, end_jnt, mo=True)
# constrain hand const group
cmds.parentConstraint('%s_wristRotZ_PLY_%s' % (self.side, self.nc.group),
'%s_hand_const_%s' % (self.side, self.nc.group), mo=True)
cmds.parent(root_jnt, end_jnt, '%s_hand_%s' % (self.side, self.nc.group))
开发者ID:jonntd,项目名称:Rigganator,代码行数:35,代码来源:robothand.py
示例10: rigExtrudePlane
def rigExtrudePlane() :
mc.select(cl = True)
lf_leg = ['lf_upLeg_nrJnt', 'L_leg_profileCrv']
rt_leg = ['rt_upLeg_nrJnt', 'R_leg_profileCrv']
lf_arm = ['lf_upArm_nrJnt', 'L_arm_profileCrv']
rt_arm = ['rt_upArm_nrJnt', 'R_arm_profileCrv']
set1 = [lf_leg, rt_leg, lf_arm, rt_arm]
for each in set1 :
# constraint nonRoll to profile curve
mc.orientConstraint(each[0], each[1], mo = True)
print each[0], each[1]
mc.select(cl = True)
naming1 = ['L_arm_pathCrv', 'L_arm_profileCrv', 'R_arm_pathCrv', 'R_arm_profileCrv']
naming2 = ['L_leg_pathCrv', 'L_leg_profileCrv', 'R_leg_pathCrv', 'R_leg_profileCrv']
mc.select(naming1, naming2)
mm.eval('tazGrp;')
mc.select(cl = True)
grp = ['L_armProfileCrv_zGrp', 'R_armProfileCrv_zGrp', 'L_legProfileCrv_zGrp', 'R_legProfileCrv_zGrp']
for each in grp :
mc.scaleConstraint('placement_ctrl', each)
# mc.select(cl = True)
# # bind skin
# mc.skinCluster('lf_upArm_jnt', 'lf_loArm_jnt', 'lf_wrist_jnt', 'L_arm_pathCrv', tsb = True)
# mc.skinCluster('lf_upArm_jnt', 'lf_loArm_jnt', 'lf_wrist_jnt', 'L_arm_pathCrv', tsb = True)
# mc.skinCluster('rt_upLeg_jnt', 'rt_loLeg_jnt', 'rt_ankle_jnt', 'R_leg_pathCrv', tsb = True)
# mc.skinCluster('rt_upArm_jnt', 'rt_loArm_jnt', 'rt_wrist_jnt', 'Larm_pathCrv', tsb = True)
# print 'Done'
开发者ID:myCodeTD,项目名称:rigTools,代码行数:35,代码来源:nonRoll.py
示例11: runWithRig
def runWithRig() :
# clear name
allObjs = mc.ls()
for each in allObjs :
if 'Char_' in each :
try :
newName = each.replace('Char_', '')
mc.rename(each, newName)
except :
pass
allCtrlJntGrp = 'allJnt_grp'
allIkGrp = 'allIK_grp'
leftLeg = ['cnt_pelvis_jnt', 'lf_upLeg_jnt', 'lf_loLeg_jnt']
rightLeg = ['cnt_pelvis_jnt', 'rt_upLeg_jnt', 'rt_loLeg_jnt']
leftArm = ['lf_clavicle1_jnt', 'lf_upArm_jnt', 'lf_loArm_jnt']
rightArm = ['rt_clavicle1_jnt', 'rt_upArm_jnt', 'rt_loArm_jnt']
setupNonRoll = [leftLeg, rightLeg, leftArm, rightArm]
for each in setupNonRoll :
mc.select(each[1], each[2])
jnt1, jnt2, ik, nrJntGrp, ikAllGrp = run()
mc.orientConstraint(each[0], jnt1)
mc.parent(nrJntGrp, allCtrlJntGrp)
mc.parent(ikAllGrp, allIkGrp)
print 'Add nonroll'
开发者ID:myCodeTD,项目名称:rigTools,代码行数:34,代码来源:nonRoll.py
示例12: connect_ikfk
def connect_ikfk(self):
for ik_jnt, fk_ctl_key in zip(self.ik.ik_joints, self.fk.controls.keys()):
ctl = self.fk.controls[fk_ctl_key]
cmds.orientConstraint(ik_jnt, ctl.grp, mo=True)
ik_joints = self.ik.ik_joints
fk_ctls = [self.fk.controls[k] for k in self.fk.controls.keys()]
print len(self.ik.ik_joints) - len(self.fk.fk_joints), len(ik_joints)
for index in range(len(self.ik.ik_joints) - len(self.fk.fk_joints), len(ik_joints)):
fk_ctl = self.fk.get_control(index)
for child_index in range(index + 1, len(ik_joints)):
fk_child_ctl = self.fk.get_control(child_index)
if fk_child_ctl:
cons = cmds.listConnections(fk_child_ctl.inb, type='plusMinusAverage', scn=True, s=True, d=False, p=False)
if not cons:
pma = cmds.createNode("plusMinusAverage", name=name.set_suffix(fk_child_ctl.name, "ctlOrient"))
cmds.connectAttr("%s.output3D" % pma, "%s.rotate" % fk_child_ctl.inb)
else:
pma = cons[0]
v = cmds.getAttr("%s.input3D" % pma, size=True)
cmds.connectAttr("%s.rotate" % fk_ctl.ctl, "%s.input3D[%s]" % (pma, index))
开发者ID:eddiehoyle,项目名称:link,代码行数:27,代码来源:spline.py
示例13: connectDeform
def connectDeform(ikRigNodes, fingerSetupNodes):
armNodes = ikRigNodes[0]
legNodes = ikRigNodes[1]
fkJoints = nameLib.skeletonNames.allJoints
fkJoints = list(itertools.chain(*fkJoints))
for i in fkJoints:
deformJoint = i.replace(nameLib.prefixNames.jointSuffix, nameLib.prefixNames.deformSuffix)
if "hip" in i:
mc.parentConstraint(i, deformJoint)
else:
mc.orientConstraint(i, deformJoint)
# connect root_DEFORM joit to placement
mc.parentConstraint(nameLib.prefixNames.globalControl + nameLib.prefixNames.controlSuffix, "root" + nameLib.prefixNames.deformSuffix)
# connect ikBlend for arms to constraints
leftArmIkBlend = armNodes[0][0]
rightArmIkBlend = armNodes[1][0]
connectIkBlend(leftArmIkBlend, rightArmIkBlend, armNodes, fingers=fingerSetupNodes)
# connect ikBlend for legs to constraints
leftLegIkBlend = legNodes[0][0]
rightLegIkBlend = legNodes[1][0]
connectIkBlend(leftLegIkBlend, rightLegIkBlend, legNodes, fingers=fingerSetupNodes)
开发者ID:robertvari,项目名称:rvRigTools,代码行数:30,代码来源:mapper.py
示例14: __init__
def __init__(self, joints, parentGroup, groupToConstraint):
# joints[0] = snapTo joint
# joints[1] = local parent
# parentGroup = where to parent spaceSwitch groups
# what group will be driven
rootGroup = makeGroup.MakeGroup(name=joints[0] + "_spaceSwitch_GRP")
worldGroup = makeGroup.MakeGroup(name=joints[0] + "_world", snapTo=joints[0])
localGroup = makeGroup.MakeGroup(name=joints[0] + "_local", snapTo=joints[0])
mc.parent(worldGroup.groupName, rootGroup.groupName)
mc.parent(localGroup.groupName, rootGroup.groupName)
mc.parent(rootGroup.groupName, parentGroup)
# constraint setup for groups
mc.parentConstraint(joints[1], localGroup.groupName, maintainOffset=True)
mc.pointConstraint(localGroup.groupName, worldGroup.groupName)
mc.orientConstraint(nameLib.prefixNames.globalControl + nameLib.prefixNames.controlSuffix, worldGroup.groupName, maintainOffset=True)
# sonctraint for groupToConstraint
for i in [worldGroup.groupName, localGroup.groupName]:
swConstraint = mc.parentConstraint(i, groupToConstraint)[0]
driver = joints[0] + ".parent"
reverseNode = mc.shadingNode("reverse", name = joints[0] + "_swReverse", asUtility=True)
# connect channels
mc.connectAttr(driver, reverseNode + ".input.inputX")
mc.connectAttr(driver, swConstraint + "." + joints[0] + "_worldW0")
mc.connectAttr(reverseNode + ".output.outputX", swConstraint + "." + joints[0] + "_localW1")
开发者ID:robertvari,项目名称:rvRigTools,代码行数:33,代码来源:spaceSwitch.py
示例15: setupIKCtrl
def setupIKCtrl(self, x, IKHandle):
############# MODIFY FOR INHERITANCE #############
side = self.prefixList[x]
thisChain = self.IKChains[x]
#create a control for the ik
name = "%s_%s_IK_CTRL"%(side, self.limbName)
if x==0:
IKCtrl = rig.createControl(name, "cube", self.jAxis1, "blue")
if x==1:
IKCtrl = rig.createControl(name, "cube", self.jAxis1, "red")
self.IKCtrls.append(IKCtrl)
#strip to rotate and translate
rig.stripToRotateTranslate(IKCtrl)
#G.O. control
rig.groupOrient(thisChain[2], IKCtrl, self.groupSuffix)
#orient constraint joint 2 (wrist ankle) to control
cmds.orientConstraint(IKCtrl, thisChain[2])
#parent ik handle to control
cmds.parent(IKHandle, IKCtrl)
return IKCtrl
开发者ID:zethwillie,项目名称:python_rigger,代码行数:26,代码来源:baseLimb.py
示例16: getParentConstraintDic
def getParentConstraintDic (self, parentConstraint) :
returnedDic = {'alias':{}, "object":None }
aliasDic={}
if cmds.objectType(parentConstraint)=="parentConstraint":
WA = cmds.parentConstraint (parentConstraint, q = True, weightAliasList = True)
TL = cmds.parentConstraint (parentConstraint, q = True, targetList = True)
elif cmds.objectType(parentConstraint)=="orientConstraint":
WA = cmds.orientConstraint (parentConstraint, q = True, weightAliasList = True)
TL = cmds.orientConstraint (parentConstraint, q = True, targetList = True)
elif cmds.objectType(parentConstraint)=="pointConstraint":
WA = cmds.pointConstraint (parentConstraint, q = True, weightAliasList = True)
TL = cmds.pointConstraint (parentConstraint, q = True, targetList = True)
else:
"error No constraint Type identified"
if len(WA) == len(TL):
for eachWAIndex in range(0,len(WA)):
aliasDic[WA[eachWAIndex]] = TL[eachWAIndex]
returnedDic["object"] = cmds.listConnections(parentConstraint + ".constraintRotateX")[0]
returnedDic["alias"] = aliasDic
return returnedDic
开发者ID:rendermotion,项目名称:RMMel,代码行数:25,代码来源:RMSpaceSwitch.py
示例17: RMRedistributeConstraint
def RMRedistributeConstraint(self,ListOfDrivers, ListOfConstrained, MaxInfluences, KeepBorders = True, ConstraintType = "parent"):
DeltaMaxInfluence = 1/(float (len(ListOfDrivers))-1)
CentersControlDic = {}
for i in range (0,len( ListOfDrivers)):
CentersControlDic[ListOfDrivers[i]] = ( DeltaMaxInfluence*i)
pprint.pprint (CentersControlDic)
DeltaPositionConstrained = float(1/(float(len(ListOfConstrained))-1))
PositionConstDic = {}
for i in range(0,len( ListOfConstrained)):
PositionConstDic[ListOfConstrained[i]] = (DeltaPositionConstrained*i)
pprint.pprint (PositionConstDic)
reach = MaxInfluences * DeltaMaxInfluence
for eachConstrained in ListOfConstrained:
for eachDriver in ListOfDrivers:
weight = self.RMGaussCosine( PositionConstDic [ eachConstrained ], CentersControlDic [ eachDriver ], reach )
if weight > 0:
if ConstraintType == "parent":
cmds.parentConstraint(eachDriver, eachConstrained , weight = weight,mo = True)
elif ConstraintType == "point":
cmds.pointConstraint(eachDriver, eachConstrained , weight = weight,mo = True)
elif ConstraintType == "orient":
cmds.orientConstraint(eachDriver, eachConstrained , weight = weight,mo = True)
else:
print "not valid costraintType requested, valid types are point, parent, or orient"
开发者ID:rendermotion,项目名称:RMMel,代码行数:30,代码来源:RMSpine.py
示例18: createDriverSkeleton
def createDriverSkeleton(self):
#there will always be a root bone, so let's duplicate that
dupe = cmds.duplicate("root", rc = True)[0]
cmds.select("root", hi = True)
joints = cmds.ls(sl = True)
cmds.select(dupe, hi = True)
dupeJoints = cmds.ls(sl = True)
driverJoints = []
for i in range(int(len(dupeJoints))):
if cmds.objExists(dupeJoints[i]):
driverJoint = cmds.rename(dupeJoints[i], "driver_" + joints[i])
driverJoints.append(driverJoint)
#create a direct connection between the driver and the export joints
for joint in driverJoints:
exportJoint = joint.partition("_")[2]
cmds.connectAttr(joint + ".translate", exportJoint + ".translate")
cmds.orientConstraint(joint, exportJoint)
cmds.connectAttr(joint + ".scale", exportJoint + ".scale")
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:25,代码来源:ART_Core.py
示例19: setCST
def setCST(self, constrainttype = 'parent', source = '', weight = 1, mo = True, remove = False, skip = "none"):
"""This can be used instead of the constraint class to constrain the current superObject to something quickly.
@param type: the type of constraint,valid options are point, parent, aim, scale, orient.
@param source: what you want to constrain to. single source only
@param weight: the weight of the constraint
@param mo: maintain offset
@param remove: remove from constraint
@type type: string
@type target: string
@type weight: int
@type mo: boolean
@type remove: boolean
"""
self.cstName = self.name + constrainttype + '_Constraint'
self.cstType = constrainttype
self.source = source
cstTypes = ['point', 'orient', 'aim', 'parent', 'scale']
if self.cstType not in cstTypes:
print 'Invalid constraint type called for superObject %s, try again' % self.name
elif self.cstType == 'point':
cmds.pointConstraint(self.source, self.name, weight = weight, mo = mo, rm = remove, n = self.cstName, skip = skip)
elif self.cstType == 'parent':
cmds.parentConstraint(self.source, self.name, weight = weight, mo = mo, rm = remove, n = self.cstName)
elif self.cstType == 'aim':
cmds.aimConstraint(self.source, self.name, weight = weight, mo = mo, rm = remove, n = self.cstName)
elif self.cstType == 'scale':
cmds.scaleConstraint(self.source, self.name, weight = weight, mo = mo, rm = remove, n = self.cstName)
elif self.cstType == 'orient':
cmds.orientConstraint(self.source, self.name, weight = weight, mo = mo, rm = remove, n = self.cstName)
开发者ID:jamesbdunlop,项目名称:defaultMayaLibrary,代码行数:29,代码来源:sceneObject.py
示例20: shadowRig
def shadowRig():
controls = [ "translateX", "translateY", "translateZ", \
"rotateX", "rotateY", "rotateZ", \
"scaleX", "scaleY", "scaleZ", "v" ]
negLightAttr = [ "decayRate", "emitSpecular", "useDepthMapShadows", \
"dmapResolution", "dmapFilterSize", "color", \
"shadowColor", "useRayTraceShadows", "lightRadius", \
"shadowRays"]
# Create group
shadowSpot = cmds.group(em=True, name='shadowSpot#')
# Grab index
index = None
if re.search('[0-9]+$', shadowSpot):
index = re.search('[0-9]+$', shadowSpot).group()[0]
# Save spotlight names
shadowLightName = ('shadowLight' + index)
shadowNegLightName = ('shadowNegLight' + index)
# Create spotlights
shadowLight = cmds.spotLight( name=shadowLightName )
shadowNegLight = cmds.spotLight( name=shadowNegLightName )
# Add spotlights to group
cmds.group( shadowLightName, shadowNegLightName, useAsGroup=shadowSpot )
# Create constraints
cmds.pointConstraint( shadowLightName, shadowNegLightName )
cmds.orientConstraint( shadowLightName, shadowNegLightName )
# Connect shape attributes
cmds.connectAttr( (shadowLight + '.coneAngle'), (shadowNegLight + '.coneAngle'), force=True )
cmds.connectAttr( (shadowLight + '.dropoff'), (shadowNegLight + '.dropoff'), force=True )
cmds.connectAttr( (shadowLight + '.penumbraAngle'), (shadowNegLight + '.penumbraAngle'), force=True )
# Create utility node
shadowSpotIntensity = cmds.shadingNode( 'multiplyDivide', asUtility=True, name=(shadowSpot + 'mdIntensity') )
cmds.connectAttr( (shadowLight + '.intensity'), (shadowSpotIntensity + '.input1X') )
cmds.setAttr ( (shadowSpotIntensity + '.input2X'), -1 )
cmds.connectAttr ( (shadowSpotIntensity + '.outputX'), (shadowNegLight + '.intensity') )
# Zero out shadow light attributes
cmds.setAttr ( (shadowNegLightName + ".useDepthMapShadows"), 0 )
cmds.setAttr ( (shadowNegLightName + ".useRayTraceShadows"), 0 )
# Lock attributes
for attr in negLightAttr:
cmds.setAttr ( (shadowNegLightName + "." + attr), lock=True, keyable=False )
# Lock and hide spotlight controls
for control in controls:
cmds.setAttr ( (shadowSpot + "." + control), lock=True, keyable=False )
cmds.setAttr ( (shadowNegLightName + "." + control), lock=True, keyable=False )
# Activate displayHandle
cmds.setAttr ( (shadowLightName + ".displayHandle"), 1 )
开发者ID:tmowyang,项目名称:maya-tools,代码行数:59,代码来源:shadowRig.py
注:本文中的maya.cmds.orientConstraint函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论