• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python cmds.getAttr函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中maya.cmds.getAttr函数的典型用法代码示例。如果您正苦于以下问题:Python getAttr函数的具体用法?Python getAttr怎么用?Python getAttr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了getAttr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: setRotate_keepJointOrient

def setRotate_keepJointOrient( mtx, jnt ):
    jntP = cmds.listRelatives( jnt, p=1 )[0]
    joValue = cmds.getAttr( jnt+'.jo' )[0]
    joMEuler = om.MEulerRotation( math.radians( joValue[0] ), math.radians( joValue[1] ), math.radians( joValue[2] ) )
    joTransform = mpx.MPxTransformationMatrix( om.MMatrix() )
    joTransform.rotateBy( joMEuler )
    jo_im = joTransform.asMatrixInverse()
        
    jntP_wim_list = cmds.getAttr( jntP+'.wim' )
    jntP_wim = om.MMatrix()
    om.MScriptUtil.createMatrixFromList( jntP_wim_list, jntP_wim )
        
    cuMtx = mtx*jntP_wim*jo_im
        
    transform = mpx.MPxTransformationMatrix( cuMtx )
    rot = transform.eulerRotation().asVector()
    
    degrees = [math.degrees( rot.x ), math.degrees( rot.y ), math.degrees( rot.z )]
    
    for i in range( len( degrees ) ):
        if degrees[i] > 180:
            degrees[i] = degrees[i]-360
        elif degrees[i] < -180:
            degrees[i] = degrees[i]+360
    cmds.setAttr( jnt+'.r', *degrees )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:25,代码来源:basicfunc.py


示例2: reset

    def reset(self, ctrl, key=0, keyPreviousFrame=0):
        """
        Reset spaces constraint offsets for the specified control
        @param ctrl: Control whose spaces target offset values will be rest
        @type ctrl: str
        @param key: Set keyframe after reset
        @type key: bool
        @param keyPreviousFrame: Set keyframe before reset. Only relevant when "key" is also True.
        @type keyPreviousFrame: bool
        """
        # Get spaces info
        spacesNode = self.getSpacesNode(ctrl)
        spacesNodeConstraint = self.getSpacesConstraint(ctrl)

        # Check spaces attribute
        if not cmds.objExists(spacesNode + '.spaces'):
            raise UserInputError('Object ' + spacesNode + 'does not contain a ".spaces" attribute!')
        targetIndex = cmds.getAttr(spacesNode + '.spaces')
        target = self.targetList(ctrl)[targetIndex]

        # Key previous frame
        if keyPreviousFrame: self.key(ctrl, [], cmds.currentTime(q=True) - 1, )

        # Reset Offset Values
        translateOffset = cmds.getAttr(spacesNode + '.defaultOffset[' + str(targetIndex) + '].dot')[0]
        rotateOffset = cmds.getAttr(spacesNode + '.defaultOffset[' + str(targetIndex) + '].dor')[0]
        cmds.setAttr(spacesNode + '.tot', translateOffset[0], translateOffset[1], translateOffset[2])
        cmds.setAttr(spacesNode + '.tor', rotateOffset[0], rotateOffset[1], rotateOffset[2])

        # Key current frame
        if key: self.key(ctrl)
开发者ID:bennymuller,项目名称:glTools,代码行数:31,代码来源:spaces.py


示例3: removeFloatVariable

 def removeFloatVariable(self, nodeAttr, varslayout, index):
    # Remove variable
    children = cmds.columnLayout(varslayout, query=1, childArray=1)
    
    if len(children) <= index:
       return
    
    baseNameAttr = nodeAttr
    baseValueAttr = nodeAttr.replace("fparam_name", "fparam_value");
    
    for i in xrange(index+1, len(children)):
       rembtn, namefld, _, valfld = cmds.formLayout(children[i], query=1, childArray=1)
       
       indexStr = "[%d]" % (i - 1)
       nextIndexStr = "[%d]" % i
       
       nameAttr = baseNameAttr + indexStr
       valueAttr = baseValueAttr + indexStr
       
       cmds.setAttr(nameAttr, cmds.getAttr(baseNameAttr + nextIndexStr), type="string")
       cmds.setAttr(valueAttr, cmds.getAttr(baseValueAttr + nextIndexStr));
       
       self.setupVariableNameCallback(nameAttr, namefld)
       self.setupFloatVariableValueCallback(valueAttr, valfld)
       cmds.button(rembtn, edit=1, command=lambda *args: self.removeFloatVariable(nodeAttr, varslayout, i-1))
    
    cmds.deleteUI(children[index])
    
    cmds.removeMultiInstance("%s[%d]" % (baseNameAttr, len(children)-1), b=True)
    cmds.removeMultiInstance("%s[%d]" % (baseValueAttr, len(children)-1), b=True)
