当前位置: 首页>>代码示例>>Python>>正文


Python cmds.select方法代码示例

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


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

示例1: dpSelectAllCtrls

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import select [as 别名]
def dpSelectAllCtrls(self, allGrpNode, *args):
        """ Select all controls using All_Grp.
        """
        ctrlsToSelectList = []
        if cmds.objExists(allGrpNode+"."+self.ctrlsAttr):
            ctrlsAttr = cmds.getAttr(allGrpNode+"."+self.ctrlsAttr)
            if ctrlsAttr:
                currentNamespace = ""
                if ":" in allGrpNode:
                    currentNamespace = allGrpNode[:allGrpNode.find(":")]
                ctrlsList = ctrlsAttr.split(";")
                if ctrlsList:
                    for ctrlName in ctrlsList:
                        if ctrlName:
                            if currentNamespace:
                                ctrlsToSelectList.append(currentNamespace+":"+ctrlName)
                            else:
                                ctrlsToSelectList.append(ctrlName)
                    cmds.select(ctrlsToSelectList)
                    print self.langDic[self.langName]["m169_selectedCtrls"]+str(ctrlsToSelectList)
            else:
                mel.eval("warning \""+self.langDic[self.langName]["e019_notFoundAllGrp"]+"\";") 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:24,代码来源:dpSelectAllControls.py

示例2: maintained_selection

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import select [as 别名]
def maintained_selection():
    """Maintain selection during context

    Example:
        >>> scene = cmds.file(new=True, force=True)
        >>> node = cmds.createNode("transform", name="Test")
        >>> cmds.select("persp")
        >>> with maintained_selection():
        ...     cmds.select("Test", replace=True)
        >>> "Test" in cmds.ls(selection=True)
        False

    """

    previous_selection = cmds.ls(selection=True)
    try:
        yield
    finally:
        if previous_selection:
            cmds.select(previous_selection,
                        replace=True,
                        noExpand=True)
        else:
            cmds.select(clear=True) 
开发者ID:getavalon,项目名称:core,代码行数:26,代码来源:lib.py

示例3: getControlUIValues

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import select [as 别名]
def getControlUIValues(self, cvName='', *args):
        """ Check and get all UI values to define variables.
            Return them in a list:
            [cvName, cvSize, cvDegree, cvDirection, cvAction]
        """
        # here we will use all info from UI elements in order to call the correct action to do:
        customName = cmds.textFieldGrp(self.dpUIinst.allUIs["controlNameTFG"], query=True, text=True)
        self.cvName = cvName
        if customName:
            self.cvName = customName
        # action
        self.cvAction = cmds.radioButtonGrp(self.dpUIinst.allUIs["controlActionRBG"], query=True, select=True)
        # degree
        degreeRBGValue = cmds.radioButtonGrp(self.dpUIinst.allUIs["degreeRBG"], query=True, select=True)
        self.cvDegree = 1 #linear
        if degreeRBGValue == 2:
            self.cvDegree = 3 #cubic
        # size
        self.cvSize = cmds.floatSliderGrp(self.dpUIinst.allUIs["controlSizeFSG"], query=True, value=True)
        # direction
        self.cvDirection = cmds.optionMenuGrp(self.dpUIinst.allUIs["directionOMG"], query=True, value=True)
        return [self.cvName, self.cvSize, self.cvDegree, self.cvDirection, self.cvAction] 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:24,代码来源:dpBaseControlClass.py

示例4: dpCopySkin

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import select [as 别名]
def dpCopySkin(self, sourceItem, destinationList, skinInfList, *args):
        """ Do the copy skin from sourceItem to destinationList using the skinInfList.
        """
        for item in destinationList:
            # get correct naming
            skinClusterName = utils.extractSuffix(item)
            if "|" in skinClusterName:
                skinClusterName = skinClusterName[skinClusterName.rfind("|")+1:]
            # create skinCluster node
            cmds.skinCluster(skinInfList, item, name=skinClusterName+"_SC", toSelectedBones=True, maximumInfluences=3, skinMethod=0)
            cmds.select(sourceItem)
            cmds.select(item, toggle=True)
            # copy skin weights from sourceItem to item node
            cmds.copySkinWeights(noMirror=True, surfaceAssociation="closestPoint", influenceAssociation=["label", "oneToOne", "closestJoint"])
            # log result
            print self.langDic[self.langName]['i083_copiedSkin'], sourceItem, item 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:18,代码来源:dpCopySkin.py

