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

Python cmds.rotate函数代码示例

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

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



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

示例1: addText

def addText(obj, t='A', f='Arial-Bold', c=12, rotOffset=[0, 0, 0], posOffset=[-1, 10, 0]):
    '''\n
    obj = transform to recieve text
    t   = text
    f   = font
    c   = color
    '''
    shapes = []
    text = cmds.textCurves(ch=0, f=f, t=t)
    # xform text
    pos = cmds.xform(obj, q=True, rp=True, ws=True)
    rot = cmds.xform(obj, q=True, ro=True, ws=True)
    cmds.xform(text, t=pos, ro=rot)
    # get selection
    cmds.select(text, hi=True)
    sel = cmds.ls(sl=True)
    # find shapes
    for item in sel:
        if cmds.objectType(item) != 'transform':
            # offset
            cmds.rotate(rotOffset[0], rotOffset[1], rotOffset[2], item + '.cv[*]', r=True, eu=True, p=pos)
            cmds.move(posOffset[0], posOffset[1], posOffset[2], item + '.cv[*]', r=True, ls=True, wd=True)
            # assemble
            cmds.setAttr(item + '.overrideEnabled', 1)
            cmds.setAttr(item + '.overrideColor', c)
            cmds.parent(item, obj, r=True, s=True)
            cmds.rename(item, obj + 'Shape')
    # delete left overs
    cmds.delete(text)
开发者ID:boochos,项目名称:work,代码行数:29,代码来源:atom_miscellaneous_lib.py


示例2: create_pointer

def create_pointer(m):
    if (BAXER_POINTER == True):
        # import Baxter Pointer model and use it
        try:
            cmds.loadPlugin("objExport")
        except:
            pass
        name = os.path.dirname(os.path.realpath(__file__)) + "/models/baxter_gripper.obj"
        mel.eval('file -import -type "OBJ"  -ignoreVersion -ra true -mergeNamespacesOnClash false -rpr "gripper" -options "mo=1"  -pr "%s";' \
             % name)
        try:
            mel.eval('rename "gripper_Mesh" "pointer' + str(m) + '";')
        except:
            pass
    else:
        # Create a pointer mesh that represents the robot claw
        cmds.polyCone(name="pointer" + str(m), sx=3, r=0.5, h=2)
        cmds.select("pointer" + str(m))
        cmds.rotate("180deg", 0, 0, r=True)
        cmds.move(0, -1, 0, "pointer" + str(m) + ".scalePivot", "pointer" + str(m) + ".rotatePivot")
        cmds.move(0, 1, 0, absolute=True)
        cmds.makeIdentity(apply=True, t=1, r=1, s=1)
    bbx = cmds.xform("table", q=True, bb=True, ws=True)
    cur_size = abs(bbx[3] - bbx[0])
    cmds.scale(cur_size/TABLE_SIZE, cur_size/TABLE_SIZE, cur_size/TABLE_SIZE, "pointer" + str(m), centerPivot = True)
    mel.eval('select -r pointer' + str(m) + '; sets -e -forceElement pointer_matSG;')
    mel.eval("makeCollideNCloth")
开发者ID:wenlongx,项目名称:Maya-Cloth-Simulation,代码行数:27,代码来源:main_backup.py


示例3: bestFitPlane

def bestFitPlane(ptList,upVector=(0,1,0)):
	'''
	'''
	# Initialize plane normal
	norm = OpenMaya.MVector()
	pt = OpenMaya.MVector()
	
	# Calculate plane
	for i in range(len(ptList)):
		
		prev = OpenMaya.MVector(ptList[i-1][0],ptList[i-1][1],ptList[i-1][2])
		curr = OpenMaya.MVector(ptList[i][0],ptList[i][1],ptList[i][2])
		norm += OpenMaya.MVector((prev.z + curr.z) * (prev.y - curr.y), (prev.x + curr.x) * (prev.z - curr.z), (prev.y + curr.y) *  (prev.x - curr.x))
		pt += curr
	
	# Normalize result
	norm.normalize()
	pt /= len(ptList)
	
	# Build rotation matrix
	mat = glTools.utils.matrix.buildRotation(norm,upVector,'y','x')
	rot = glTools.utils.matrix.getRotation(mat,'xyz')
	
	# Create Plane
	plane = mc.polyPlane(w=1,h=1,sx=1,sy=1,ax=[0,1,0],cuv=2,ch=False)[0]
	
	# Position Plane
	mc.rotate(rot[0],rot[1],rot[2],plane,os=True,a=True)
	mc.move(pt[0],pt[1],pt[2],plane,ws=True,a=True)
	
	# Return result
	return plane