开发者ID:mousekoz,项目名称:SeExprArnold,代码行数:30,代码来源:aiSeexprTemplate.py


示例4: maya_move

def maya_move(angular_velocity, time_step):
            
    objects = cmds.ls(sl=True)
    if objects == []:
        print('* Please select at least an object.')
        return
        
    trajectory = cmds.ls('trajectory')
    
    for i, o in enumerate(objects):
        x = cmds.getAttr(o + '.translateX')
        y = cmds.getAttr(o + '.translateY')
        z = cmds.getAttr(o + '.translateZ')
    
        loc = [x, y, z]
        state = make_state(loc)
                
        state = simulate_circle(state, angular_velocity, time_step)
        
        old_loc = loc
        loc = get_location(state)
        
        cmds.select(o)
        cmds.move(loc[0], loc[1], loc[2])
        
        # draw trajectory for the first object
        if i == 0:
            if trajectory == []:
                cv = cmds.curve(point=[old_loc, loc], degree=1)                
                cmds.rename(cv, 'trajectory')
            else:
                cmds.curve('trajectory', point=[loc], degree=1, append=True)
        
    # keep all objects selected
    cmds.select(objects)
开发者ID:HerrR,项目名称:CS3242-3D-Modeling-and-Animation,代码行数:35,代码来源:circle_empty.py


示例5: apply

	def apply( self, mapping, **kwargs ):
		'''
		construct a mel string to pass to eval - so it can be contained in a single undo...
		'''
		cmdQueue = api.CmdQueue()

		#gather options...
		additive = kwargs.get( self.kOPT_ADDITIVE,
							   self.kOPT_DEFAULTS[ self.kOPT_ADDITIVE ] )

		for clipObj, tgtObj in mapping.iteritems():
			try:
				attrDict = self[ clipObj ]
			except KeyError: continue

			for attr, value in attrDict.iteritems():
				attrpath = '%s.%s' % (tgtObj, attr)
				try:
					if not cmd.getAttr( attrpath, settable=True ): continue
				except TypeError: continue

				if additive: value += cmd.getAttr( attrpath )
				cmdQueue.append( 'setAttr -clamp %s %s;' % (attrpath, value) )

		cmdQueue()
开发者ID:BGCX261,项目名称:zootoolbox-svn-to-git,代码行数:25,代码来源:animLib.py


示例6: __init__

 def __init__(self, name):
     Obj.__init__(self, name)
     self.resx = mc.getAttr('defaultResolution.width')
     self.resy = mc.getAttr('defaultResolution.height')
     self.aperture = mc.getAttr("%s.hfa" % self.name) * 25.4
     self.interaxial = mc.getAttr('%s.isep' % self.name)
     self.ZPS = mc.getAttr('%s.zp' % self.name)
开发者ID:akoon,项目名称:OldPipeline,代码行数:7,代码来源:masset_bac.py


示例7: get_num_cvs

    def get_num_cvs(self, curve):
        '''
        Desc:
        Get cvs lenght from a curve

        Parameter:
        curve = curve to get cvs positin list from
        coords_space = the coordinat space, can be "world" (default), or "local"

        Return:
        list with positions
        '''

        # If curve is nod define or not correct release error
        if curve:
            # Get curve shape
            curve_shape = KstMaya.get_shape_node(curve)

            # Get degree
            degree = cmds.getAttr(curve_shape+".degree")

            # Get spans
            spans = cmds.getAttr(curve_shape+".spans")

            # Calulating ncvs with formula spans+degree
            ncvs = spans+degree

            # Return the list
            return ncvs
        else:
            cmds.warning("Curve %s,  is not defined, or is not a curve, double check!" % curve)
            return None
