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

Python cmds.delete函数代码示例

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

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



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

示例1: singlePoly

 def singlePoly(self, arg=None):
     selObj=self.selection_grab()
     if selObj:
         pass
     else:
         print "select a polygon object"
         return    
     if "." in selObj[0]:
         print "You need to select a polygon object to interogate.(check that you are not in component mode)"
         return     
     else:
         pass 
     cmds.select(cl=True)
     if cmds.objExists("PolyIssues")==True:
         cmds.delete("PolyIssues")
     cmds.sets(n="PolyIssues", co=5)
     cmds.select(selObj)
     errorFound=cmds.polyInfo(selObj, lf=True, nme=True, nmv=True )
     cmds.select (errorFound)
     cmds.ConvertSelectionToVertices(errorFound)
     if errorFound>0:
         print "Polygon error found"
         cmds.sets( fe='PolyIssues')
     cmds.select('PolyIssues', r=True, ne=True)
     cmds.pickWalk(d='Up')
     errorFound=cmds.ls(sl=True)
     if (len(errorFound))==0:
         cmds.delete("PolyIssues")
开发者ID:edeglau,项目名称:storage,代码行数:28,代码来源:polyChecker.py


示例2: confirmJoints

    def confirmJoints(self):
        """   
        draw joints in locator position
        """

        #- Getting Ball and Toe Location
        self.leftHipPos = cmds.xform('l_hip_Adjust_ctl', q = True, ws = True, t = True)
        self.leftKneePos = cmds.xform('l_knee_Adjust_ctl', q = True, ws = True, t = True)
        self.leftAnklePos = cmds.xform('l_ankle_Adjust_ctl', q = True, ws = True, t = True)
        self.leftBallPos = cmds.xform('l_ball_Adjust_ctl', q = True, ws = True, t = True)
        self.leftToePos = cmds.xform('l_toe_Adjust_ctl', q = True, ws = True, t = True)
        self.leftHeelPos = cmds.xform('l_heel_PivotPosition', q = True, ws = True, t = True)
        self.leftSideInPos = cmds.xform('l_sidein_PivotPosition', q = True, ws = True, t = True)
        self.leftSideOutPos = cmds.xform('l_sideout_PivotPosition', q = True, ws = True, t = True)
        
        #duplicate pivots
        cmds.duplicate('l_heel_PivotPosition', n = 'r_heel_PivotPosition', rr =  True)
        cmds.xform('r_heel_PivotPosition', t = [-self.leftHeelPos[0], self.leftHeelPos[1], self.leftHeelPos[2]])
        cmds.duplicate('l_sidein_PivotPosition', n = 'r_sidein_PivotPosition', rr =  True)
        cmds.xform('r_sidein_PivotPosition', t = [-self.leftSideInPos[0], self.leftSideInPos[1], self.leftSideInPos[2]])
        cmds.duplicate('l_sideout_PivotPosition', n = 'r_sideout_PivotPosition', rr =  True)
        cmds.xform('r_sideout_PivotPosition', t = [-self.leftSideOutPos[0], self.leftSideOutPos[1], self.leftSideOutPos[2]])
        
        cmds.select(cl = True)
        print 'leg Parts : ' , self.legParts
        for elem in self.legElement :
            jointPos = cmds.xform(self.left + elem + '_Adjust_ctl', t = True, q = True, ws = True)
            cmds.joint(n = '%s%s_jnt' %(self.left, elem), p = jointPos)
            
        #- orient joint
        cmds.joint(self.lHipJnt, e = True, oj = 'xzy', secondaryAxisOrient = 'yup', ch = True, zso = True)

        #- delete position locators
        cmds.delete(self.legParts)
开发者ID:darkuress,项目名称:arNew,代码行数:34,代码来源:legSetup.py


示例3: mirrorJoints

    def mirrorJoints(self, topJoint = '', prefix = ['l_', 'r_']):
        """
        mirroring joint, top node needs to contain 'l_' as prefix
        """

        lPrefix = prefix[0]
        rPrefix = prefix[1]
        
        cmds.select(cl = True)
        cmds.joint(n = 'temp_jnt')
        cmds.select(topJoint, r = True)
        cmds.select('temp_jnt', tgl = True)
        self.toggleSelect(topJoint, 'temp_jnt')
        cmds.parent()
        
        cmds.select(topJoint, r = True)
        cmds.mirrorJoint(mirrorYZ = True, mirrorBehavior  = True, myz = True, searchReplace =  prefix)
        
        rJoint = rPrefix + topJoint.split(lPrefix)[-1]
        cmds.select(topJoint, rJoint)
        cmds.parent(w = True)
        
        cmds.delete('temp_jnt')
        
        return rJoint
