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


Python cmds.pickWalk函数代码示例

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


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

示例1: badname

 def badname(self):        
     cmds.select(d=True)
     if cmds.objExists("badNames")==True:
         cmds.delete("badNames")
     cmds.sets(n="badNames", co=5)
     
     
     if cmds.objExists('pSphere*'):
         cmds.select ('pSphere*', hierarchy=False, add=True)    
         cmds.sets( fe="badNames")
         
     if cmds.objExists('curve*'):
         cmds.select ('curve*', hierarchy=False, add=True)
         cmds.sets( fe="badNames")
     
         
     if cmds.objExists('polySurface*'):
         cmds.select ('polySurface*', hierarchy=False, add=True)
         cmds.sets( fe="badNames")
     
 
     if cmds.objExists('badNames'):
         cmds.select('badNames', r=True, ne=True)
         shoo=cmds.ls(sl=True)
         cmds.pickWalk (d='up')
         pete=cmds.ls(sl=True)  
         if (len(pete))>0:
             print("you must give the selected object(s) descriptive names.")
         else:
             cmds.select(cl=True)
             print(" no bad names exists.")
         cmds.delete(shoo)
开发者ID:edeglau,项目名称:storage,代码行数:32,代码来源:renamer.py

示例2: create_Joints

def create_Joints():
    src_joint = cmds.ls(sl=True)
    cmds.select(hi=True)
    findselAmt = cmds.ls(sl=True)
    if (len(findselAmt)<2):
        cmds.warning("select atleast 2 joints")
    else:
        noOfjoints = cmds.textField("Number",query=True,text=True)
        num_jnts = float(noOfjoints)
        cmds.pickWalk(d="down")
        childjnt = cmds.ls(sl=True)
        cmds.select(childjnt)
        pos_child = cmds.xform(childjnt[0],query=True,translation=True,ws=True)
        pos_start = cmds.xform(src_joint[0],query=True,translation=True,ws=True)
        splitPos_x = pos_child[0] - pos_start[0]
        splitPos_y = pos_child[1] - pos_start[1]
        splitPos_z = pos_child[2] - pos_start[2]
        splitPos = [(splitPos_x/num_jnts),(splitPos_y/num_jnts),(splitPos_z/num_jnts)]
        num_joints = int(num_jnts)
        cmds.pickWalk(d="up")
        if(noOfjoints<2):
            cmds.warning("Must create atleast 1 segment")
        else:
            for jnt in range(1,num_joints):
                newJoint = cmds.insertJoint(src_joint)
                newJoint = cmds.rename(newJoint, "tempName"+ str(jnt))
                cmds.move(splitPos[0],splitPos[1],splitPos[2],newJoint+".scalePivot",newJoint+".rotatePivot",ws=True,r=True)
                src_joint = newJoint
                cmds. select(newJoint)
开发者ID:romadave91,项目名称:MyScripts,代码行数:29,代码来源:RigToolKit.py

示例3: badname

    def badname(self, arg=None):        
        cmds.select(d=True)
        if cmds.objExists("badNames")==True:
            cmds.delete("badNames")
        cmds.sets(n="badNames", co=5)
        for each in badNameList:
            if cmds.objExists(each+'*'):
                cmds.select (each+'*', hierarchy=False, add=True)    
                cmds.sets( fe="badNames")
                              
#        if cmds.objExists('pSphere*'):
#            cmds.select ('pSphere*', hierarchy=False, add=True)    
#            cmds.sets( fe="badNames")
#            
#        if cmds.objExists('curve*'):
#            cmds.select ('curve*', hierarchy=False, add=True)
#            cmds.sets( fe="badNames")
#        
#            
#        if cmds.objExists('polySurface*'):
#            cmds.select ('polySurface*', hierarchy=False, add=True)
#            cmds.sets( fe="badNames")
        
        if cmds.objExists('badNames'):
            cmds.select('badNames', r=True, ne=True)
            shoo=cmds.ls(sl=True)
            cmds.pickWalk (d='up')
            pete=cmds.ls(sl=True)  
            if (len(pete))>0:
                print("The selected object(s) don't have very descriptive names.")
            else:
                cmds.select(cl=True)
                print(" no bad names exists.")
            cmds.delete(shoo)