开发者ID:Leopardob,项目名称:Kistie,代码行数:32,代码来源:KstMaya.py


示例8: getComponent

def getComponent(textureNode, component='color'):

    if not 'dead_space' in cmds.getAttr(textureNode+'.fileTextureName'):
        cmds.warning('Cannot create component beacause this is not a  DS texture.')

    if not component in ('color', 'normal', 'specular'):
        cmds.warning("Please put one of the following component: 'color', 'normal', 'specular'")

    texturePath = cmds.getAttr(textureNode+'.fileTextureName')
    textureComponent = os.path.dirname(texturePath).split('/')[-1]

    if textureComponent == component:
        cmds.warning('You are trying to get the same component as the texture selected.')

    componentPath = os.path.dirname(texturePath).replace(textureComponent, component)
    if os.path.exists(componentPath):
        originalComp = COMPS[textureComponent]
        replaceComp = COMPS[component]
    else:
        cmds.warning('Cannot find component path.')
    componentTexturePath = componentPath+'/'+os.path.basename(texturePath).replace(originalComp, replaceComp)
    if os.path.isfile(componentTexturePath):
        return componentTexturePath
    else:
        #cmds.warning('Cannot find component texture file.')
        return None
开发者ID:jonntd,项目名称:dmptools,代码行数:26,代码来源:shading.py


示例9: returnClosestUV

def returnClosestUV (targetObject,surface):
    """
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    DESCRIPTION:
    Pass target object and surface into it and return the closest UV coordinates

    ARGUMENTS:
    targetObject(string)
    surface(string)

    RETURNS:
    UV(string)
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    """
    """ pass target object and surface into it and return the closest UV coordinates"""
    UVs = []
    """ make the node """
    tmpNode = mc.createNode ('closestPointOnSurface')
    """ to account for target objects in heirarchies """
    tmpObj = rigging.locMeObjectStandAlone(targetObject)
    mc.connectAttr ((tmpObj+'.translate'),(tmpNode+'.inPosition'))
    mc.connectAttr ((surface+'.worldSpace'),(tmpNode+'.inputSurface'))
    UVs.append (mc.getAttr (tmpNode+'.u'))
    UVs.append (mc.getAttr (tmpNode+'.v'))
    mc.delete (tmpNode)
    mc.delete (tmpObj)
    return UVs
开发者ID:GuidoPollini,项目名称:MuTools,代码行数:27,代码来源:distance.py


示例10: grow

	def grow(self):
		scaleX = cmds.getAttr("%s.scaleX"%self.sphere)
		scaleZ = cmds.getAttr("%s.scaleZ"%self.sphere)
		newScaleX = scaleX * 1.5
		newScaleZ = scaleZ * 1.5
		cmds.setAttr("%s.scaleX"%self.sphere, newScaleX)
		cmds.setAttr("%s.scaleZ"%self.sphere, newScaleZ)
开发者ID:zethwillie,项目名称:zbw_python_tools,代码行数:7,代码来源:classStuff.py


示例11: CentreUVs

def CentreUVs():
	objSel = cmds.ls(sl=True)
	
	try:
		for item, x in enumerate(objSel):
			cmds.select('%s.map[*]' %objSel[item])
			mm.eval("PolySelectConvert 4;")
			mm.eval('TranslateToolWithSnapMarkingMenu')
			objPiv = cmds.getAttr('%s.uvPivot' %objSel[0])
			mm.eval('MarkingMenuPopDown')
			objCenterU = 0.5 - objPiv[0][0]
			objCenterV = 0.5 - objPiv[0][1]
			cmds.polyEditUV(u=objCenterU, v=objCenterV, r=1)
			cmds.select(objSel)
	except ValueError:
	
		objQuery = cmds.listRelatives(objSel[0], ap=True)
		cmds.select('%s.map[*]' %objQuery[0])
		mm.eval("PolySelectConvert 4;")
		mm.eval('TranslateToolWithSnapMarkingMenu')
		objPiv = cmds.getAttr('%s.uvPivot' %objQuery[0])
		mm.eval('MarkingMenuPopDown')
		objCenterU = 0.5 - objPiv[0][0]
		objCenterV = 0.5 - objPiv[0][1]
		cmds.polyEditUV(u=objCenterU, v=objCenterV, r=1)
		cmds.select(objQuery)