开发者ID:darkuress,项目名称:arFace,代码行数:25,代码来源:Util.py


示例4: mirror_chain

    def mirror_chain(self, side = None):
        #create one temporary joint at the origin
        tmp_jnt = cmds.joint(position = [0, 0, 0])

        #parent the chain to that joint
        cmds.parent(self.fk_joint_names[0], tmp_jnt)

        #mirror the chain and rename the mirrored side
        if side == 'L':
            self.mirrored_fk_joint_names = cmds.mirrorJoint(self.fk_joint_names[0], mirrorYZ = 1, mirrorBehavior = 1, searchReplace = (side, 'R'))
        elif side == 'l':
            self.mirrored_fk_joint_names = cmds.mirrorJoint(self.fk_joint_names[0], mirrorYZ = 1, mirrorBehavior = 1, searchReplace = (side, 'r'))
        elif side == 'R':
            self.mirrored_fk_joint_names = cmds.mirrorJoint(self.fk_joint_names[0], mirrorYZ = 1, mirrorBehavior = 1, searchReplace = (side, 'L'))
        elif side == 'r':
            self.mirrored_fk_joint_names = cmds.mirrorJoint(self.fk_joint_names[0], mirrorYZ = 1, mirrorBehavior = 1, searchReplace = (side, 'l'))
        else:
            self.mirrored_fk_joint_names = cmds.mirrorJoint(self.fk_joint_names[0], mirrorYZ = 1, mirrorBehavior = 1)

        #unparent the chain and delete the temporary joint
        cmds.parent(self.fk_joint_names[0], self.mirrored_fk_joint_names[0], world = 1)        
        cmds.delete(tmp_jnt)

        cmds.select(clear = 1)        
        return self.mirrored_fk_joint_names
开发者ID:AtonLerin,项目名称:AutoRigger,代码行数:25,代码来源:jointchain.py


示例5: 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


示例6: 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


示例7: cleanClashingElements

 def cleanClashingElements(self, origRenderElements, newRenderElements):
     for newElement in newRenderElements:
         if clashNameSpace in newElement:
             if not newElement.split(clashNameSpace)[-1] in origRenderElements:
                 classingBaseName = newElement.split(clashNameSpace + "_")[-1]
                 cmds.delete(classingBaseName)
                 cmds.rename(newElement, classingBaseName)
开发者ID:davidwilliamsDK,项目名称:maya,代码行数:7,代码来源:dsVrayElementsTool.py


示例8: createJoints

def createJoints(prefix, lytObs, *args):
    print "CreateJoints"

    cmds.select(d=True)

    ik_joints = []

    for item in lytObs:
        """ item[0] will be the joint
            item[1] will be the position
            item[2] will be the parent        
        """
        newJointName = item[0].replace("lyt_", prefix)

        cmds.select(d=True)
        if cmds.objExists(newJointName) == True:
            cmds.delete(newJointName)
        jnt = cmds.joint(p=item[1], n=newJointName )
        ik_joints.append(jnt)


    lytLen = len(lytObs)

    for item in range(len(lytObs)):
        if item != 0:
            joint = lytObs[item][0].replace("lyt_", prefix)
            jointParent = lytObs[item][2].replace("lyt_", prefix)
            cmds.parent(joint, jointParent) 

    for jnt in ik_joints:
        cmds.joint(jnt, e=True, oj='xyz', secondaryAxisOrient='yup', ch=True, zso=True)


    return ik_joints  
开发者ID:griffinanimator,项目名称:RG_TOOLS,代码行数:34,代码来源:Utils_Widget.py


示例9: locatorOnly

def locatorOnly(self):

    sel = cmds.ls(sl=True)

    # Gives error if more than one object is selected.
    if len(sel) > 1:
        cmds.error("Too many objects selected!")

    # Creates and snaps a locator to object.
    elif len(sel):
        tObj = sel[0]
        tLoc = "{0}_tLoc".format(tObj)
        LScale = cmds.floatField(LocScale, q=True, v=True)

        if cmds.objExists(tLoc):
            cmds.delete(tLoc)

        cmds.spaceLocator(n="{0}_tLoc".format(tObj))
        cmds.scale(LScale, LScale, LScale)
        cmds.parentConstraint(tObj, tLoc, mo=False)
        cmds.parentConstraint(tObj, tLoc, rm=True)

        print LScale
    # Gives error if no objects are selected.
    else:
        cmds.error("No objects selected!")
