當前位置: 首頁>>代碼示例>>Python>>正文


Python cmds.delete方法代碼示例

本文整理匯總了Python中maya.cmds.delete方法的典型用法代碼示例。如果您正苦於以下問題:Python cmds.delete方法的具體用法?Python cmds.delete怎麽用?Python cmds.delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在maya.cmds的用法示例。


在下文中一共展示了cmds.delete方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: doControlAction

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import delete [as 別名]
def doControlAction(self, destinationList, *args):
        """ Action to do when creating a control
            Do action as user wants:
                1 = New control
                2 = Add shape
                3 = Replace shapes
        """
        if self.cvAction == 1: #new control
            pass
        else:
            if destinationList:
                if self.cvAction == 2: #add shape
                    self.ctrls.transferShape(True, False, self.cvCurve, destinationList, True)
                elif self.cvAction == 3: #replace shapes
                    self.ctrls.transferShape(True, True, self.cvCurve, destinationList, True)
            else:
                cmds.delete(self.cvCurve)
                mel.eval("warning \""+self.langDic[self.langName]['e011_notSelShape']+"\";") 
開發者ID:nilouco,項目名稱:dpAutoRigSystem,代碼行數:20,代碼來源:dpBaseControlClass.py

示例2: createEyelidJoints

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import delete [as 別名]
def createEyelidJoints(self, side, lid, middle, cvEyelidLoc, jointLabelNumber, *args):
        ''' Create the eyelid joints to be used in the needed setup.
            Returns EyelidBaseJxt and EyelidJnt created for rotate and skinning.
        '''
        # declating a concatenated name used for base to compose:
        baseName = side+self.userGuideName+"_"+self.langDic[self.langName][lid]+"_"+self.langDic[self.langName]['c042_eyelid']+middle
        # creating joints:
        eyelidBaseZeroJxt = cmds.joint(name=baseName+"_Base_Zero_Jxt", rotationOrder="yzx", scaleCompensate=False)
        eyelidBaseJxt = cmds.joint(name=baseName+"_Base_Jxt", rotationOrder="yzx", scaleCompensate=False)
        eyelidZeroJxt = cmds.joint(name=baseName+"_Zero_Jxt", rotationOrder="yzx", scaleCompensate=False)
        eyelidJnt = cmds.joint(name=baseName+"_Jnt", rotationOrder="yzx", scaleCompensate=False)
        cmds.addAttr(eyelidJnt, longName='dpAR_joint', attributeType='float', keyable=False)
        utils.setJointLabel(eyelidJnt, jointLabelNumber, 18, self.userGuideName+"_"+self.langDic[self.langName][lid]+"_"+self.langDic[self.langName]['c042_eyelid']+middle)
        cmds.select(eyelidZeroJxt)
        eyelidSupportJxt = cmds.joint(name=baseName+"_Jxt", rotationOrder="yzx", scaleCompensate=False)
        cmds.setAttr(eyelidSupportJxt+".translateX", self.ctrlRadius*0.1)
        # positioning and orienting correctely eyelid joints:
        cmds.delete(cmds.aimConstraint(cvEyelidLoc, eyelidBaseZeroJxt, aimVector=(0,0,1), worldUpType="objectrotation", worldUpObject=self.eyelidJxt))
        cmds.delete(cmds.parentConstraint(cvEyelidLoc, eyelidZeroJxt, mo=False))
        cmds.setAttr(eyelidZeroJxt+".rotateX", 0)
        cmds.setAttr(eyelidZeroJxt+".rotateY", 0)
        cmds.setAttr(eyelidZeroJxt+".rotateZ", 0)
        cmds.select(self.eyelidJxt)
        return eyelidBaseJxt, eyelidJnt 
開發者ID:nilouco,項目名稱:dpAutoRigSystem,代碼行數:26,代碼來源:dpEye.py

示例3: clearNodeGrp

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import delete [as 別名]
def clearNodeGrp(nodeGrpName='dpAR_GuideMirror_Grp', attrFind='guideBaseMirror', unparent=False):
    """ Check if there is any node with the attribute attrFind in the nodeGrpName and then unparent its children and delete it.
    """
    if cmds.objExists(nodeGrpName):
        foundChildrenList = []
        childrenList = cmds.listRelatives(nodeGrpName, children=True, type="transform")
        if childrenList:
            for child in childrenList:
                if cmds.objExists(child+"."+attrFind) and cmds.getAttr(child+"."+attrFind) == 1:
                    foundChildrenList.append(child)
        if len(foundChildrenList) != 0:
            if unparent:
                for item in foundChildrenList:
                    cmds.parent(item, world=True)
                cmds.delete(nodeGrpName)
        else:
            cmds.delete(nodeGrpName) 
開發者ID:nilouco,項目名稱:dpAutoRigSystem,代碼行數:19,代碼來源:dpUtils.py

示例4: context_request

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import delete [as 別名]
def context_request(self, widget, action):

        if action.text() == 'Delete':
            selection = cmds.ls(sl=1, typ='sporeNode')
            for geo_wdg, spore_wdgs in self.wdg_tree.iteritems():
                for spore_wdg in spore_wdgs:

                    spore_node = spore_wdg.name
                    print spore_node
                    if spore_wdg.is_selected and cmds.objExists(spore_node):
                        instancer = node_utils.get_instancer(spore_node)
                        transform = cmds.listRelatives(spore_node, p=True, f=True)

                        if len(cmds.listRelatives(transform, c=1)) == 1:
                            cmds.delete((spore_node, transform[0], instancer))
                        else:
                            cmds.delete((spore_node, instancer))

                        selection.remove(spore_node)
                        cmds.select(selection)

            self.refresh_spore() 
開發者ID:wiremas,項目名稱:spore,代碼行數:24,代碼來源:manager.py

示例5: move_center_each_object

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import delete [as 別名]
def move_center_each_object():
    object_mode = cmds.selectMode( q=True, o=True )
    cmds.selectMode(o=True)
    selection = cmds.ls(sl=True, l=True)
    meshes = common.search_polygon_mesh(selection, fullPath=True, nurbs=True)
    if not meshes:
        return
    dummy = common.TemporaryReparent().main(mode='create')
    for m in meshes:
        cmds.selectMode(o=True)
        common.TemporaryReparent().main(m, dummyParent=dummy, mode='cut')
        cmds.select(m, r=True)
        if not object_mode:
            cmds.selectMode(co=True)
        move_center2selection()
        common.TemporaryReparent().main(m, dummyParent=dummy, mode='parent')
    common.TemporaryReparent().main(dummyParent=dummy, mode='delete')
    freeze.main(mesh=selection)
    cmds.select(selection, r=True) 
開發者ID:ShikouYamaue,項目名稱:SISideBar,代碼行數:21,代碼來源:transform.py

示例6: freezeModeling

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import delete [as 別名]
def freezeModeling(node, engine='maya'):
    #子供のノード退避用ダミーペアレントを用意
    dummy = common.TemporaryReparent().main(mode='create')
    common.TemporaryReparent().main(node,dummyParent=dummy, mode='cut')
    #ヒストリを全削除
    cmds.bakePartialHistory(node,pc=True)
    #ウェイトを書き戻してくる
    weight.WeightCopyPaste().main(node, mode='paste', saveName=__name__, engine=engine)
    #いらないシェイプを消す
    deleteZeroShape(node)
    #親子付けを戻す
    common.TemporaryReparent().main(node, dummyParent=dummy, mode='parent')
    #ダミーペアレントを削除
    common.TemporaryReparent().main(dummyParent=dummy, mode='delete')
        
#接続の無い不要なシェイプを削除 
開發者ID:ShikouYamaue,項目名稱:SISideBar,代碼行數:18,代碼來源:freeze.py

示例7: freeze

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import delete [as 別名]
def freeze():
    cmds.selectMode(o=True)
    selection = cmds.ls(sl=True, type = 'transform')
    dummy = common.TemporaryReparent().main(mode='create')#モジュールでダミーの親作成
    clusterCopy = modeling.ClusterCopy()
    for sel in selection:
        allChildren = [sel] + cmds.listRelatives(sel, ad=True)#子供を取得して1つのリストにする
        polyMesh = common.search_polygon_mesh(allChildren)
        if polyMesh:
            for mesh in polyMesh:
                common.TemporaryReparent().main(mesh, dummyParent=dummy, mode='cut')
                defCls = clusterCopy.copy(mesh)
                cmds.bakePartialHistory(mesh,pc=True)
                if defCls:
                    clusterCopy.paste(mesh)
                common.TemporaryReparent().main(mesh, dummyParent=dummy, mode='parent')#コピーのおわったメッシュの子供を元に戻す
    common.TemporaryReparent().main(dummyParent=dummy, mode='delete')#ダミー親削除
    cmds.select(selection, r=True) 
開發者ID:ShikouYamaue,項目名稱:SISideBar,代碼行數:20,代碼來源:freeze.py

示例8: BT_ConnectSetup

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import delete [as 別名]
def BT_ConnectSetup(set = None):

    if not set or not cmds.objExists(set):
        return False

    if BT_IsSetupConnected(set = set):
        cmds.warning('Setup already connected!')
        return False
    
    btNode = cmds.getAttr(set +'.Blend_Node')
    if not btNode or not cmds.objExists(btNode):
        return False

    transforms = cmds.listConnections(set +'.dagSetMembers')
    for i in range(0, len(transforms)):
        try:
            BT_ConnectOutputs(index = i, node = btNode, transform = transforms[i])
        except:
            pass

    mults = cmds.listConnections(btNode, d = True, type = 'multiplyDivide')
    if mults:
        cmds.delete(mults)

    return True 
開發者ID:duncanskertchly,項目名稱:BlendTransforms,代碼行數:27,代碼來源:BlendTransforms.py

示例9: convertSkelSettingsToNN

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import delete [as 別名]
def convertSkelSettingsToNN(delete=1):
        orig = 'SkeletonSettings_Cache'
        if cmds.objExists(orig):
            if cmds.nodeType(orig) == 'unknown':
                new = cmds.createNode('network')
                for att in cmds.listAttr(orig):
                    if not cmds.attributeQuery(att, node=new, exists=1):
                        typ = cmds.attributeQuery(att, node=orig, at=1)
                        if typ == 'typed':
                            cmds.addAttr(new, longName=att, dt='string')
                            if cmds.getAttr(orig + '.' + att):
                                cmds.setAttr(new + '.' + att, cmds.getAttr(orig + '.' + att), type='string')
                        elif typ == 'enum':
                            cmds.addAttr(new, longName=att, at='enum', enumName=cmds.attributeQuery(att, node=orig, listEnum=1)[0])
                cmds.delete(orig)
                cmds.rename(new, 'SkeletonSettings_Cache') 
開發者ID:chrisevans3d,項目名稱:uExport,代碼行數:18,代碼來源:uExport.py

示例10: exists

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import delete [as 別名]
def exists(self):
        """The node exists in both memory *and* scene

        Example:
            >>> node = createNode("joint")
            >>> node.exists
            True
            >>> cmds.delete(str(node))
            >>> node.exists
            False
            >>> node.destroyed
            False
            >>> _ = cmds.file(new=True, force=True)
            >>> node.exists
            False
            >>> node.destroyed
            True

        """

        return not self._removed 
開發者ID:mottosso,項目名稱:cmdx,代碼行數:23,代碼來源:cmdx.py

示例11: pop

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import delete [as 別名]
def pop(self, key):
        """Delete an attribute

        Arguments:
            key (str): Name of attribute to delete

        Example:
            >>> node = createNode("transform")
            >>> node["myAttr"] = Double()
            >>> node.pop("myAttr")
            >>> node.hasAttr("myAttr")
            False

        """

        del self[key] 
開發者ID:mottosso,項目名稱:cmdx,代碼行數:18,代碼來源:cmdx.py

示例12: testPyCmds

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import delete [as 別名]
def testPyCmds():

    start = time.time()

    helix = cmds.polyHelix(**HELIX_OPTS)
    pHelix = helix[0]

    size = cmds.polyEvaluate(v=True)

    for i in xrange(size):
        x = RAND.uniform(LOW, HIGH)
        attrib = '%s.vtx[%s]' % (pHelix, i)
        cmds.move(x, attrib, x=True)
    
    cmds.delete(pHelix)

    end = time.time()
    return end-start 
開發者ID:justinfx,項目名稱:tutorials,代碼行數:20,代碼來源:benchmark.py

示例13: testPyMel

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import delete [as 別名]
def testPyMel():

    start = time.time()

    helix = pm.polyHelix(**HELIX_OPTS)
    pHelix = helix[0]

    # 20020 loops
    for v in pHelix.vtx:

        # strangly, its faster to make a new vector
        # object every time, as opposed to creating it
        # once and changing the x value each time???
        vector = pm.dt.Vector(x=RAND.uniform(LOW, HIGH))
        v.translateBy(vector)
    
    pm.delete(pHelix)

    end = time.time()
    return end-start 
開發者ID:justinfx,項目名稱:tutorials,代碼行數:22,代碼來源:benchmark.py

示例14: __del__

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import delete [as 別名]
def __del__(self):
        """
        This is just an interesting example of built-in methods
        of python objects. Normally you wouldn't use __del__ like
        this to delete the maya geometry when the python object
        is deleted, but it shows a visual representation of python
        cleaning up its data.
        
        Notice what happens when you do this:
            
            s = MayaSphere(name="FirstSphere")
            s.setScale(2,2,2)
            s = MayaSphere(name="SecondSphere")
        
        The FirstSphere is deleted and replaced with SecondSphere,
        because the variable was overwritten and __del__ was called
        on the first object after reassigning.
        """
        self.delete() 
開發者ID:justinfx,項目名稱:tutorials,代碼行數:21,代碼來源:mayaSphere4.py

示例15: cleanup_intermediate_objects

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import delete [as 別名]
def cleanup_intermediate_objects(progress_controller=None):
    """Delete unused intermediate objects

    deletes any unused intermediate object in the current scene
    """
    if progress_controller is None:
        progress_controller = ProgressControllerBase()

    unused_intermediate_objects = []
    all_meshes = pm.ls(type='mesh')
    progress_controller.maximum = len(all_meshes)
    for node in all_meshes:
        if len(node.inputs()) == 0 \
           and len(node.outputs()) == 0 \
           and node.intermediateObject.get() \
           and node.referenceFile() is None:
            unused_intermediate_objects.append(node)
        progress_controller.increment()
    pm.delete(unused_intermediate_objects)
    progress_controller.complete() 
開發者ID:eoyilmaz,項目名稱:anima,代碼行數:22,代碼來源:publish.py


注:本文中的maya.cmds.delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。