开发者ID:kml27,项目名称:ExperimentalCapture,代码行数:26,代码来源:svAutoPipe.py


示例12: check_transforms

def check_transforms(objects):
    '''
    Check joints to insure they have no rotation values.
    '''
    
    invalid = []
    cmds.select(objects)
    new_objects = cmds.pickWalk(d='up')
    t_r_xform = ['t', 'r']
    scale_xform = 's'
    axis = ['x', 'y', 'z']
    

    for obj in new_objects:
        #check translates rotates and scales
        for trans in t_r_xform:
            #check each axis
            for ax in axis:
                trans_rot = cmds.getAttr('%s.%s%s' % (obj, trans, ax))
                
                if trans_rot != 0:
                    invalid.append(obj)
                    break
                
            for ax in axis:
                scale = cmds.getAttr('%s.%s%s' % (obj, scale_xform, ax))
                
                if scale != 1:
                    invalid.append(obj)
                    break
          
    return invalid
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:32,代码来源:threeDF_rig_check_v011.py


示例13: deformCharacterShapeSel

 def deformCharacterShapeSel(self, value):
     RN = mc.referenceQuery(self.core.skCharacter[int(value)-1], referenceNode=1)
     Nodes = mc.referenceQuery(RN, nodes=1)
     self.characterdeformShape = []
     self.allCharacterRightdeformShape = []
     for item in Nodes:
         if self.nodeTypeSelf(item) in self.shapeType:
             self.characterdeformShape.append(item)
     for each in self.characterdeformShape:
         itemP = mc.listRelatives(each, p=1)[0]
         itemPP = mc.listRelatives(itemP, p=1)
         if itemPP != None and mc.getAttr('%s.v'%itemP) != 0 and mc.getAttr('%s.v'%itemPP[0]) != 0:
             self.allCharacterRightdeformShape.append(each)
             self.allCharacterRightdeformShape.reverse()
     for item in self.allCharacterRightdeformShape:
         if mc.filterExpand( item, sm=(10,12)) == None:
             self.allCharacterRightdeformShape.remove(item)
     for item in self.allCharacterRightdeformShape:
         if item.endswith('Orig') == True:
             self.allCharacterRightdeformShape.remove(item)
     for item in self.allCharacterRightdeformShape:
         if item.endswith('Orig') == True:
             self.allCharacterRightdeformShape.remove(item)
     for item in self.allCharacterRightdeformShape:
         if item.endswith('Orig') == True:
             self.allCharacterRightdeformShape.remove(item)
     for item in self.allCharacterRightdeformShape:
         if item.endswith('Orig') == True:
             self.allCharacterRightdeformShape.remove(item)
     for item in self.allCharacterRightdeformShape:
         if item.endswith('Orig') == True:
             self.allCharacterRightdeformShape.remove(item)
     return self.allCharacterRightdeformShape
开发者ID:chuckbruno,项目名称:Python_scripts,代码行数:33,代码来源:mulitBatchExportCache_08.py


示例14: writeSetAttrCmd

def writeSetAttrCmd( trigger, connectIdxs=None ):
	cmdToks = []
	assert isinstance( trigger, Trigger )

	if connectIdxs is None:
		connectIdxs = [ idx for _,idx in trigger.connects() ]

	#make sure the zeroth connect isn't in the list and remove duplicates
	connectIdxs = removeDupes( connectIdxs )
	if 0 in connectIdxs:
		connectIdxs.remove( 0 )

	for connectIdx in connectIdxs:
		obj = trigger[connectIdx]
		attrs = cmd.listAttr( obj, k=True, s=True, v=True, m=True ) or []
		objTrigger = Trigger( obj )
		for a in attrs:
			attrPath = '%s.%s' % (obj, a)
			attrType = cmd.getAttr( attrPath, type=True )
			attrValue = cmd.getAttr( attrPath )
			if attrType.startswith( 'double' ):
				cmdToks.append( "setAttr %%%d.%s %0.5f;" % (connectIdx, a, attrValue) )
			else:
				cmdToks.append( "setAttr %%%d.%s %d;" % (connectIdx, a, attrValue) )

	return '\n'.join( cmdToks )