示例5: dpIsolate

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import select [as 别名]
def dpIsolate(self, attrName, nodeList, *args):
        """ Function to run isolate setup.
        """
        # get father zero out transform node
        zeroGrp = cmds.listRelatives(nodeList[2], allParents=True, type="transform")[0]
        # create parent constraint
        pConst = cmds.parentConstraint(nodeList[0], nodeList[1], zeroGrp, maintainOffset=True, skipTranslate=["x", "y", "z"])[0]
        # add isolate attribute to selected control
        cmds.addAttr(nodeList[2], longName=attrName, defaultValue=1.0, minValue=0, maxValue=1, keyable=True) 
        # create reverse node
        reverseNode = cmds.createNode('reverse', name=nodeList[2]+"_"+attrName.capitalize()+"_Rev")
        # do isolate connections
        cmds.connectAttr(nodeList[2]+"."+attrName, pConst+"."+nodeList[0]+"W0", force=True)
        cmds.connectAttr(nodeList[2]+"."+attrName, reverseNode+".inputX", force=True)
        cmds.connectAttr(reverseNode+".outputX", pConst+"."+nodeList[1]+"W1", force=True)
        cmds.select(nodeList[2]) 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:18,代码来源:dpIsolate.py

示例6: renameShape

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import select [as 别名]
def renameShape(self, transformList, *args):
        """Find shapes, rename them to Shapes and return the results.
        """
        resultList = []
        for transform in transformList:
            # list all children shapes:
            childShapeList = cmds.listRelatives(transform, shapes=True, children=True, fullPath=True)
            if childShapeList:
                # verify if there is only one shape and return it renamed:
                if len(childShapeList) == 1:
                    shape = cmds.rename(childShapeList[0], transform+"Shape")
                    cmds.select(clear=True)
                    resultList.append(shape)
                # else rename and return one list of renamed shapes:
                elif len(childShapeList) > 1:
                    for i, child in enumerate(childShapeList):
                        shape = cmds.rename(child, transform+str(i)+"Shape")
                        resultList.append(shape)
                    cmds.select(clear=True)
            else:
                print "There are not children shape to rename inside of:", transform
        return resultList 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:24,代码来源:dpControls.py

示例7: convertToBezierCurve

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import select [as 别名]
def convertToBezierCurve(curve):
    """
    Check if the parsed curve is a bezier curve, if this is not the case
    convert the curve to a bezier curve.
    
    :param str curve: Name of curve
    """
    # get shape
    curveShape = cmds.listRelatives(curve, s=True)[0]

    # convert to bezier curve
    if cmds.nodeType(curveShape) == "bezierCurve":
        return
        
    cmds.select(curve)
    cmds.nurbsCurveToBezier()


# ---------------------------------------------------------------------------- 
开发者ID:robertjoosten,项目名称:maya-spline-ik,代码行数:21,代码来源:curve.py

示例8: setUp

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import select [as 别名]
def setUp(self):

        # create new scene & load plugin
        cmds.file(new=True, f=True)
        plugin = 'spore'
        self.load_plugin('spore')

        # setup a simple scene
        plane = cmds.polyPlane()
        cone = cmds.polyCone()
        cmds.select(plane[0], cone[0])
        spore = cmds.spore()

        # get new instance data object and connect it to the current node
        self.node = node_utils.get_mobject_from_name(spore[0])
        self.instance_data = instance_data.InstanceData(self.node)
        self.instance_data.initialize_data() 
开发者ID:wiremas,项目名称:spore,代码行数:19,代码来源:test_instance_data.py

示例9: setUp

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import select [as 别名]
def setUp(self):

        # create new scene & load plugin
        cmds.file(new=True, f=True)
        plugin = 'spore'
        self.load_plugin('spore')

        # setup a simple scene
        plane = cmds.polyPlane(sx=10, sy=10, w=10, h=10)
        #  cone = cmds.polyCone()
        #  cmds.select(plane[0], cone[0])
        #  spore = cmds.spore()

        # get new instance data object and connect it to the current node
        #  self.node = node_utils.get_mobject_from_name(spore[0])
        self.plane = node_utils.get_dagpath_from_name(plane[0])
        self.geo_cache = geo_cache.GeoCache() 
开发者ID:wiremas,项目名称:spore,代码行数:19,代码来源:test_geo_cache.py

示例10: item_clicked

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import select [as 别名]
def item_clicked(self, widget, event):

        item_name = widget.long_name
        item_state = widget.is_selected
        if cmds.objExists(item_name):

            is_modified = event.modifiers() == Qt.ControlModifier
            if not is_modified:
                cmds.select(clear=True)

            for geo_item, spore_items in self.wdg_tree.iteritems():
                for spore_item in spore_items:
                    if is_modified \
                    and spore_item.is_selected:
                        cmds.select(spore_item.long_name, add=True)
                    else:
                        spore_item.deselect()
                        cmds.select(spore_item.long_name, deselect=True)

            widget.set_select(item_state)
            if not is_modified:
                cmds.select(item_name)

        else:
            self.refresh_spore() 
开发者ID:wiremas,项目名称:spore,代码行数:27,代码来源:manager.py

示例11: context_request

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import select [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

示例12: move_center_each_object

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import select [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

示例13: convert_edge_lock

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import select [as 别名]
def convert_edge_lock():
    sel = cmds.ls(sl=True, l=True)
    meshes = common.search_polygon_mesh(sel, serchChildeNode=False)
    if not meshes:
        return
    for mesh in meshes:
        d_mesh = cmds.duplicate(mesh, rr=True)[0]
        modeling.setSoftEdge(mesh, angle=120)
        cmds.transferAttributes(d_mesh, mesh,
                                flipUVs=0, 
                                transferPositions=0, 
                                transferUVs=0, 
                                sourceUvSpace="map1", 
                                searchMethod=3, 
                                transferNormals=1, 
                                transferColors=0, 
                                targetUvSpace="map1", 
                                colorBorders=1, 
                                sampleSpace=5)
        freeze.main(mesh)
        cmds.polyNormalPerVertex(mesh, ufn=True)
        cmds.delete(d_mesh)
    cmds.select(meshes) 
开发者ID:ShikouYamaue,项目名称:SISideBar,代码行数:25,代码来源:normal.py

示例14: applyDeltaMush

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import select [as 别名]
def applyDeltaMush(smooth=1.0, iterations=20, useBuildIn=False):
    """
    Args:
      smooth (float)
      iterations (int)
    """
    sel = cmds.ls(sl=1, ap=1)

    if not sel:
        om.MGlobal.displayError("Please select a few meshes.")
        return

    if useBuildIn:
        cmds.deltaMush(sel, si=iterations, ss=smooth, pbv=0)
    else:
        cmds.wbDeltaMush(sel, si=iterations, ss=smooth, pbv=0)

#---------------------------------------------------------------------- 
开发者ID:WebberHuang,项目名称:DeformationLearningSolver,代码行数:20,代码来源:miscFunc.py

示例15: getDagPathComponents

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import select [as 别名]
def getDagPathComponents(compList):
    """
    Args:
      compList (list)

    Returns:
      MObject
    """

    currSel = cmds.ls(sl=1, l=1)
    cmds.select(compList, r=1)
    selList = om.MSelectionList()
    om.MGlobal.getActiveSelectionList(selList)
    dagPath = om.MDagPath()
    components = om.MObject()
    selList.getDagPath(0, dagPath, components)
    cmds.select(cl=1)
    try:
        cmds.select(currSel, r=1)
    except:
        pass
    return dagPath, components

#---------------------------------------------------------------------- 
开发者ID:WebberHuang,项目名称:DeformationLearningSolver,代码行数:26,代码来源:utils.py


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