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


Python cmds.selectMode函数代码示例

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


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

示例1: getSelected

 def getSelected(self):
     #check to make sure a mesh is selected
     msh = cmds.ls(sl=1, o=1, type='mesh')
     if msh:
         skin = self.findRelatedSkinCluster(msh[0])
         if not skin:
             cmds.warning('Cannot find a skinCluster related to [' + msh + ']')
             return False
         self.currentSkin = skin
         self.currentMesh = msh[0]
         cmds.selectMode(component=1)
         sel = cmds.ls(sl=1, flatten = 1)
         if sel:
             msh = msh[0]
             vtx = None
             if sel != msh:
                 if sel:
                     vtx = len(sel)
                 else: vtx = 0
             self.currentVerts = sel
             
             return sel, msh, vtx, skin
     else:
         print('Please select a mesh.')
         return False
开发者ID:chrisevans3d,项目名称:skinWrangler,代码行数:25,代码来源:skinWrangler.py

示例2: rotCtrlShapeX

def rotCtrlShapeX (_isPositive):
    sel = cmds.ls(selection = True)
    for controlName in sel:
        #clear the selection
        
        cmds.select(clear = True)
        #error catching, in case something other than a  
        #curve or circle is selected
        
        cmds.selectMode(component = True)
        try:
            #selects the cvs in a nurbs curve or circle
            
            cmds.select(controlName+".cv[0:"+ str(getCVs(controlName)-1) + "]")
            
        except:
            #prints the reason for the failure
            
            print "Button not Activated: Control to Scale Must be a Curve or Circle"
        
        #does the rotation
        
        if (_isPositive == True):
            cmds.rotate(90,0,0, os = True, r = True)
        else:
            cmds.rotate(-90,0,0, os = True, r = True)
                
    #select all of the controls that were originally selected
    
    cmds.selectMode(object = True)
    cmds.select(sel)
开发者ID:jaredauty,项目名称:Rigging,代码行数:31,代码来源:RiggingControls.py

示例3: exit_tool_and_mask

def exit_tool_and_mask():
    """Exit current tool or toggle selection mode.

    When working with other contexts in maya use this function to exit the current
    context and return to selection context; if you are using base tools ('select',
    move, rotate, scale) toggle selection mode instead.

    Usage:

        tool_select()

    """
    # base_tools = ['{}SuperContext'.format(i) for i in ('select', 'move', 'rotate', 'scale')]
    if not cmds.currentCtx() == 'selectSuperContext':
        cmds.setToolTo('selectSuperContext')
    else:
        if cmds.selectMode(q=True, object=True):
            hilited = mampy.daglist(hl=True)
            if hilited:
                cmds.hilite(hilited.cmdslist(), toggle=True)
                cmds.select(hilited.cmdslist())
            else:
                cmds.selectMode(component=True)
        else:
            cmds.selectMode(object=True)
开发者ID:arubertoson,项目名称:maya-mamselect,代码行数:25,代码来源:masks.py

示例4: getFacesInFrustum

def getFacesInFrustum(container,obj):
obj = 'pHelix131'
container = 'frust_camera_frustum_geo'
# select faces in container(frustum)
allVtx = cmds.ls('{0}.vtx[:]'.format(obj),fl=True)
allIn = []
for vtx in allVtx:
  location = cmds.pointPosition(vtx,w=True)
  test = pyRayIntersect(container,location,(0,1,0))
  if(test):
      allIn.append(vtx)
inner_faces = cmds.polyListComponentConversion(allIn,fv=True,tf=True)

# select faces that facing the camera
cmds.select(obj,r=True)
cmds.selectMode(co=True)
cmds.selectType(pf=True)
cmds.setAttr('{0}.backfaceCulling'.format(obj),2)
view = OMU.M3dView.active3dView()
OM.MGlobal.selectFromScreen(0, 0, view.portWidth(), view.portHeight(), OM.MGlobal.kReplaceList)
facing_cam_faces = cmds.ls(sl=True,fl=True)

# combine both selection
all_faces = [x for x in cmds.ls(inner_faces,fl=True) if x in cmds.ls(facing_cam_faces,fl=True)]
    return all_faces
开发者ID:aaronfang,项目名称:personal_scripts,代码行数:25,代码来源:getFacesInsideFrustum.py

示例5: set_mask

def set_mask(*masks):
    """Set selection masks in maya.

    if the current mask is the given mask toggle object component mode. This is the
    default mode maya uses when switching selection masks. You will be able to continue
    selecting components but also select other objects as maya objects.

    Usage:

        set_mask('vertex', 'controlVertex', 'latticePoint')
        set_mask('meshComponents')

    """
    component_masks = {mask: True for mask in masks}
    if (cmds.selectMode(q=True, component=True) and
            any(cmds.selectType(q=True, **{mask: True}) for mask in component_masks.iterkeys())):
        cmds.selectMode(object=True)
        cmds.selectType(ocm=True, alc=False)
        cmds.selectType(ocm=True, **component_masks)
        cmds.selectType(**component_masks)
        cmds.hilite(mampy.daglist().cmdslist())
    else:
        cmds.selectMode(component=True)
        cmds.selectType(allComponents=False)
        cmds.selectType(**component_masks)