开发者ID:GuidoPollini,项目名称:MuTools,代码行数:26,代码来源:triggeredUI.py


示例15: goToObject

    def goToObject(self, first, second, *args ):
        
        if cmds.nodeType( first ) == 'joint':
            
            jo = cmds.getAttr( first+'.jo' )[0]
            mpxTransform = mpx.MPxTransformationMatrix()
            rotVector = om.MVector( math.radians( jo[0] ), math.radians( jo[1] ), math.radians( jo[2] ) ) 
            mpxTransform.rotateTo( om.MEulerRotation( rotVector ) )
            joMtx = mpxTransform.asMatrix()
            
            fMtx = om.MMatrix()
            fPMtx = om.MMatrix()
            fMtxList = cmds.getAttr( first+'.wm' )
            fPMtxList = cmds.getAttr( first+'.pm' )
            sMtx = om.MMatrix()
            sMtxList = cmds.getAttr( second+'.wm' )
            
            om.MScriptUtil.createMatrixFromList( fMtxList, fMtx )
            om.MScriptUtil.createMatrixFromList( fPMtxList, fPMtx )
            om.MScriptUtil.createMatrixFromList( sMtxList, sMtx )
            
            sMtxPose = [ sMtx(3,0), sMtx(3,1), sMtx(3,2) ]
            
            rMtx = sMtx*(joMtx*fPMtx).inverse()
            rTransform = mpx.MPxTransformationMatrix( rMtx )
            rVector = rTransform.eulerRotation().asVector()
            
            rot = [ math.degrees( rVector.x ), math.degrees( rVector.y ), math.degrees( rVector.z ) ]

            cmds.setAttr( first+'.r', *rot )
            cmds.move( sMtxPose[0], sMtxPose[1], sMtxPose[2], first, ws=1 )

        else:
            rigbase.goToSamePosition( first, second )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:34,代码来源:allCtlsCmd.py


示例16: returnClosestPointOnMeshInfo

def returnClosestPointOnMeshInfo(targetObj, mesh):
    """
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    DESCRIPTION:
    Returns pertinent info of the closest point of a mesh to a target object -
    position, normal, parameterU,parameterV,closestFaceIndex,closestVertexIndex

    ARGUMENTS:
    targetObj(string)
    mesh(string)

    RETURNS:
    closestPointInfo(dict)
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    """

    """ make the closest point node """
    closestPointNode = mc.createNode ('closestPointOnMesh')
    controlSurface = mc.listRelatives(mesh,shapes=True)

    """ to account for target objects in heirarchies """
    attributes.doConnectAttr((targetObj+'.translate'),(closestPointNode+'.inPosition'))
    attributes.doConnectAttr((controlSurface[0]+'.worldMesh'),(closestPointNode+'.inMesh'))
    attributes.doConnectAttr((controlSurface[0]+'.matrix'),(closestPointNode+'.inputMatrix'))

    pointInfo = {}
    pointInfo['position']=attributes.doGetAttr(closestPointNode,'position')
    pointInfo['normal']=attributes.doGetAttr(closestPointNode,'normal')
    pointInfo['parameterU']=mc.getAttr(closestPointNode+'.parameterU')
    pointInfo['parameterV']=mc.getAttr(closestPointNode+'.parameterV')
    pointInfo['closestFaceIndex']=mc.getAttr(closestPointNode+'.closestFaceIndex')
    pointInfo['closestVertexIndex']=mc.getAttr(closestPointNode+'.closestVertexIndex')

    mc.delete(closestPointNode)
    return pointInfo