开发者ID:edeglau,项目名称:storage,代码行数:34,代码来源:renamer.py

示例4: and

def	splitJoint	():
	_newBoneNum	= cmds.intSlider	('boneNum',	query	= 1,	value	= 1)
	_bone		= cmds.ls	(selection	= 1,	long	= 1)
	_childJoint	= cmds.listRelatives	(children	= 1)

	if (len (_bone)	> 0) and (type(_childJoint) is not NoneType) \
	and (cmds.nodeType(_bone[0]) == 'joint') and (cmds.nodeType(_childJoint) == 'joint'):
		
		_childTranslateX	=	cmds.getAttr	(	_childJoint[0]	+	'.translateX'	)
		_childTranslateY	=	cmds.getAttr	(	_childJoint[0]	+	'.translateY'	)
		_childTranslateZ	=	cmds.getAttr	(	_childJoint[0]	+	'.translateZ'	)

		_newX				=	_childTranslateX	/	(	_newBoneNum	+	1.0	)
		_newY				=	_childTranslateY	/	(	_newBoneNum	+	1.0	)
		_newZ				=	_childTranslateZ	/	(	_newBoneNum	+	1.0	)

		for	_k	in	range	(	_newBoneNum):
			_bone	=	cmds.insertJoint	(	_bone	)
			cmds.toggle	(localAxis		=1)
			cmds.xform	(_bone	+	'.scalePivot',	_bone	+	'.rotatePivot',
						relative	=	1,	objectSpace	=	1,	translation	=	(	_newX,	_newY,	_newZ	)	)

		for	_k	in	range	(	_newBoneNum	):	cmds.pickWalk	(	direction	=	'up'	)
	
	else:	raiseWarning	(	'select a bone! You can do it!'	)
开发者ID:danielforgacs,项目名称:code-dump,代码行数:25,代码来源:ford_riggingAid.py

示例5: singlePoly

 def singlePoly(self, arg=None):
     selObj=self.selection_grab()
     if selObj:
         pass
     else:
         print "select a polygon object"
         return    
     if "." in selObj[0]:
         print "You need to select a polygon object to interogate.(check that you are not in component mode)"
         return     
     else:
         pass 
     cmds.select(cl=True)
     if cmds.objExists("PolyIssues")==True:
         cmds.delete("PolyIssues")
     cmds.sets(n="PolyIssues", co=5)
     cmds.select(selObj)
     errorFound=cmds.polyInfo(selObj, lf=True, nme=True, nmv=True )
     cmds.select (errorFound)
     cmds.ConvertSelectionToVertices(errorFound)
     if errorFound>0:
         print "Polygon error found"
         cmds.sets( fe='PolyIssues')
     cmds.select('PolyIssues', r=True, ne=True)
     cmds.pickWalk(d='Up')
     errorFound=cmds.ls(sl=True)
     if (len(errorFound))==0:
         cmds.delete("PolyIssues")
开发者ID:edeglau,项目名称:storage,代码行数:28,代码来源:polyChecker.py

示例6: ctrl_orb

def ctrl_orb():
	mel.eval('circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 1 -d 3 -ut 0 -tol 0.01 -s 8 -ch 1')
	base_circle = cmds.ls(sl=True)
	
	cmds.duplicate(rr=True)
	dup1 = cmds.ls(sl=True)
	cmds.setAttr(dup1[0] + '.rotateX', 90)
	
	cmds.duplicate(rr=True)
	dup2 = cmds.ls(sl=True)
	cmds.setAttr(dup2[0] + '.rotateY', 90)

	cmds.duplicate(rr=True)
	dup3 = cmds.ls(sl=True)
	cmds.setAttr(dup3[0] + '.rotateY', 45)
	print 'Curves have been created and positioned.'
	
	cmds.select(base_circle, dup1, dup2, dup3)
	cmds.makeIdentity(apply=True, t=1, r=1, s=1, n=0)
	print 'Freezing transforms on curves.'

	cmds.select(dup1, dup2, dup3, r=True)
	curves = cmds.ls(sl=True)
	cmds.pickWalk(d='Down')
	cmds.select(base_circle, add=True)
	cmds.parent(r=True, s=True)
	print 'Curve list has been parented into single curve.'
	
	cmds.select(curves, r=True)
	mel.eval('doDelete')
	print 'Unused groups have been deleted.'
	
	cmds.select(base_circle)
	mel.eval('CenterPivot')
	print ('End result curve have been selected and its pivot has been centered.')
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:35,代码来源:ctrl_crv_tool.py