开发者ID:arubertoson,项目名称:maya-mamselect,代码行数:25,代码来源:masks.py

示例6: transfertSelection

def transfertSelection():
	"""
	This definition transfers a component selection to another object.
	
	:return: Definition succes. ( Boolean )
	"""

	selection = cmds.ls(sl=True, long=True)

	targetObject = str()
	for item in selection:
		if "." not in item:
			targetObject = item
			break

	if targetObject != "":
		cmds.hilite(targetObject, replace=True)
		cmds.selectMode(component=True)
		nextSelection = []
		for item in selection:
			if item != targetObject:
				if "." in item:
					itemTokens = item.split(".")
					nextSelection.append(targetObject + "." + itemTokens[1])
		nextSelection and cmds.select(nextSelection)
	return True
开发者ID:elanifegnirf,项目名称:Snippets,代码行数:26,代码来源:others.py

示例7: set_select_mode

 def set_select_mode(self, *types):
     """
     replace the existing selection mode (object, component etc) with the types supplied.  Cache the existing mode
     for later restore
     """
     self.select_mode = {k: cmds.selectMode(**{'q': 1, k: 1}) for k in ALL_SELECT_MODES}
     options = {k: k in types for k in ALL_SELECT_MODES}
     cmds.selectMode(**options)
开发者ID:bob-white,项目名称:mGui,代码行数:8,代码来源:ctx.py

示例8: bufMoveRelease

def bufMoveRelease():
    """release the Buf move vertex mode"""
    activePanel = cmds.getPanel(withFocus=True)
    cmds.modelEditor(activePanel, e=True, manipulators=True)
    cmds.setToolTo('moveSuperContext')
    cmds.selectPref(clickDrag=False)
    cmds.selectMode(component=True)
    cmds.selectMode(object=True)
开发者ID:manymax21,项目名称:dmptools,代码行数:8,代码来源:mayaCommands.py

示例9: reset_select_mask

 def reset_select_mask(self):
     """
     resets any selection modes set by this tool
     """
     if self.select_mode:
         cmds.selectMode(**self.select_mode)
         self.select_mode = None
     if self.select_type:
         cmds.selectType(**self.select_type)
         self.select_type = None
开发者ID:bob-white,项目名称:mGui,代码行数:10,代码来源:ctx.py

示例10: poles

 def poles(self, arg=None):
     listOne=list()
     listTwo=list()
     selObj=self.selection_grab()
     if selObj:
         pass
     else:
         print "select polygon vertices"
         return        
     if ".vtx[" in selObj[0]:
         pass
     else:
         print "You need to make a selection of vertices for this tool to interrogate."
         return                  
     cmds.selectMode(object=True)
     jim=cmds.ls (sl=True)
     cmds.select(cl=True)
     if cmds.objExists("Npoles")==True:
         cmds.delete("Npoles")
     cmds.sets(n="Npoles", co=1)
     if cmds.objExists("Epoles")==True:
         cmds.delete("Epoles")
     cmds.sets(n="Epoles", co=4)
     if cmds.objExists("starpoles")==True:
         cmds.delete("starpoles")
     cmds.sets(n="starpoles", co=7)
     for each in selObj:
         getComponent = cmds.polyInfo(each, ve=True)
         getVerts=getComponent[0].split(':')[1]
         edgeCount=re.findall(r'\d+', getVerts)
         if (len(edgeCount))==3:
             cmds.sets(each, fe='Npoles')
         elif (len(edgeCount))==5:
             cmds.sets(each, fe='Epoles')
         elif (len(edgeCount))>5:
             cmds.sets(each, fe='starpoles')
     cmds.select('starpoles', r=True, ne=True)
     cmds.pickWalk(d='Up')
     errorFound=cmds.ls(sl=True)
     if (len(errorFound))==0:
         cmds.delete("starpoles")
     cmds.select('Npoles', r=True, ne=True)
     cmds.pickWalk(d='Up')
     errorFound=cmds.ls(sl=True)
     if (len(errorFound))==0:
         cmds.delete("Npoles")
     cmds.select('Epoles', r=True, ne=True)
     cmds.pickWalk(d='Up')
     errorFound=cmds.ls(sl=True)
     if (len(errorFound))==0:
         cmds.delete("Epoles")
开发者ID:edeglau,项目名称:storage,代码行数:51,代码来源:polyChecker.py