开发者ID:RiggingDojoAdmin,项目名称:glTools,代码行数:32,代码来源:bestFitPlane.py


示例4: apply

	def apply( self, nodes=None, applySettings=None, worldSpace=False ):
		if nodes is None:
			nodes = self._nodeAttrDict.iterkeys()

		for node in nodes:
			if node in self._nodeAttrDict:
				for attr, value in self._nodeAttrDict[ node ].iteritems():
					attrpath = '%s.%s' % (node, attr)
					if objExists( attrpath ):
						setAttr( attrpath, value )

			if worldSpace:
				if node in self._nodeWorldDict:
					if cmd.objectType( node, isAType='transform' ):
						pos, rot, rotateOrder = self._nodeWorldDict[node]
						move( pos[0], pos[1], pos[2], node, ws=True, a=True, rpr=True )

						roAttrpath = '%s.ro' % node
						initialRotateOrder = getAttr( roAttrpath )
						rotateOrderMatches = initialRotateOrder == rotateOrder

						if rotateOrderMatches:
							rotate( rot[0], rot[1], rot[2], node, ws=True, a=True )
						else:
							setAttr( roAttrpath, rotateOrder )
							rotate( rot[0], rot[1], rot[2], node, ws=True, a=True )
							xform( node, ro=constants.ROTATE_ORDER_STRS[ initialRotateOrder ], p=True )
开发者ID:zethwillie,项目名称:zbw_python_tools,代码行数:27,代码来源:animClip.py


示例5: rotateJoint

 def rotateJoint( self, rotateX, rotateY, rotateZ, rotateRelative=False ):
   objs = cmds.ls( selection=True )
   try:
       pm.mel.eval( """
           setToolTo $gRotate;
           manipRotateValues Rotate;
           toolPropertyShow;
           changeToolIcon;
       """ )
   except:
       print( "switching to rotate tool (with error correction via exception handling)" )
   try:
       pm.mel.eval( """
           setToolTo $gRotate;
           manipRotateValues Rotate;
           toolPropertyShow;
           changeToolIcon;
       """ )
   except:
       print( "(...continuing error correction via exception handling)" )
   for i in objs:
       try:
           cmds.rotate( rotateX, rotateY, rotateZ , i + ".rotateAxis", os=True, relative=rotateRelative  )
       except:
           try:
               cmds.rotate( rotateX, rotateY, rotateZ , i, os=True, relative=rotateRelative  )
           except:
               print( "Couldn't rotate joint.")
               print(  traceback.format_exc(  )  )
开发者ID:joetainment,项目名称:mmmmtools,代码行数:29,代码来源:RiggerJointOrientHelper.py


示例6: makeFlake

def makeFlake(branches,radius):
    '''
    Creates a single snowflake
    
    branches : number of side branches
    radius   : radius of the snowflake
    
    A cube is created and transformed to taper with a diamond cross-section. 
    It is passed to flakeIterate to generate 1/6 of the snowflake. This branch 
    is duplicated and rotated around the centre to create the full snowflake. 
    The parts are combined, the flake is scaled and transformations are frozen. 
    The snowflake name is returned.
    '''
    name=cmds.polyCube()[0]
    cmds.rotate(45,0,0,name,r=1)
    cmds.move(0.5,0,0,name+'.vtx[0:7]',r=1)
    cmds.scale(0.7,0.2,0.1,p=[0,0,0],r=1)
    cmds.scale(1,0.7,0.7,name+'.f[4]',r=1,p=[0,0,0])
    cmds.makeIdentity(apply=True, t=1, r=1, s=1, n=0)
    partList=flakeIterate(name,7,random.uniform(30,70),0.7)
    branches=[combineParts(partList,'branch')]
    for i in range(1,6):
        branches[len(branches):]=[cmds.duplicate('branch')[0]]
        cmds.rotate(0,i*60,0,branches[-1],r=1)
    flake = combineParts(branches,'snowflake')
    scale = radius/6
    cmds.scale(scale,scale,scale,flake)
    cmds.makeIdentity(flake,apply=True, s=1, n=0)
    return flake
开发者ID:philrouse,项目名称:snowFX,代码行数:29,代码来源:makeSnowflakes.py


示例7: doPositionLocator