示例7: ctrl_pointer

def ctrl_pointer():
	mel.eval('curve -d 1 -p -1 0 0 -p 1 0 0 -p 1 1 0 -p 1 2 0 -p 1 3 0 -p 2 3 0 -p 0 5 0 -p -2 3 0 -p -1 3 0 -p -1 2 0 -p -1 1 0 -p -1 0 0 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -k 11')
	ctrl = cmds.ls(sl=True)
	cmds.duplicate(rr=True)
	ctrl2 = cmds.ls(sl=True)
	cmds.setAttr(ctrl2[0] + '.rotateY', 90)
	print 'Curves have been positioned.'
	
	cmds.makeIdentity(apply=True, t=1, r=1, s=1, n=0)
	print 'Freezing transforms on curves.'
	
	cmds.select(ctrl, r=True)
	cmds.pickWalk(d='Down')
	cmds.select(ctrl2, add=True)
	cmds.parent(r=True, s=True)
	print 'Curves have been parented into single curve.'
	
	
	cmds.select(ctrl, r=True)
	mel.eval('doDelete')
	print 'Unsuded groups have been deleted.'
	
	cmds.select(ctrl2)
	mel.eval('CenterPivot')
	print 'Curve has been selected and its pivot has been centered.'
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:25,代码来源:ctrl_crv_tool.py

示例8: ctrl_text

def ctrl_text(var):
	"""
	Creates letters and text made from multipe curves.
	"""
	cmds.textCurves(ch=0, f='Times New Roman', t=var)
	cmds.ungroup()
	cmds.ungroup()
	print 'Curves have been ungrouped.'
	
	curves = cmds.ls(sl=True)
	cmds.makeIdentity(apply=True, t=1, r=1, s=1, n=0)
	print 'Freezing transforms on curves.'
	
	cmds.pickWalk(d='Down')
	shapes = cmds.ls(sl=True)
	print 'Creating a list of curve shape nodes.'
	
	
	parent_shapes = shapes[1:]
	delete_curves = curves[1:]
	print 'Slicing lists for parenting and deleting purposes.'
	
	cmds.select(parent_shapes, r=True)
	cmds.select(curves[0], add=True)
	cmds.parent(r=True, s=True)
	print 'Curve list has been parented into single curve.'
	
	cmds.select(delete_curves, r=True)
	mel.eval('doDelete')
	print 'Unused groups have been deleted.'
	
	cmds.select(curves[0])
	mel.eval('CenterPivot')
	print ('End result curve have been selected and its pivot has been centered.')
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:34,代码来源:ctrl_crv_tool.py

示例9: ctrl_move_all

def ctrl_move_all():
	base_circle = mel.eval('circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 1.5 -d 3 -ut 0 -tol 0.01 -s 8 -ch 0')
	arrow_list = []
	arrow1 = mel.eval('curve -d 1 -p 1.75625 0 0.115973 -p 1.75625 0 -0.170979 -p 2.114939 0 -0.170979 -p 2.114939 0 -0.314454 -p 2.473628 0 -0.0275029 -p 2.114939 0 0.259448 -p 2.114939 0 0.115973 -p 1.75625 0 0.115973 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7')
	arrow2 = mel.eval('curve -d 1 -p 0.143476 0 -1.783753 -p 0.143476 0 -2.142442 -p 0.286951 0 -2.142442 -p 0 0 -2.501131 -p -0.286951 0 -2.142442 -p -0.143476 0 -2.142442 -p -0.143476 0 -1.783753 -p 0.143476 0 -1.783753 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7')
	arrow3 = mel.eval('curve -d 1 -p -1.75625 0 -0.170979 -p -2.114939 0 -0.170979 -p -2.114939 0 -0.314454 -p -2.473628 0 -0.0275029 -p -2.114939 0 0.259448 -p -2.114939 0 0.115973 -p -1.75625 0 0.115973 -p -1.75625 0 -0.170979 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7')
	arrow4 = mel.eval('curve -d 1 -p -0.143476 0 1.728747 -p -0.143476 0 2.087436 -p -0.286951 0 2.087436 -p 0 0 2.446125 -p 0.286951 0 2.087436 -p 0.143476 0 2.087436 -p 0.143476 0 1.728747 -p -0.143476 0 1.728747 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7')
	arrow_list.append(arrow1)
	arrow_list.append(arrow2)
	arrow_list.append(arrow3)
	arrow_list.append(arrow4)
	print 'Curves have been created and positioned.'
	
	cmds.select(arrow_list)
	cmds.pickWalk(d='Down')
	cmds.select(base_circle, add=True)
	cmds.parent(r=True, s=True)
	print 'Curve list has been parented into single curve.'
	
	cmds.select(arrow_list, r=True)
	mel.eval('doDelete')
	print 'Unused groups have been deleted.'
	
	cmds.select(base_circle)
	mel.eval('CenterPivot')
	print ('End result curve have been selected and its pivot has been centered.')	
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:26,代码来源:ctrl_crv_tool.py

