本文整理汇总了Python中maya.cmds.makeIdentity函数的典型用法代码示例。如果您正苦于以下问题:Python makeIdentity函数的具体用法?Python makeIdentity怎么用?Python makeIdentity使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了makeIdentity函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: createMasterCtrl
def createMasterCtrl(self, ctrl, offsetCtrl, curveShape, size, offsetScale):
cmds.file(PATH + curveShape + ".ma", i=True, rdn =True)
cmds.rename('control', ctrl)
cmds.file(PATH + "circle.ma", i=True, rdn =True)
cmds.rename('control', offsetCtrl)
cmds.xform(offsetCtrl, scale=[offsetScale, offsetScale, offsetScale ])
cmds.makeIdentity(offsetCtrl, apply=True, s=True)
cmds.parent(offsetCtrl, ctrl)
cmds.addAttr(ctrl, at='bool', ln="offsetCtrl", dv=1)
cmds.setAttr(ctrl + ".offsetCtrl", k=False, cb=True)
offsetCtrlShapes = cmds.listRelatives(offsetCtrl, shapes=True)
for offsetCtrlShape in offsetCtrlShapes:
cmds.connectAttr(ctrl+".offsetCtrl", offsetCtrlShape+".visibility")
cluster, clusterHandle = cmds.cluster(ctrl, name=ctrl+"_cluster")
cmds.setAttr(clusterHandle + '.visibility', 0)
cmds.setAttr(cluster + '.relative', 1)
cmds.parent(clusterHandle, ctrl)
cmds.addAttr(ctrl, at='double', ln="iconSize", minValue=0.1, dv=size, k=True)
cmds.setAttr(ctrl + ".iconSize", k=False, cb=True)
cmds.connectAttr(ctrl+".iconSize", clusterHandle+".scaleX")
cmds.connectAttr(ctrl+".iconSize", clusterHandle+".scaleY")
cmds.connectAttr(ctrl+".iconSize", clusterHandle+".scaleZ")
cmds.setAttr(ctrl+".offsetCtrl", 0)
开发者ID:adamfok,项目名称:afok_toolset,代码行数:30,代码来源:asset.py
示例2: create_base_rig
def create_base_rig(cog, rig_region_name):
# create curve and scale it to the correct size
base_curve, base_curve_group = jt_ctl_curve.create(None, 'star_30')
cmds.select(base_curve)
cmds.setAttr(base_curve + '.scale', 5,5,5)
cmds.makeIdentity(apply=True, t=0, r=1, s=1, n=0)
# unparent the curve from the default group it is given so its a child of the world
base_curve = cmds.rename('base')
cmds.parent(w=True)
cmds.select(base_curve_group, r=True)
cmds.delete()
# add a string attribute to keep track of all the nodes that are used for easy de-rigging
# NOTE: text is stored in the attr as a string formatted like a python dict with the key being
# the name of the body region and the value being a list of the nodes involved this makes
# de-rigging nice and easy as you just need to find the entry in the dict and delete all the nodes
cmds.select(base_curve)
cmds.addAttr(ln='rig_nodes', dt='string')
cmds.setAttr(base_curve + '.rig_nodes', '{}', type='string')
# add base_curve to base curve attr list
add_node_to_rig_nodes(base_curve, 'base', base_curve)
# update ui base_curve_field
cmds.textField('jt_autorig_base_name_select_text', e=True, tx=base_curve)
开发者ID:MaxIsJames,项目名称:jt_tools,代码行数:27,代码来源:jt_autorig.py
示例3: orientJoints
def orientJoints(s):
"""
Face joints in the correct direction.
"""
sel = cmds.ls(sl=True)
err = cmds.undoInfo(openChunk=True)
try:
markers = s.markers
joints = markers.keys()
with ReSeat(joints):
for j in joints:
m = markers[j]
if cmds.objExists(m.marker) and cmds.objExists(j):
with Isolate(j):
m.setJoint()
try:
cmds.makeIdentity(
j,
apply=True,
r=True) # Freeze Rotations
except RuntimeError:
pass
else: # User deleted marker / joint. Stop tracking.
m.removeMarker()
del markers[j]
cmds.select(sel, r=True)
except Exception as err:
raise
finally:
cmds.undoInfo(closeChunk=True)
if err: cmds.undo()
开发者ID:internetimagery,项目名称:twinSkeleton,代码行数:31,代码来源:fixorient.py
示例4: create_pointer
def create_pointer(m):
if (BAXER_POINTER == True):
# import Baxter Pointer model and use it
try:
cmds.loadPlugin("objExport")
except:
pass
name = os.path.dirname(os.path.realpath(__file__)) + "/models/baxter_gripper.obj"
mel.eval('file -import -type "OBJ" -ignoreVersion -ra true -mergeNamespacesOnClash false -rpr "gripper" -options "mo=1" -pr "%s";' \
% name)
try:
mel.eval('rename "gripper_Mesh" "pointer' + str(m) + '";')
except:
pass
else:
# Create a pointer mesh that represents the robot claw
cmds.polyCone(name="pointer" + str(m), sx=3, r=0.5, h=2)
cmds.select("pointer" + str(m))
cmds.rotate("180deg", 0, 0, r=True)
cmds.move(0, -1, 0, "pointer" + str(m) + ".scalePivot", "pointer" + str(m) + ".rotatePivot")
cmds.move(0, 1, 0, absolute=True)
cmds.makeIdentity(apply=True, t=1, r=1, s=1)
bbx = cmds.xform("table", q=True, bb=True, ws=True)
cur_size = abs(bbx[3] - bbx[0])
cmds.scale(cur_size/TABLE_SIZE, cur_size/TABLE_SIZE, cur_size/TABLE_SIZE, "pointer" + str(m), centerPivot = True)
mel.eval('select -r pointer' + str(m) + '; sets -e -forceElement pointer_matSG;')
mel.eval("makeCollideNCloth")
开发者ID:wenlongx,项目名称:Maya-Cloth-Simulation,代码行数:27,代码来源:main_backup.py
示例5: __init__
def __init__( self, fkik_snap_set ):
cmds.select( cl = True )
self.get_globals()
for obj in cmds.sets( fkik_snap_set, q = True ):
controller = DAG_Node( obj )
obj_snap_attr = '{0}.{1}'.format( controller.name(), self.snap_parent_str )
if cmds.objExists( obj_snap_attr ):
obj_snap = cmds.listConnections( obj_snap_attr )
if obj_snap:
obj_snap = obj_snap[0]
snap_grp = DAG_Node( cmds.group( n = '{0}_Snap_Grp'.format( obj.split( '|' )[-1] ), em = True ) )
snap_grp.set_parent( controller.parent() )
obj_tra = cmds.xform( controller.name(), ws = True, rp = True, q = True )
cmds.xform( snap_grp.name(), ws = True, t = obj_tra )
obj_rot = cmds.xform( controller.name(), ws = True, ro = True, q = True )
cmds.xform( snap_grp.name(), ws = True, ro = obj_rot )
cmds.makeIdentity( snap_grp.name(), a = True, t = True, r = True, s = True )
cmds.parentConstraint( obj_snap, snap_grp.name(), mo = True )
snap_grp_attr = Maya_Util().add_attr( snap_grp.name(), self.snap_parent_str, 'message' )
cmds.connectAttr( snap_grp_attr, obj_snap_attr, force = True )
cmds.select( cl = True )
开发者ID:StuTozer,项目名称:art_pipeline,代码行数:32,代码来源:fkik_snap_setup_tool.py
示例6: implicitSphere
def implicitSphere(name,group=False,size=1.0):
''' Creates a square shape.
If group is True, will group control and
return a list [group,control].
'''
#creating the curve
curve=cmds.createNode('implicitSphere')
curve=cmds.listRelatives(curve,parent=True)[0]
#setup curve
cmds.makeIdentity(curve,apply=True, t=1, r=1, s=1, n=0)
#naming control
node=cmds.rename(curve,name)
#sizing
cmds.scale(size,size,size,node)
cmds.FreezeTransformations(node)
#grouping control
if group==True:
grp=cmds.group(node,n=name+'_grp')
return [grp,node]
#return
return node
开发者ID:Bumpybox,项目名称:Tapp,代码行数:28,代码来源:utils.py
示例7: createIKCtrlsOnJnts
def createIKCtrlsOnJnts(ikCrv, parentCtrl, size=1):
ikCVNum = ll.getCurveCVCount(ikCrv)
prev=parentCtrl
for i in range(1, ikCVNum):
clus = mc.cluster('%s.cv[%d]'%(ikCrv, i), n=parentCtrl.replace('masterctrl','ikClus%d')%i)
cvPos = mc.xform('%s.cv[%d]'%(ikCrv, i), q=1, ws=1, t=1)
mc.select(parentCtrl)
meval('wireShape("plus")')
ikCtrl = mc.rename(masterCtrl.replace('masterctrl','ikCtrl%d'%i))
mc.xform(ikCtrl, t=cvPos, ws=1)
mc.scale(size, size, size, ikCtrl, ocp=1)
mc.makeIdentity(ikCtrl, a=1, s=1)
mc.parent(ikCtrl, parentCtrl)
lsZeroOut(ikCtrl)
ctrlPR = lsZeroOut(ikCtrl, 'PR')
mc.addAttr(ikCtrl, ln='SPACE', at='bool', k=1)
mc.setAttr(ikCtrl+'.SPACE', l=1)
mc.addAttr(ikCtrl, ln='parent', at='float', dv=0, min=0, max=1, k=1)
mc.addAttr(ikCtrl, ln='master', at='float', dv=1, min=0, max=1, k=1)
mc.addAttr(ikCtrl, ln='world', at='float', dv=0, min=0, max=1, k=1)
mc.parentConstraint(ikCtrl, clus)
cons = mc.parentConstraint(prev, parentCtrl, ctrlPR, mo=1)[0]
wal = mc.parentConstraint(cons, q=1, wal=1)
if len(wal) > 1:
mc.connectAttr(ikCtrl+'.parent', '%s.%s'%(cons, wal[0]), f=1)
mc.connectAttr(ikCtrl+'.master', '%s.%s'%(cons, wal[1]), f=1)
prev=ikCtrl
开发者ID:sayehaye3d,项目名称:ls-rigging-tools,代码行数:27,代码来源:hair.py
示例8: ori_ctrl_joint_get_ori
def ori_ctrl_joint_get_ori(self,joint,clean_parent):
new_clean_parent = cmds.duplicate(joint, parentOnly=True)[0]
if not clean_parent in cmds.listRelatives(new_clean_parent, parent=True):
cmds.parent(new_clean_parent, clean_parent, absolute=True)
cmds.makeIdentity(
new_clean_parent,
apply=True,
rotate=True,
scale=False,
translate=False
)
ori_ctrl = self.get_ori_ctrl(joint)
cmds.setAttr(new_clean_parent+".rotateX", cmds.getAttr(ori_ctrl+".rotateX"))
cmds.makeIdentity(
new_clean_parent,
apply=True,
rotate=True,
scale=False,
translate=False
)
orient_x = cmds.getAttr(new_clean_parent+".jointOrientX")
orient_y = cmds.getAttr(new_clean_parent+".jointOrientY")
orient_z = cmds.getAttr(new_clean_parent+".jointOrientZ")
ori_values = (orient_x, orient_y, orient_z)
return (ori_values, new_clean_parent)
开发者ID:firstPeterParker,项目名称:mlRig,代码行数:33,代码来源:blueprint.py
示例9: makeFlake
def makeFlake(branches,radius):
'''
Creates a single snowflake
branches : number of side branches
radius : radius of the snowflake
A cube is created and transformed to taper with a diamond cross-section.
It is passed to flakeIterate to generate 1/6 of the snowflake. This branch
is duplicated and rotated around the centre to create the full snowflake.
The parts are combined, the flake is scaled and transformations are frozen.
The snowflake name is returned.
'''
name=cmds.polyCube()[0]
cmds.rotate(45,0,0,name,r=1)
cmds.move(0.5,0,0,name+'.vtx[0:7]',r=1)
cmds.scale(0.7,0.2,0.1,p=[0,0,0],r=1)
cmds.scale(1,0.7,0.7,name+'.f[4]',r=1,p=[0,0,0])
cmds.makeIdentity(apply=True, t=1, r=1, s=1, n=0)
partList=flakeIterate(name,7,random.uniform(30,70),0.7)
branches=[combineParts(partList,'branch')]
for i in range(1,6):
branches[len(branches):]=[cmds.duplicate('branch')[0]]
cmds.rotate(0,i*60,0,branches[-1],r=1)
flake = combineParts(branches,'snowflake')
scale = radius/6
cmds.scale(scale,scale,scale,flake)
cmds.makeIdentity(flake,apply=True, s=1, n=0)
return flake
开发者ID:philrouse,项目名称:snowFX,代码行数:29,代码来源:makeSnowflakes.py
示例10: cleanup
def cleanup(transform):
# Select the transform
cmds.select(transform, replace=True)
# Scale 1/10x
cmds.scale(centerPivot=True, scaleXYZ=1/10)
# Freeze transformations
cmds.makeIdentity(apply=True, translate=True, rotate=True, scale=True, normal=1)
开发者ID:jimfleming,项目名称:maya-scripts,代码行数:7,代码来源:surgeon.py
示例11: circleH
def circleH(name, position, size=1):
j=cmds.circle(c=[0,0,0], nr=[0,1,0], sw=360, r=size, d=3, ut=0, tol=0.01, s=8, ch=1, n=name)
i=cmds.pointConstraint(position, j)
# deletes constraint nad freezes transforms
cmds.delete(i)
cmds.makeIdentity(apply=True, t=1, r=1, s=1, n=1)
return j
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:7,代码来源:fsaIconModule.py
示例12: primeControl
def primeControl(driver, driven):
'''
# Priming a control
Return driver, grp, driven
'''
# Group needs to be created
# Name group after control icon that is going to be created.
grpNamePieces = driven.split("_")
if( len(grpNamePieces) > 1 ):
grpNamePieces = grpNamePieces[0:-1]
grpNamePieces.append("grp")
grpName = "_".join(grpNamePieces)
grp = cmds.group( name=grpName, em=True, world=True )
pc = cmds.pointConstraint( driver, grp )
oc = cmds.orientConstraint( driver, grp )
cmds.delete(pc, oc)
# Option to snap control to position.
pc = cmds.pointConstraint( driver, driven )
cmds.delete( pc )
cmds.parent( driven, grp )
cmds.makeIdentity( apply=True, t=1, r=1, s=1, n=0 )
# Position option to constrain driver to driven
# Options: Point, Orient, Parent, and None
return [driver, grp, driven]
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:29,代码来源:rigTools.py
示例13: setAndFreeze
def setAndFreeze(nodeName="", tx=None, ty=None, tz=None, rx=None, ry=None, rz=None, sx=None, sy=None, sz=None, freeze=True):
"""This function set attribute values and do a freezeTransfomation.
"""
if nodeName != "":
attrNameList = ['tx', 'ty', 'tz', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz']
attrValueList = [tx, ty, tz, rx, ry, rz, sx, sy, sz]
# setting attribute values:
for v, attrValue in enumerate(attrValueList):
if attrValue:
try:
cmds.setAttr(nodeName+'.'+attrNameList[v], attrValue)
except:
pass
# looking the need of freeze:
if freeze:
freezeT = False
freezeR = False
freezeS = False
if tx != None or ty != None or tz != None:
freezeT = True
if rx != None or ry != None or rz != None:
freezeR = True
if sx != None or sy != None or sz != None:
freezeS = True
try:
cmds.makeIdentity(nodeName, apply=freeze, translate=freezeT, rotate=freezeR, scale=freezeS)
except:
pass
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:28,代码来源:dpControls.py
示例14: quickOrient
def quickOrient( aimVec=[0,1,0] , upVec=[-1,0,0] ) :
sels = mc.ls( sl=True )
targ = sels[0]
src = sels[1]
chldrn = mc.listRelatives( src , s=False , c=True , p=False )
if chldrn :
for chld in chldrn :
mc.parent( chld , w=True )
mc.select( src , r=True )
tmpUp = mc.duplicate( src , rr=True )[0]
tmpUpChldrn = mc.listRelatives( tmpUp , f=True )
if tmpUpChldrn :
mc.delete( tmpUpChldrn )
aim = aimVec
wu = upVec
u = upVec
wuo = tmpUp
wut = 'objectrotation'
aimCon = mc.aimConstraint( targ , src , aim=aim , wu=wu , wuo=wuo , wut=wut , u=u )
mc.delete( aimCon )
mc.delete( tmpUp )
mc.makeIdentity( src , a=True , r=True , t=True , s=True , jo=False )
if chldrn :
for chld in chldrn :
mc.parent( chld , src )
mc.select( src , r=True )
开发者ID:myCodeTD,项目名称:pkmel,代码行数:35,代码来源:rigTools.py
示例15: template_joints
def template_joints(joints=None, reorient_children=True, reset_orientation=True):
if joints is None:
joints = cmds.ls(sl=True, type='joint')
if not joints:
raise RuntimeError('No joint selected to orient.')
if reorient_children:
children = cmds.listRelatives(fullPath=True, allDescendents=True, type='joint')
joints.extend(children)
red, green, blue = create_shaders()
orient_group = cmds.createNode('transform', name=ORIENT_GROUP)
manips = []
for joint in joints:
if reset_orientation:
cmds.makeIdentity(joint, apply=True)
cmds.joint(joint, edit=True, orientJoint='xyz', secondaryAxisOrient='yup', children=False, zeroScaleOrient=True)
if not cmds.listRelatives(joint, children=True):
zero_orient([joint])
continue
group, manip = create_orient_manipulator(joint, blue)
manips.append(manip)
cmds.parent(group, orient_group)
cmds.parentConstraint(joint, group)
cmds.setAttr(joint + '.template', 1)
cmds.select(manips)
开发者ID:SplineO,项目名称:cmt,代码行数:27,代码来源:orientjoints.py
示例16: freezeToJoint
def freezeToJoint(proxyGeo):
'''
Freeze the transforms of a proxy geometry to the target joint defined by the string value of its "jointProxy" attribute.
@param proxyGeo: Proxy geometry to freeze transforms based on an associated joint.
@type proxyMesh: str
'''
# Checks
if not isProxyBound(proxyGeo):
raise Exception('Object "'+proxyGeo+'" is not a valid proxy bounds object!')
# Get Target Joint
joint = mc.getAttr(proxyGeo+'.jointProxy')
# Get Proxy Parent
proxyGrp = mc.listRelatives(proxyGeo,p=True,pa=True)[0]
# Match Joint Pivot
piv = mc.xform(joint,q=True,ws=True,rp=True)
mc.xform(proxyGrp,ws=True,piv=piv)
mc.xform(proxyGeo,ws=True,piv=piv)
# Freeze Transforms
grpParent = mc.listRelatives(proxyGrp,p=True,pa=True)
mc.parent(proxyGrp,joint)
mc.makeIdentity(proxyGrp,apply=True,t=True,r=True,s=True)
if grpParent: mc.parent(proxyGrp,grpParent[0])
else: mc.parent(proxyGrp,w=True)
# Return Result
return joint
开发者ID:auqeyjf,项目名称:glTools,代码行数:29,代码来源:proxyMesh.py
示例17: Circle
def Circle(name='circle_cnt',group=False,size=1.0):
''' Creates a circle shape.
If group is True, will group control and
return a list [group,control].
'''
#creating the curve
curve=cmds.circle(radius=1,constructionHistory=False)
#transform to standard
cmds.rotate(0,90,0,curve)
cmds.makeIdentity(curve,apply=True, t=1, r=1, s=1, n=0)
#naming control
node=cmds.rename(curve,name)
#sizing
cmds.scale(size,size,size,node)
cmds.FreezeTransformations(node)
#grouping control
if group==True:
grp=cmds.group(node,n=name+'_grp')
return [grp,node]
#return
return node
开发者ID:Bumpybox,项目名称:Tapp,代码行数:29,代码来源:utils.py
示例18:
def __init__ (self, pos):
self.cone = cmds.polyCone (axis = (0,-1,0),
subdivisionsX = 16, constructionHistory = False)
cmds.xform (self.cone, worldSpace = True, absolute = True, translation = (0,1,0))
cmds.xform (self.cone, pivots =(0,-1,0))
cmds.makeIdentity (apply = True, translate = True)
cmds.xform (self.cone, worldSpace = True, absolute = True, translation = pos)
开发者ID:danielforgacs,项目名称:code-dump,代码行数:7,代码来源:ford_matchMoveUtils.py
示例19: Square
def Square(name='square_cnt',group=False,size=1.0):
''' Creates a square shape.
If group is True, will group control and
return a list [group,control].
'''
#creating the curve
curve=cmds.curve(d=1, p=[(0,1,1),(0,1,-1),(0,-1,-1),
(0,-1,1),(0,1,1)])
#setup curve
cmds.makeIdentity(curve,apply=True, t=1, r=1, s=1, n=0)
#naming control
node=cmds.rename(curve,name)
#sizing
cmds.scale(size,size,size,node)
cmds.FreezeTransformations(node)
#grouping control
if group==True:
grp=cmds.group(node,n=name+'_grp')
return [grp,node]
#return
return node
开发者ID:Bumpybox,项目名称:Tapp,代码行数:28,代码来源:utils.py
示例20: duplicate_button
def duplicate_button( self, *args ):
self.original_selected_objects = cmds.ls( selection=True )
if( len(self.original_selected_objects) == 0 ):
print "Nothing selected"
return 0
elif( len(self.original_selected_objects) == 1 ):
self.relatives = cmds.listRelatives( children=True )
if( len(self.relatives) == 1 ):
print "Skip combine"
cmds.duplicate( self.original_selected_objects, name=self.original_selected_objects[0] + "_Copy" )
cmds.delete( constructionHistory=True )
the_parent = cmds.listRelatives( parent=True )
if( the_parent != None ):
cmds.parent( self.original_selected_objects[0] + "_Copy", world=True )
else:
self.combine()
else:
self.combine()
self.newOriginCopy = cmds.ls( selection=True )[0]
self.bbox = cmds.exactWorldBoundingBox( self.newOriginCopy )
cmds.move((self.bbox[0] + self.bbox[3])/2, self.bbox[1], (self.bbox[2] + self.bbox[5])/2, self.newOriginCopy + ".scalePivot", self.newOriginCopy + ".rotatePivot", absolute=True)
cmds.move( 0, 0, 0, self.newOriginCopy, rpr=True )
cmds.makeIdentity( apply=True, t=1, r=1, s=1 )
cmds.delete( constructionHistory=True )
开发者ID:cwilmot,项目名称:maya-bulge-deformer-tool,代码行数:30,代码来源:MayaBulgeTool.py
注:本文中的maya.cmds.makeIdentity函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论