def doPositionLocator(locatorName,locInfo):
	"""
	>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
	DESCRIPTION:
	Position a locator with locator info generated from returnInfoForLoc

	ARGUMENTS:
	locatorName(string)
	locInfo(dict)

	RETURNS:
	success(bool)
	>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
	"""
	if search.returnObjectType(locatorName) == 'locator':
		objTrans = locInfo['position']
		objRot = locInfo['rotation']
		correctRo = locInfo['rotationOrder']

		mc.move (objTrans[0],objTrans[1],objTrans[2], locatorName)
		mc.setAttr ((locatorName+'.rotateOrder'), correctRo)

		#Rotate
		if locInfo['objectType'] == 'polyFace':
			constBuffer = mc.normalConstraint((locInfo['createdFrom']),locatorName)
			mc.delete(constBuffer[0])
		else:
			mc.rotate (objRot[0], objRot[1], objRot[2], locatorName, ws=True)

		return True
	else:
		guiFactory.warning('Not a locator.')
		return False
开发者ID:Italic-,项目名称:maya-prefs,代码行数:33,代码来源:locators.py


示例8: draw

    def draw(self):

            circle1 = cmds.circle( nr=(1, 0, 0), c=(0, 0, 0), sw=self.sweep, r=self.start_radius )
            circle2 = cmds.circle( nr=(1, 0, 0), c=(0, 0, 0), sw=self.sweep, r=self.end_radius )

            l1 = cmds.loft(circle1, circle2)

            # curves
            crv = cmds.curve(p=[(0, self.start_radius, 0), (0, self.end_radius, 0)], degree=1)
            crv2 = cmds.duplicate(crv)
            cmds.rotate(str(self.sweep) + 'deg', 0, 0, r=True)

            extrusions = []

            for e in [circle1, circle2, crv, crv2]:
                extrusions.append(cmds.extrude(e, et=0, d=(1,0,0), l=self.height))
                cmds.delete(e)

            pieces = extrusions + [l1]
            group = cmds.group(*[e[0] for e in pieces])

            cmds.move(0,0,0, group+".scalePivot",group+".rotatePivot", absolute=True)
            cmds.setKeyframe(group, attribute='rotateX', t='0sec', value=self.rotation)

            return (pieces, group)
开发者ID:chirs,项目名称:studio5,代码行数:25,代码来源:panopticon.py


示例9: 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


示例10: goToTarget

def goToTarget( first, second ):
    
    tr = cmds.xform( second, q=1, ws=1, piv=1 )[:3]
    ro = cmds.xform( second, q=1, ws=1, ro =1 )[:3]
    
    cmds.move( tr[0], tr[1], tr[2], first, ws=1 )
    cmds.rotate( ro[0], ro[1], ro[2], first, ws=1 )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:7,代码来源:cmdModel.py


示例11: bestFitPlaneCreate

def bestFitPlaneCreate(ptList,upVector=(0,1,0)):
	'''
	Create a best fit plane from a specified set of points.
	@param ptList: List of points to calculate best fit plane from.
	@type ptList: list
	@param upVector: Up vector for orientation reference.
	@type upVector: tuple or list
	'''
	
	# Calculate Plane Center and Normal
	p = glTools.tools.center.centerPoint_average(ptList)
	pt = OpenMaya.MVector(p[0],p[1],p[2])
	n = bestFitPlaneNormal(ptList)
	norm = OpenMaya.MVector(n[0],n[1],n[2])
	
	# Build rotation matrix
	mat = glTools.utils.matrix.buildRotation(norm,upVector,'y','x')
	rot = glTools.utils.matrix.getRotation(mat,'xyz')
	
	# Create Plane
	plane = mc.polyPlane(w=1,h=1,sx=1,sy=1,ax=[0,1,0],cuv=2,ch=False)[0]
	
	# Position Plane
	mc.rotate(rot[0],rot[1],rot[2],plane,os=True,a=True)
	mc.move(pt[0],pt[1],pt[2],plane,ws=True,a=True)
	
	# Return result
	return plane
开发者ID:auqeyjf,项目名称:glTools,代码行数:28,代码来源:bestFitPlane.py


示例12: a_ring