示例10: asignMaterial

def asignMaterial(*args):
    cmds.pickWalk( d = "down" )
    sel = cmds.ls( sl = True )
    for i in sel:
        mat = cmds.getAttr(i + '.mtoa_constant_mMat')
        matSG = mat + 'SG'
        asign = cmds.sets(i, e =1, forceElement = matSG)
开发者ID:Quazo,项目名称:breakingpoint,代码行数:7,代码来源:aiShaderManager.py

示例11:

def	postProcessControl	(	_control,	_function,	_controlled	):	# <<< string, string, list
	lockHideAttributes	(	_control	)

	if (cmds.objExists('anim_control_set') == False):	cmds.createNode('objectSet',name='anim_control_set',skipSelect=True)

	cmds.sets	(	_control,	addElement	=	'anim_control_set'	)
	cmds.toggle	(	localAxis				=	1	)

	if	len	(	_controlled	)	==	0:
		_control	=	cmds.rename	(	'_'	+	_function	+	'_control'	)
		_control	=	cmds.group	( 	world	=	1,	name	=	'_'	+	_function	+	'_control_offSet'	)
		cmds.move					(	0,	0,	0,	_control	+	'.rotatePivot',	_control	+	'.scalePivot'	)

		lockHideAttributes	(	_control	)

	else:
		_k				=	_controlled[0].rfind	(	'|'	)
		_control		=	_controlled[0][_k+1:]
		cmds.rename		(	_control	+	'_'	+	_function	+	'_control'	)
		_control		=	cmds.group	(	world	=	1,	name	=	_control	+	'_'	+ _function	+	'_control_offSet'	)
		cmds.move			(	0, 0, 0, _control + '.rotatePivot', _control + '.scalePivot' )

		lockHideAttributes	(	_control	)

		cmds.select		(	_controlled[0],	toggle	=	True	)
		cmds.parent		()
		cmds.xform		(	translation	=	(	0,	0,	0	),	rotation	=	(	0,	0,	0	)	)
		cmds.parent		(	world		= 	1	)
	
	cmds.pickWalk	(	direction	=	"down"	)
开发者ID:danielforgacs,项目名称:code-dump,代码行数:30,代码来源:ford_riggingAid.py

示例12: len

def	splitJoint	():
	_newBoneNum			=	cmds.intSlider	(	'boneNum',	query	=	1,	value	=	1	)
	_bone				=	cmds.ls	(	selection	=	1,	long	=	1	)
	_childJoint			=	cmds.listRelatives	(	children	=	1	)

	if	len(_bone) > 0:
		if	type(_childJoint)	is	not	NoneType:
#			print; print; print '>>> SO FAR SO GOOD'; print # <<< DEBUG ONLY LINE, CAN BE DELETED <<< ##########
			_bone				=	_bone[0]
			_childJoint			=	_childJoint[0]

			_childTranslateX	=	cmds.getAttr	(	_childJoint	+	'.translateX'	)
			_childTranslateY	=	cmds.getAttr	(	_childJoint	+	'.translateY'	)
			_childTranslateZ	=	cmds.getAttr	(	_childJoint	+	'.translateZ'	)

			_newX				=	_childTranslateX	/	(	_newBoneNum	+	1.0	)
			_newY				=	_childTranslateY	/	(	_newBoneNum	+	1.0	)
			_newZ				=	_childTranslateZ	/	(	_newBoneNum	+	1.0	)

			for	_k	in	range	(	_newBoneNum	):
				_bone	=	cmds.insertJoint	(	_bone	)
				cmds.toggle	(	localAxis		=	1	)
				cmds.xform	(	_bone	+	'.scalePivot',	_bone	+	'.rotatePivot',
								relative	=	1,	objectSpace	=	1,	translation	=	(	_newX,	_newY,	_newZ	)	)

			for	_k	in	range	(	_newBoneNum	):	cmds.pickWalk	(	direction	=	'up'	)
		
		else:	raiseWarning	(	'select the bone, not a single joint'	)
	else:	raiseWarning	(	'select the bone'	)
开发者ID:danielforgacs,项目名称:code-dump,代码行数:29,代码来源:ford_riggingAid_lastOK.py

示例13: __init__

    def __init__(self):
        # define camera
        print "[define camera class]"
        _selection = cmds.ls(selection=True)
        _panel = cmds.getPanel(withFocus=True)
        _typeOfPanel = mm.eval("getPanel -typeOf " + _panel)
        _cameraSelected = False

        # check for selected camera
        print "[checking selection for camera]"
        if len(_selection) != 0:
            # selection not empty
            _camera = _selection[0]
            _cameraShape = cmds.pickWalk(direction="down")[0]

            if cmds.nodeType(_cameraShape) != "camera":
                # selection is not a camera
                print "[selecton or first leselcted object is not camera]"

            else:
                # selection is a camera
                if _camera == _cameraShape:
                    # if cameraShape is selected get camera transform
                    _camera = cmds.pickWalk(direction="up")[0]

                _cameraSelected = True

        else:
            # no selection
            print "[no selection. checking active panel for camera.]"
            if _typeOfPanel == "modelPanel":
                # panel is modeling panel with camera
                _camera = cmds.modelPanel(_panel, query=True, camera=True)
                cmds.select(_camera)
                _cameraShape = cmds.pickWalk(direction="down")[0]
                _cameraSelected = True

            else:
                # no modeling panel with camera is selected
                print "[active panel is not modeling panel with camera]"

        if _cameraSelected:
            # camera is extracted, get properties
            print "[camera OK]"
            print "-> camera: " + _camera
            print "-> cameraShape: " + _cameraShape

            self.camera = _camera
            self.cameraShape = _cameraShape
            self.aperture_h = cmds.camera(_camera, query=True, horizontalFilmAperture=True)
            self.aperture_v = cmds.camera(_camera, query=True, verticalFilmAperture=True)
            self.fieldOfView_h = cmds.camera(_camera, query=True, horizontalFieldOfView=True)
            self.fieldOfView_v = cmds.camera(_camera, query=True, verticalFieldOfView=True)
            self.filmOffset_h = cmds.camera(_camera, query=True, horizontalFilmOffset=True)
            self.filmOffset_v = cmds.camera(_camera, query=True, verticalFilmOffset=True)
            self.overscan = cmds.camera(_camera, query=True, overscan=True)
        else:
            # no camera
            print "[could not extract camera]"
开发者ID:danielforgacs,项目名称:code-dump,代码行数:59,代码来源:ford_Maya_To_Houdini.py

示例14: connectShader

 def connectShader(self, selectedObject, nameShader):
     """ This method connects the shader to an object. """
     
     mc.select( selectedObject );
     mc.pickWalk( d='down' );
     selectedObjectList = mc.ls( sl=True );
     mc.sets( selectedObjectList[0], edit=True, forceElement=nameShader + 'SG' );
     mc.select( clear=True )
开发者ID:remusvrm,项目名称:plugins,代码行数:8,代码来源:Shader_v01.py

示例15: getMaterial

def getMaterial(*args):
    cmds.pickWalk( d = "down" )
    sel = cmds.ls(sl=1,long=1)
        
    for i in sel:
        shadingGroup = cmds.listConnections(i ,type='shadingEngine')
        mat = (shadingGroup[0])[:-2]
        cmds.setAttr( i + '.mtoa_constant_mMat', mat, type = 'string')
开发者ID:Quazo,项目名称:breakingpoint,代码行数:8,代码来源:aiShaderManager.py


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