开发者ID:Italic-,项目名称:maya-prefs,代码行数:26,代码来源:jamTrack.py


示例10: combine

	def combine(self, objs=[], new_name="", keepHistory=0):
		'''
		Combines the geometry and stores the names.
		This is useful for speeding up the rigs and seperating in a predictible way.
		@param objs: Mesh objects to combine
		@type objs: list
		@param new_name: New name for the combined mesh
		@type new_name: str
		@param keepHistory: Maintain history after function has completed
		@type keepHistory: bool
		'''
		# Check input arguments
		if not objs:
			raise Exception('Input list "objs" is not a valid list!')
		for obj in objs:
			if not mc.objExists(obj):
				raise Exception('Object '+obj+' does not exist!')
		if mc.objExists(new_name):
			raise Exception('An object of name '+new_name+' already exists! Please choose another name!')
		
		# Combine multiple mesh objects to a single mesh
		new_obj = mc.polyUnite(objs, n=new_name)
		mc.addAttr( new_obj[0], ln='origNames', dt='string', multi=True)
		# Recond original names list on new mesh transform
		for i in range(len(objs)):
			mc.setAttr( new_obj[0]+'.origNames['+str(i)+']', objs[i], type='string')
		# Delete history
		if not keepHistory : mc.delete(new_obj[1])
		mc.delete(objs)
		
		return new_obj[0]
开发者ID:auqeyjf,项目名称:glTools,代码行数:31,代码来源:meshCombine.py


示例11: surfaceFromNodes

def surfaceFromNodes(nodes, name='jntsSrf', upAxis=0, doubleEndPoints=False):
    """
    Create a 2-degree nurbs surface from the position of a list of
    node (generally, the IK controls)
    @param nodes: controls that will dictate the CV positions
    @type nodes: list of strings
    @param name: the name of the surface
    @type name: str
    @param upAxis: the direction of the width of the surface
    @type upAxis: int representing x(0), y(1) or z(2)
    """
    inPos = [0,0,0]
    outPos = [0,0,0]
    inPos[upAxis] = -1
    outPos[upAxis] = 1

    crv1 = curveFromNodes(nodes, doubleEndPoints=doubleEndPoints)
    crv2 = curveFromNodes(nodes, doubleEndPoints=doubleEndPoints)

    MC.xform(crv1, t=outPos)
    MC.xform(crv2, t=inPos)

    srf = MC.loft(crv1, crv2, u=1, c=0, ch=0, ar=1, d=1, ss=1, rn=0, po=0, rsn=True)[0]
    srf = MC.rename(srf, name)
    MC.delete(crv1, crv2)

    return srf
开发者ID:jspatrick,项目名称:beings,代码行数:27,代码来源:spine2.py


示例12: ShapeInverterCmdold

def ShapeInverterCmdold(base=None, corrective=None, name=None):
    mc.undoInfo(openChunk=True)
    if not base or not corrective:
        sel = mc.ls(sl=True)
        base, corrective = sel
    shapes = mc.listRelatives(base, children=True, shapes=True)
    for s in shapes:
        if mc.getAttr("%s.intermediateObject" % s) and mc.listConnections("%s.worldMesh" % s, source=False):
            origMesh = s
            break
    deformed = mc.polyPlane(ch=False)[0]
    mc.connectAttr("%s.worldMesh" % origMesh, "%s.inMesh" % deformed)
    mc.setAttr("%s.intermediateObject" % origMesh, 0)
    mc.delete(deformed, ch=True)
    mc.setAttr("%s.intermediateObject" % origMesh, 1)
    if not name:
        name = "%s_inverted#" % corrective
    invertedShape = duplicateMesh(base, name=name)
    deformer = mc.deformer(invertedShape, type="ShapeInverter")[0]
    mc.ShapeInverterCmd(baseMesh=base, invertedShape=invertedShape, ShapeInverterdeformer=deformer, origMesh=deformed)
    # correctiveShape = duplicateMesh(base,name=corrective+"_corrective#")
    # mc.connectAttr('%s.outMesh' % getShape(correctiveShape), '%s.correctiveMesh' % deformer)
    # transferMesh(corrective,[correctiveShape])
    mc.connectAttr("%s.outMesh" % getShape(corrective), "%s.correctiveMesh" % deformer)
    mc.setAttr("%s.activate" % deformer, True)
    mc.delete(deformed)
    bdingBx = mc.polyEvaluate(corrective, boundingBox=True)
    xDifVal = bdingBx[0][1] - bdingBx[0][0]
    # mc.move(xDifVal*1.10,correctiveShape,r=True,moveX=True)
    mc.move(xDifVal * 2.20, invertedShape, r=True, moveX=True)
    mc.undoInfo(closeChunk=True)
    return invertedShape  # ,correctiveShape