开发者ID:GuidoPollini,项目名称:MuTools,代码行数:35,代码来源:distance.py


示例17: reset_pack

def reset_pack():

    # pack is global
    global pack

    # IF pack exists
    if( len( pack ) ):

        # Loop through the pack
        for agent in pack:

            # Reset local position and heading to initial values
            cmds.setAttr( agent.animalName+".translateX", cmds.getAttr( agent.animalName+".initialPositionX" ) )
            cmds.setAttr( agent.animalName+".translateY", cmds.getAttr( agent.animalName+".initialPositionY" ) )
            cmds.setAttr( agent.animalName+".translateZ", cmds.getAttr( agent.animalName+".initialPositionZ" ) )
            cmds.setAttr( agent.animalName+".rotateY", cmds.getAttr( agent.animalName+".initialHeading" ) )
            cmds.setAttr( agent.animalName+".speed", cmds.getAttr( agent.animalName+".initialSpeed" ) )

            # Reset class specific variables
            agent.target = 0
            agent.wingAngle = 0

            # Reset awareness state
            agent.state = HuntingState.prowling

            # Reset state based attributes
            agent.set_speed_and_colour()
开发者ID:McBainC,项目名称:Portfolio,代码行数:27,代码来源:Main.py


示例18: rebuildFromIsoparms

def rebuildFromIsoparms(surface,spansU=0,spansV=0,degree=3,keepHistory=False):
	'''
	Build a new nurbs surface from an existing surfaces isoparms
	@param surface: Surface to build from
	@type surface: str
	@param direction: Surface direction to build from
	@type direction: str
	@param degree: Degree to build new surface to
	@type degree: int
	@param keepHistory: Keep loft surface history
	@type keepHistory: bool
	'''
	# Check surface
	if not mc.objExists(surface):
		raise Exception('Surface "'+surface+'" does not exist!!')
	if not isSurface(surface):
		raise Exception('Object "'+surface+'" is not a valid nurbs surface!!')
	
	# Initialize function pointers
	uMinPtr = OpenMaya.MScriptUtil().asDoublePtr()
	uMaxPtr = OpenMaya.MScriptUtil().asDoublePtr()
	vMinPtr = OpenMaya.MScriptUtil().asDoublePtr()
	vMaxPtr = OpenMaya.MScriptUtil().asDoublePtr()
	
	# Get surface details
	surfFn = getSurfaceFn(surface)
	surfFn.getKnotDomain(uMinPtr,uMaxPtr,vMinPtr,vMaxPtr)
	uMin = OpenMaya.MScriptUtil(uMinPtr).asDouble()
	uMax = OpenMaya.MScriptUtil(uMaxPtr).asDouble()
	vMin = OpenMaya.MScriptUtil(vMinPtr).asDouble()
	vMax = OpenMaya.MScriptUtil(vMaxPtr).asDouble()
	uDif = uMax - uMin
	vDif = vMax - vMin
	
	# Get surface form
	closeU = bool(mc.getAttr(surface+'.formU'))
	closeV = bool(mc.getAttr(surface+'.formV'))
	
	# Check spans
	if not spansU: spansU = surfFn.numKnotsInU()
	if not spansV: spansV = surfFn.numKnotsInV()
	
	# Get new knot values
	uList = []
	vList = []
	uInc = uDif/(spansU-int(not closeU))
	vInc = vDif/(spansV-int(not closeV))
	for u in range(spansU): uList.append(uMin+(uInc*u))
	for v in range(spansV): vList.append(vMin+(vInc*v))
	
	# Rebuild in U
	uLoft = mc.loft([surface+'.u['+str(i)+']' for i in uList],close=closeU,degree=degree)
	uSurface = uLoft[0]
	
	# Rebuld in V
	vLoft = mc.loft([uSurface+'.v['+str(i)+']' for i in vList],close=closeV,degree=degree)
	rebuildSurface = vLoft[0]
	
	# Return result
	return rebuildSurface
开发者ID:RiggingDojoAdmin,项目名称:glTools,代码行数:60,代码来源:surface.py


