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

Python cmds.selectMode函数代码示例

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

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



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


示例16: one

	def one(self):
		if cmds.selectMode ( query = 1, object = 1):
			cmds.selectMode ( component = 1)
			self.selectionMask( 'vertex' )
		else: # select mode is set to component
			if self.getType(0) == 'face' or self.getType(0) == 'edge': 
			# Check to see if another component is alread selected
			# This will switch the selection over
				cmds.select(self.convertSelection('vertex'))
				self.selectionMask( 'vertex' )
			else:
				if cmds.selectType( query = 1, polymeshVertex = True):
					cmds.selectMode ( object = 1)
					cmds.selectType( allComponents = False )
				else:
					self.selectionMask( 'vertex' )
开发者ID:jricker,项目名称:JR_Maya,代码行数:16,代码来源:JR_hk_cmds.py


示例17: doneCmd

 def doneCmd(self):
     """"""
     if cmds.ls(sl=1):
         softSelectData = scData.SoftSelectionData(None, setup.getSupportTypes().keys())
         weightData = softSelectData.getWeightData()
         append = cmds.checkBox(self.appendCheck, q=1, v=1)
         
         if self._type == 'joint':
             scData.JointFn.redefineWeight(self.influence, weightData, append)
         elif self._type == 'cluster':
             scData.ClusterFn.redefineWeight(self.influence, weightData, append)
     
     # Recover select mode
     cmds.selectMode( object=True )
     cmds.select( self.influence )
     self.toggleButton()
开发者ID:DavideAlidosi,项目名称:May9,代码行数:16,代码来源:tabWeight.py


示例18: object_mode

def object_mode():
    """
    Perform a task in object mode then restores mode to previous.
    """
    try:
        object_mode = cmds.selectMode(q=True, object=True)
        if not object_mode:
            current_mode = get_active_select_mode()
            cmds.selectMode(object=True)

        object_flags = get_active_flags_in_mask(object=True)
        cmds.selectType(allObjects=True)
        yield
    finally:
        cmds.selectType(**{k: True for k in object_flags})
        if not object_mode:
            cmds.selectMode(**{current_mode: True})
开发者ID:arubertoson,项目名称:maya-mampy,代码行数:17,代码来源:decorators.py


示例19: bufMove

def bufMove():
    """enter the Buf move vertex mode"""
    cmds.selectMode(component=True)
    cmds.selectMode(object=True)
    sel = cmds.ls(sl=True)
    # enter the move mode and set on vertex
    sel = cmds.ls(sl=True)
    shape = cmds.listRelatives(sel[0])
    print cmds.nodeType(shape)
    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:manymax21,项目名称:dmptools,代码行数:46,代码来源:mayaCommands.py


示例20: component_mode

def component_mode():
    """
    Perform a task in component mode then restore to previous mode.
    """
    try:
        component_mode = cmds.selectMode(q=True, component=True)
        if not component_mode:
            current_mode = get_active_select_mode()
            cmds.selectMode(component=True)

        component_flags = get_active_flags_in_mask()
        cmds.selectType(allCoponents=True)
        yield
    finally:
        cmds.selectType(**{k: True for k in component_flags})
        if not component_mode:
            cmds.selectMode(**{current_mode: True})
开发者ID:arubertoson,项目名称:maya-mampy,代码行数:17,代码来源:decorators.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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