def a_ring():
	
	ring_diameter = 22 # outer diameter 
	ring_thickness = 1.5
	divit_diameter = 1.5
	divit_depth = .75
	ring_height = 4
	#divit_spacing = .5

	divits = []
	cmds.polyPipe(radius=ring_diameter/2, height=ring_height*2, thickness=ring_thickness, name='ring0')
	cmds.setAttr( 'polyPipe1.subdivisionsAxis', 20 )
	
	for x in range(0,6):
		for y in range(0,3):	
			letter = initials[x]
			symbol = letter[y]
			myName = "_c" + str(x) + str(y)
			
			if symbol == 0 :
				cmds.polyCylinder(axis=[0,0,1], radius=(divit_diameter/2), height=divit_depth, name=myName)
			elif symbol == 2:
				cmds.polyCylinder(axis=[0,0,1], radius=(divit_diameter/2), height=ring_thickness * 2.1, name=myName)
		
			if symbol != 1:
				divits.append(myName)	
				y_off = 0
				cmds.move(0,y_off,(ring_diameter/2 - divit_depth/2 + .3),myName)
				cmds.rotate(0,(x*3+y)*20,0,myName, pivot=[0,0,0])
		
	rn = 0;	
	for d in divits[:]:
		print 'ring' + str(rn) + " " + d
		cmds.polyBoolOp('ring' + str(rn), d, op=2, n='ring' + str(rn+1), )
		rn += 1
开发者ID:adervish,项目名称:Ring-Builder,代码行数:35,代码来源:wr.py


示例13: createArrow

def createArrow(name=None, thickness=0.1, length=2, vector=[1,0,0], point=[0,0,0]):
    '''
    Creates an arrow in the direction of the vector
    Example:
    arrow = createArrow(vector=[0,1,0], length=4)
    '''
    if not name:
        name = 'arrow_CTRL'
    #calc length for thickness
    ratio = length/thickness
    cyl = cmds.cylinder(radius=thickness, sections=4, heightRatio=ratio, pivot=[length/2, 0, 0], ch=0)[0]
    cone = cmds.cone(radius=thickness*2, sections=4, ch=0, pivot=(length*1.0005,0,0))[0]
    xform = cmds.createNode('transform', ss=1, name=name)
    
    shapes = []
    transforms = []
    for node in [cone,cyl]:
        shapes.append(cmds.listRelatives(node, fullPath=1, shapes=1)[0])
        transforms.append(node)
    cmds.parent(shapes, xform, r=1, s=1)
    rotateBy = cmds.angleBetween(euler=True, v1=(1,0,0), v2=vector)
    cmds.rotate(rotateBy[0], rotateBy[1], rotateBy[2], xform)
    cmds.xform(xform, t=point)
    cmds.delete(transforms)
    return xform
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:25,代码来源:utils.py


示例14: evenlyDivideCurve

def evenlyDivideCurve( curve, numDiv ):
    """ Divides a curve into numDiv.
        Assumes there are two CVs at the start and end of the curve """
    # first, move the curve to the origin
    translation = mc.xform(curve, q=True, ws=True, translation=True)
    rotation = mc.xform(curve, q=True, ws=True, rotation=True)
    mc.move(0, 0, 0, curve)
    mc.rotate(0, 0, 0, curve)

    # get the curve info node
    infoNode = getCurveInfoNode(curve)
    Knots = list( mc.getAttr( infoNode+".knots" )[0] )
    CVs = mc.getAttr( curve+".cv[*]" )
    numOrigCVs = len(CVs)
    numOrigKnots = len(Knots)

    if( not numOrigCVs == 4 ):
        print("ERROR: original curve must have exactly 4 CVs")
        return
    else:
        for p in range(0,(numDiv-numOrigCVs+4+1)):
            percent = (p-1)/float(numDiv-2)
            u = findParamAtArcPercent( curve, percent )
            if p < 2 or p >= (numDiv-numOrigCVs+3):
                CVs[p] = tuple(mc.pointOnCurve(curve, parameter=u))
            else:
                CVs.insert(p, tuple(mc.pointOnCurve(curve, parameter=u)) )
                Knots.insert(p+1, u)
    curve = mc.curve( curve,r=True, p=CVs, k=Knots)

    mc.move(translation[0], translation[1], translation[2], curve)
    mc.rotate(rotation[0], rotation[1], rotation[2], curve)
    return curve
开发者ID:jeisenma,项目名称:traceSelectionInMaya,代码行数:33,代码来源:curveUtil.py


示例15: makeRowOfStreetTrees

def makeRowOfStreetTrees(num, coor, shaders, dir):
    '''
    Makes a row with the specified number of street trees. 
    
    num: Number of street trees in the row.
    coor: A tuple with the x- and z- coordinates the center of the row of trees
          will be located at.
    shaders: A list of shaders for the tree crowns.
    dir: String which specifies if the trees should be placed along the x-axis
         (horisontal) or along the z-axis (vertical).
    On exit: The specified number of trees has been created using makeStreetTree(...),
             and placed in a row at the given coordinates. All of the trees are 
             combined and the resulting object is returned as a tuple with the 
             object name and node name.
    '''
    start =  -(num - 1)/2.0 * 2.8
    tree = makeStreetTree(shaders)
    cmds.xform(tree[0], t = (start, 0, 0), ws = True)
    for i in range(1,num):
        tree1 = makeStreetTree(shaders)
        cmds.xform(tree1[0], t = (start + i * 2.8, 0, 0), ws = True)
        tree = cmds.polyUnite(tree[0], tree1[0])
    cmds.xform(tree[0], centerPivots = True)
    if dir == "vertical":
        cmds.rotate(90, y = True)
    cmds.xform(tree[0], translation = (coor[0], 0,coor[1]), ws = True)
    return tree
开发者ID:hcbsundberg,项目名称:City_Generator,代码行数:27,代码来源:park.py


示例16: test_constrainLocators

 def test_constrainLocators(self):
     #--- Setup the scene
     startJnt = cmds.joint(n='startJnt',p=(3, 0, 0))
     endJnt = cmds.joint(n='endJnt',p=(3, 5, -2))
     upObj = cmds.joint(n='upJnt',p=(4, 0, 0))
     
     #--- Create the locators... tsk, tsk, external dependency, but why repo so much code here!?
     result = self.rig._createLocators(name='test', start=startJnt, end=endJnt, startUpObj=upObj)
     
     #--- Call method, get results
     result = self.rig._constrainLocators(locators=result)
     
     #--- Check Results
     self.test.assertConstrained('test_btmLoc_pos','test_topLoc_aim',type='aim')
     self.test.assertConstrained('test_topLoc_pos','test_btmLoc_aim',type='aim')
     self.test.assertConstrained('test_topLoc_pos','test_midLoc_aim',type='aim')
     
     self.test.assertConstrained('test_topLoc_pos','test_midLoc_pos',type='point')      
     self.test.assertConstrained('test_btmLoc_pos','test_midLoc_pos',type='point')       
     
     self.test.assertConstrained('test_topLoc_up','test_midLoc_up',type='point')       
     self.test.assertConstrained('test_btmLoc_up','test_midLoc_up',type='point')
     
     btmPos = cmds.xform('test_btmLoc_up', q=1,ws=1, rp=1)
     self.test.assertFloatListAlmostEqual(btmPos,[13,0,0])
     
     # Twist the top
     cmds.rotate(0,45,0,'test_topLoc_pos')
     topPos = cmds.xform('test_topLoc_up', q=1,ws=1, rp=1)
     midPos = cmds.xform('test_midLoc_up', q=1,ws=1, rp=1)
     avgPos = [(topPos[0]+btmPos[0])/2.0, (topPos[1]+btmPos[1])/2.0, (topPos[2]+btmPos[2])/2.0]
     self.test.assertListEqual(avgPos, midPos)
开发者ID:Mauricio3000,项目名称:MSH_Maya,代码行数:32,代码来源:test_RibbonRig.py


示例17: crystalise

def crystalise(base):
    '''
    Adds hexagonal crystals to a branch
    
    base : The branch to be crystallised
    
    A crystal is created by scaling the top and bottom rings of vertices of a 
    cylinder. The crystal is aligned to the base branch and scaled to match. 
    The crystal is duplicated, randomly distributed along the branch and scaled 
    relative to their positioning. The crystals are combined with the base branch 
    mesh and this object is returned.
    '''
    crystal=[cmds.polyCylinder(r=1,sx=6,sy=2)[0]]
    cmds.polySoftEdge(crystal[0], a=0)
    cmds.scale(0.6,0.3,0.6,crystal[0]+'.f[12:13]',r=1)
    [(tx,ty,tz)] = cmds.getAttr(base+'.translate')
    [(rx,ry,rz)] = cmds.getAttr(base+'.rotate')
    cmds.move(tx,ty,tz,crystal[0])
    cmds.rotate(rx,ry,rz,crystal[0])
    [x1,y1,z1,x2,y2,z2] = cmds.xform(base+'.vtx[0:1]',q=1,t=1,ws=1)
    baseScale = cmds.getAttr(base+'.scaleX')
    cmds.scale(0.5,0.2,0.5,crystal[0])
    length = ((x2-x1)**2+(z2-z1)**2)**0.5
    for i in range(0,6):
        crystal[len(crystal):]=[cmds.duplicate(crystal[0])[0]]
    for x in crystal:
        dist = (random.random())
        cmds.move(length*dist,0,0,x,os=1,r=1,wd=1)
        size = (1.5-dist)*(length/3)
        cmds.scale(size,size,size,x,r=1)
        cmds.rotate(0,30,0,x,r=1)
    crystal += [base]
    return combineParts(crystal,base)
开发者ID:philrouse,项目名称:snowFX,代码行数:33,代码来源:makeSnowflakes.py


示例18: loadSelectedObj

def loadSelectedObj():
    cmds.file(new=True, pm=False, force=True)
    selected = cmds.optionMenu(loadComponentsMenu, q=True, v=True)
    global furniture
    global furnitureFilePath
    path = os.path.split(furnitureFilePath)[0] + "/meshes/furniture/"
    menuItems = cmds.optionMenu(componentsMenu, q=True, itemListLong=True)
    cmds.textField(objNameInput, tx=selected.split(".")[0].split("/")[1], e=True)
    if menuItems:
        cmds.deleteUI(menuItems)
    for comp in furniture["components"] :
        if comp["src"] == selected :
            global currentComponent
            componentDef = ""

            with open(os.path.split(furnitureFilePath)[0]+"/"+comp["src"], "r") as componentFile:
                componentDef = componentFile.read()
            currentComponent = json.loads(componentDef)

            cmds.file(path + currentComponent["src"], i=True)
            for con in currentComponent["connectors"]: #for connectors in the current objects connectors
                for types in con["componentTypes"]:
                    cmds.menuItem(p=componentsMenu, label=types)
                for jnt in con["out"]:
                    loc = cmds.spaceLocator()
                    cmds.move(jnt["position"][0], jnt["position"][1], jnt["position"][2], loc)
                    cmds.scale(jnt["scale"][0], jnt["scale"][1], jnt["scale"][2], loc)
                    cmds.rotate(jnt["rotation"][0], jnt["rotation"][1], jnt["rotation"][2], loc)
    updateJson()
    selectLocators()
    cmds.textField(typeInput, tx=currentComponent["type"], e=True)
开发者ID:SweetheartSquad,项目名称:Scripts,代码行数:31,代码来源:FurnitureComponentScript.py


示例19: align

def align():
	obj1, obj2 = cmds.ls(selection=True, o=True)
	objPos = cmds.xform(obj2, q=1, ws=1, rp=1)
	objRot = cmds.xform(obj2, q=1, ro=True)
	cmds.move(objPos[0], objPos[1], objPos[2], obj1, rpr=True)
	cmds.rotate(objRot[0], objRot[1], objRot[2], obj1, r=True)
	cmds.select(obj1)
开发者ID:Kif11,项目名称:curpigeon_tools,代码行数:7,代码来源:app.py


示例20: modify_surface

def modify_surface():
    
    perlin = True
    sel = mc.ls(selection=True,long=True)
    for verts in sel:
        totalVerts = mc.polyEvaluate(verts, vertex=True)
        for number in xrange(totalVerts):
            if perlin == True:
				frequency = 1.0
				amplitude = 1.5
				octaves = 8
				for o in xrange(octaves):
				    randX = random.triangular(-0.2 , 0.0, 0.2)
				    posX = perlinNoise(randX ,0,0)
				    
				    randY = random.triangular(-0.4 , 0.0, 0.6)
				    posY = perlinNoise(0,randY,0)
				    
				    randZ = random.triangular(-0.2 , 0.0, 0.2)
				    posZ = perlinNoise(0,0,randZ)
				    
				    posX *= frequency
				    posY *= frequency
				    posZ *= frequency 
				    
				    mc.select(verts+'.vtx[{number}]'.format(number=number))
				    mc.move(posX,posY*amplitude,posZ,relative=True)
				    mc.rotate(posY*amplitude,y=True)
    mc.select(sel, replace=True)
    mc.makeIdentity(s=True, a=True, t=True,r=True)
开发者ID:PaulElmo,项目名称:Landscape_Generator,代码行数:30,代码来源:TerrainGen.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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