开发者ID:jonntd,项目名称:cvShapeInverter,代码行数:32,代码来源:ShapeInverterScript.py


示例13: _deleteTurtleNodes

def _deleteTurtleNodes(*args):
    pluginName = 'Turtle'
    dn = cmds.pluginInfo(pluginName,q=True,dn=True)
    turtleNodes = cmds.ls(type=dn)
    cmds.lockNode(turtleNodes,l=False)
    cmds.delete(turtleNodes)
    return 0
开发者ID:ShuheiArai,项目名称:maya,代码行数:7,代码来源:deleteTurtlePlugin.py


示例14: transUVHier

def transUVHier(rig):
    args = cmds.ls(sl=True)
    if rig:
        #select the target if it is skinned meshes
        cmds.select(args[1], r=1)
        #select just the polys
        cmds.SelectHierarchy()
        polys = cmds.filterExpand(cmds.ls(sl=1), expand=1, sm=12)
        
        for poly in polys:
            #if the geo has a skinCluster then...
            melCommand = "findRelatedDeformer(\""+str(poly)+"\")"
            deformers = mel.eval(melCommand)
            #print 'for object: ' + poly
            print deformers
            if skinClusterDef(deformers):
                shapes = getShapes(poly)
                if len(shapes) > 0:
                    if cmds.objExists(shapes[0]+'Orig'):
                        cmds.setAttr(shapes[0]+'Orig.intermediateObject', 0)
    
    #transferUvHierarchy( args[0], args[1] )
    if rig:
        for poly in polys:
            #if the geo has a skinCluster then...
            melCommand = "findRelatedDeformer(\""+str(poly)+"\")"
            deformers = mel.eval(melCommand)
            #print 'for object: ' + poly
            
            if skinClusterDef(deformers):
                shapes = getShapes(poly)
                cmds.delete(shapes[0]+'Orig', ch=1)
                cmds.setAttr(shapes[0]+'Orig.intermediateObject', 1)
开发者ID:AndresMWeber,项目名称:aw,代码行数:33,代码来源:ss_transferUVHierarchy.py


示例15: 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


示例16: bt_moveObjToCamera

def bt_moveObjToCamera():
    
    #Check for hotkey and make if possible
    bt_checkCtrFHotkey()

    activePanel = cmds.getPanel(wf=1)
    if "model" in activePanel:
        activeCamera = cmds.modelEditor(activePanel,q=1,camera=1)   
    else:
        cmds.error ('No active panel/camera to frame to')    
         
    selected = cmds.ls(sl=1)
    
    locator = cmds.spaceLocator()
    cmds.select(activeCamera,add=1)
    cmds.parent(r=1)
    cmds.move(0,0,-5,locator,r=1,os=1)
    location = cmds.xform(q=1,t=1,ws=1)
    
    for object in selected:
        cmds.move(location[0],location[1],location[2],object,ws=1,a=1)
        #cmds.move(location[0],location[1],location[2],'pCube1',ws=1,a=1)
        
    cmds.delete(locator)   
    cmds.select(selected,r=1)
开发者ID:cyrillef,项目名称:apps.exchange.packager,代码行数:25,代码来源:bt_moveObjToCamera.py


示例17: returnClosestPointOnMeshInfoFromPos

def returnClosestPointOnMeshInfoFromPos(pos, mesh):
    """
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    DESCRIPTION:
    Returns pertinent info of the closest point of a mesh to a position in space -
    position, normal, parameterU,parameterV,closestFaceIndex,closestVertexIndex

    ARGUMENTS:
    pos(string)
    mesh(string)

    RETURNS:
    closestPointInfo(dict)
    Keys:
    position
    normal
    parameterU
    parameterV
    closestFaceIndex
    closestVertexIndex
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    """

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

    """ to account for target objects in heirarchies """
    locBuffer = mc.spaceLocator()
    mc.move (pos[0],pos[1],pos[2], locBuffer[0])

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


示例18: orientJoint

def orientJoint (objects = [], aim = [1,0,0], up = [0,0,1]):

    crossVector = getCrossVector(objects[0], objects[1], objects[-1])
    
    for i in range(len(objects)-1):
        jointParents = cmds.listRelatives(objects[i], p=True)
        
        if jointParents:
            jointParent = jointParents[0]
            
        children = cmds.listRelatives(objects[i], c=True, type='transform')
        tempGrp = cmds.group(objects[i])
        
        cmds.parent(children, tempGrp)
        cmds.parent(objects[i], world=True)
        
        cmds.delete(cmds.aimConstraint(objects[i+1], objects[i], aimVector=aim, upVector=up, worldUpType='vector', worldUpVector = crossVector))

        cmds.parent(children, objects[i])
        
        if jointParents:
            cmds.parent(objects[i], jointParent)
            
        cmds.delete(tempGrp)
    
    cmds.makeIdentity(objects[0], apply=True, r=True) 
开发者ID:adamfok,项目名称:afok_toolset,代码行数:26,代码来源:orient_joint.py


示例19: doRemoveABC

    def doRemoveABC(self) : 
        title = 'Remove test abc'
        abcNodes = mc.ls(type = 'AlembicNode')

        if abcNodes : 
            mc.delete(abcNodes)
            self.setStatus(title, True)
开发者ID:myCodeTD,项目名称:shade_tool,代码行数:7,代码来源:shade_app.py


示例20: stabilizer

def stabilizer (task):
	camera	= Camera()
	point	= cmds.ls (selection = True)

	if task == 'end':
		# turn off stab
		expression		= str (cmds.expression ('stabilizator_expression', string = True, query = True))
		camera.shape	= expression[2:expression.find('#')]
		cmds.delete ('stabilizator_expression')
		camera.reset_camera ()
		cmds.button ('button_stabilizer',
					edit				= True,
					label				= 'stabilize',
					backgroundColor		= (0, 0.5, 0),
					command				= 'fstab.stabilizer("start")')

	else:
		# start stab
		if cmds.objExists ('stabilizator_expression'):
			# stabilizator exists
			expression		= str (cmds.expression ('stabilizator_expression', string = True, query = True))
			camera.shape	= expression[2:expression.find('#')]
			cmds.delete ('stabilizator_expression')
			cmds.select (camera.shape, replace = True)
			cmds.warning (('>>> STAB WAS TURNED ON. CHECK: ' + camera.shape + ' <<< FOR NONZERO OFFSET VALUES ::..'))
		
		else:
			if cmds.nodeType (point) != 'mesh' and cmds.nodeType (point) != 'transform' and len (point) == 0:
				# wrong selection
				cmds.warning ('..:: SELECT SOMETHING TO STABILIZE ::..')
			else:
				point = point[0]
				
				if point != camera.transform and point != camera.shape and camera.transform != 'empty':
					# stabilize
					cmds.setAttr( camera.shape + '.displayResolution', 0)
					cmds.setAttr( camera.shape + '.displayFilmGate', 0)
				
					expression = '//%s#' % camera.shape
					expression += '\npython "import maya.cmds as cmds";'
					expression += '\npython "fov_h = cmds.camera (\'%s\', query = True, horizontalFieldOfView = True)";' % camera.shape
					expression += '\npython "fov_v = cmds.camera (\'%s\', query = True, verticalFieldOfView = True)";' % camera.shape
					expression += '\npython "aperture_h = cmds.camera (\'%s\', query = True, horizontalFilmAperture = True)";' % camera.shape
					expression += '\npython "aperture_v = cmds.camera (\'%s\', query = True, verticalFilmAperture = True)";' % camera.shape
					expression += '\n$pos=`python "fstab.get_normalized_screen_position(\'%s\',\'%s\',fov_h, fov_v,aperture_h,aperture_v)"`;' % (point, camera.transform)
					expression += '\nsetAttr "%s.horizontalFilmOffset" ($pos[2]);' % camera.shape
					expression += '\nsetAttr "%s.verticalFilmOffset" ($pos[3]);' % camera.shape

					# create expression
					cmds.expression		(name = 'stabilizator_expression', string = expression)
		
					# update GUI
					cmds.button			('button_stabilizer',
										edit			= True,
										label			="deStabilize",
										backgroundColor	= (1, 0, 0),
										command			= 'fstab.stabilizer("end")')
					
				else:
					cmds.warning ('..:: CLICK IN THE PANE WITH THE CAMERA ::..')
开发者ID:danielforgacs,项目名称:code-dump,代码行数:60,代码来源:ford_stabilizer_v0.5.5.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python cmds.deleteAttr函数代码示例发布时间:2022-05-27
下一篇:
Python cmds.deformer函数代码示例发布时间: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