示例19: create_ik_arm_stretch

 def create_ik_arm_stretch(self):
     """Creates the IK stretch setup."""
     arm_dist, start_loc, end_loc = self.c.distance_node(self.guides['upperArm'], self.guides['hand'])
     arm_dist = cmds.rename(arm_dist, '%s_%s_%s' % (self.side, 'arm', self.nc.distance))
     start_loc = cmds.rename(start_loc, '%s_%s_%s' % (self.side, 'armLengthStart', self.nc.locator))
     end_loc = cmds.rename(end_loc, '%s_%s_%s' % (self.side, 'armLengthEnd', self.nc.locator))
     cmds.parent(end_loc, self.controls['handik'])
     cmds.parent(arm_dist, self.top_grp)
     driver = '%sShape.distance' % arm_dist
     if self.side == 'R':
         mult = cmds.shadingNode('multiplyDivide', asUtility=True)
         mult = cmds.rename(mult, '%s_%s_stretch_negative_MDN' % (self.side, 'arm'))
         cmds.connectAttr('%sShape.distance' % arm_dist, '%s.input1X' % mult, f=True)
         cmds.setAttr('%s.input2X' % mult, -1)
         driver = '%s.outputX' % mult
     # END if
     upper_arm_len = cmds.getAttr('%s.tx' % self.ik_jnts[1])
     fore_arm_len = cmds.getAttr('%s.tx' % self.ik_jnts[2])
     sum_len = upper_arm_len + fore_arm_len
     cmds.setDrivenKeyframe('%s.translateX' % self.ik_jnts[1], cd=driver,
                            dv=sum_len, itt='linear', ott='linear')
     cmds.setDrivenKeyframe('%s.translateX' % self.ik_jnts[1], cd=driver,
                            dv=sum_len*2, v=upper_arm_len*2, itt='linear', ott='linear')
     cmds.setDrivenKeyframe('%s.translateX' % self.ik_jnts[2], cd=driver,
                            dv=sum_len, itt='linear', ott='linear')
     cmds.setDrivenKeyframe('%s.translateX' % self.ik_jnts[2], cd=driver,
                            dv=sum_len*2, v=fore_arm_len*2, itt='linear', ott='linear')
     cmds.setAttr('%s_translateX.postInfinity' % self.ik_jnts[1], 1)
     cmds.setAttr('%s_translateX.postInfinity' % self.ik_jnts[2], 1)
     # stretch the result joints
     curve = '%s_%s_%s' % (self.side, 'upperArm', self.nc.curve)
     self.stretch_result_joints(curve, 'upperArm', self.upper_arm_jnts)
     curve = '%s_%s_%s' % (self.side, 'foreArm', self.nc.curve)
     self.stretch_result_joints(curve, 'foreArm', self.fore_arm_jnts)
开发者ID:jonntd,项目名称:Rigganator,代码行数:34,代码来源:arm.py


示例20: setAttr

def setAttr(*args, **kwargs):
    """
    @type  args: *args
    @param args: specify nodes as you would do usually with maya cmds
    """
    assert args, "Please specify an existing node and attr."
    assert cmds.objExists(args[0]), "Please specify an existing node and attr."

    #--- vars
    check = False
    obj = args[0].split('.')[0]
    attr = args[0].split('.')[1]

    #--- unlock the attributes
    compound = cmds.attributeQuery(attr, node=obj, listChildren=True)
    if compound:
        for c in compound:
            if cmds.getAttr(obj + '.' + c, lock=True):
                attribute.lock_n_hide(obj, [c], True)
                check = True
    else:
        if cmds.getAttr(args[0], lock=True):
            attribute.lock_n_hide(obj, [attr], True)
            check = True

    #--- set attribute
    try:
        cmds.setAttr(args[0], args[1], args[2], args[3])
    except:
        cmds.setAttr(args[0], args[1])

    #--- lock the attribute
    if check:
        attribute.lock_n_hide(obj, [attr])
开发者ID:jonntd,项目名称:Public,代码行数:34,代码来源:goe.py



注:本文中的maya.cmds.getAttr函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python cmds.getPanel函数代码示例发布时间:2022-05-27
下一篇:
Python cmds.frameLayout函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap