当前位置: 首页>>代码示例>>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;未经允许,请勿转载。