示例11: three

	def three(self):
		if cmds.selectMode ( query = 1, object = 1):
			cmds.selectMode ( component = 1)
			self.selectionMask( 'face' )
		else: # select mode is set to component
			if self.getType(0) == 'vertex' or self.getType(0) == 'edge':
				cmds.select(self.convertSelection('face'))
				self.selectionMask( 'face' )
			else:
				if cmds.selectType( query = 1, polymeshFace = True):
					cmds.selectMode ( object = 1)
					cmds.selectType( allComponents = False )
				else:
					self.selectionMask( 'face' )
开发者ID:jricker,项目名称:JR_Maya,代码行数:14,代码来源:JR_hk_cmds.py

示例12: checkNonTriangulatable

 def checkNonTriangulatable (self, *args):        
     cmds.select(cmds.ls(type="mesh"))
 
     # to get triangles
     cmds.selectMode( co=True )
     cmds.selectType( pf=True)
     cmds.polySelectConstraint( m=3, t=8, tp=1 ) 
     
     components = cmds.ls(sl=True)
     self.updateButton(components, self.widgets['checkNonTriangulatable_button'], self.widgets['selectNonTriangulatable_button'])
     
     cmds.polySelectConstraint( tp=0 ) # turn off the face topology constraint
     cmds.selectMode( o=True )
     
     return components
开发者ID:adamfok,项目名称:afok_toolset,代码行数:15,代码来源:geo_check.py

示例13: checkTriangle

 def checkTriangle (self, *args):        
     cmds.select(cmds.ls(type="mesh"))
 
     # to get triangles
     cmds.selectMode( co=True )
     cmds.selectType( pf=True )
     cmds.polySelectConstraint( m=3, t=8, sz=1 ) 
     
     components = cmds.ls(sl=True)
     self.updateButton(components, self.widgets['checkTriangle_button'], self.widgets['selectTriangle_button'])
     
     cmds.polySelectConstraint( sz=0 ) # turn off face size constraint
     cmds.selectMode( o=True )
     
     return components
开发者ID:adamfok,项目名称:afok_toolset,代码行数:15,代码来源:geo_check.py

示例14: crack_obj

    def crack_obj(self, dag_node, crack_value, *args):
        cmds.duplicate(dag_node.name())[0]
        mesh_copy = oopmaya.DAG_Node()
        cmds.delete(mesh_copy.name(), ch=True)
        cmds.makeIdentity(mesh_copy.name(), a=True, t=True, r=True, s=True)

        dag_node.hide()
        dag_node.short_name()
        cmds.select(mesh_copy.name())
        mel.eval(
            'solidShatter( "{0}_shatter_grp", {1}, 0, 1, 0, 0, 0, 0, 3, "shapes", 0, 0);'.format(
                dag_node.short_name(), crack_value
            )
        )
        cmds.selectMode(object=True)
开发者ID:jonntd,项目名称:art_pipeline,代码行数:15,代码来源:crack_tool.py

示例15: advanceMove

def advanceMove():
    """
    enter a custom click and drag selection mode
    this is to be used with 'advanceMoveRelease'
    """
    cmds.selectMode(component=True)
    cmds.selectMode(object=True)
    sel = cmds.ls(sl=True)
    # enter the move mode and set on vertex
    if sel:
        shape = cmds.listRelatives(sel[0])
        if cmds.nodeType(shape) == 'nurbsCurve':
            try:
                cmds.delete(sel, ch=True)
                cmds.selectMode(component=True)
                activePanel = cmds.getPanel(withFocus=True)
                cmds.modelEditor(activePanel, e=True, manipulators=False)
                cmds.setToolTo('moveSuperContext')
                cmds.selectType(alc=0)
                cmds.selectType(controlVertex=1)
                cmds.selectPref(clickDrag=True)
            except:
                pass

        if cmds.nodeType(shape) == 'mesh':
            try:
                cmds.delete(sel, ch=True)
                cmds.selectMode(component=True)
                activePanel = cmds.getPanel(withFocus=True)
                cmds.modelEditor(activePanel, e=True, manipulators=False)
                cmds.setToolTo('moveSuperContext')
                cmds.selectType(alc=0)
                cmds.selectType(vertex=1)
                cmds.selectPref(clickDrag=True)
            except:
                pass
        else:
            try:
                cmds.delete(sel, ch=True)
                cmds.selectMode(component=True)
                activePanel = cmds.getPanel(withFocus=True)
                cmds.modelEditor(activePanel, e=True, manipulators=False)
                cmds.setToolTo('moveSuperContext')
                cmds.selectType(alc=0)
                cmds.selectType(vertex=1)
                cmds.selectPref(clickDrag=True)
            except:
                pass
开发者ID:shrimo,项目名称:dmptools,代码行数:48,代码来源:modeling.py


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