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

Python cmds.curve函数代码示例

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

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



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

示例1: maya_move

def maya_move(angular_velocity, time_step):
            
    objects = cmds.ls(sl=True)
    if objects == []:
        print('* Please select at least an object.')
        return
        
    trajectory = cmds.ls('trajectory')
    
    for i, o in enumerate(objects):
        x = cmds.getAttr(o + '.translateX')
        y = cmds.getAttr(o + '.translateY')
        z = cmds.getAttr(o + '.translateZ')
    
        loc = [x, y, z]
        state = make_state(loc)
                
        state = simulate_circle(state, angular_velocity, time_step)
        
        old_loc = loc
        loc = get_location(state)
        
        cmds.select(o)
        cmds.move(loc[0], loc[1], loc[2])
        
        # draw trajectory for the first object
        if i == 0:
            if trajectory == []:
                cv = cmds.curve(point=[old_loc, loc], degree=1)                
                cmds.rename(cv, 'trajectory')
            else:
                cmds.curve('trajectory', point=[loc], degree=1, append=True)
        
    # keep all objects selected
    cmds.select(objects)
开发者ID:HerrR,项目名称:CS3242-3D-Modeling-and-Animation,代码行数:35,代码来源:circle_empty.py


示例2: createCurveaBasedOnLocator

def createCurveaBasedOnLocator( prevLoc, loc, baseName, hrsSys ):
	leastSquaresMod = mn.createNode( 'leastSquaresModifier' )
	origCurv = crv.Curve( mc.curve( d = 1, ep = [prevLoc.worldPosition, loc.worldPosition] ) )
	index = mm.eval( 'getNextFreeMultiIndex( "'+ hrsSys.name +'.inputHair", 0 )' )
	origCurv.name = 'spiderWeb_base_'+ baseName + '_' + str( index ) + '_CRV'
	mc.rebuildCurve( origCurv.name, rpo = 1, rt = 0, end = 1, kr = 0, kcp = 1, kep = 1, kt =0, s= 4, d = 1, tol = 0.01  )
	origCurv.a.intermediateObject.v = 1
	controledCurv = origCurv.duplicate()
	origCurv.shape.attr( 'worldSpace[0]' ) >> leastSquaresMod.a.inputNurbsObject
	prevLoc.attr( 'worldPosition[0]')      >> leastSquaresMod.attr( 'pointConstraint[0].pointPositionXYZ' )
	leastSquaresMod.attr( 'pointConstraint[0].pointConstraintU' ).v = 0
	loc.attr( 'worldPosition[0]')          >> leastSquaresMod.attr( 'pointConstraint[1].pointPositionXYZ' )
	leastSquaresMod.attr( 'pointConstraint[1].pointConstraintU' ).v = 1
	leastSquaresMod.a.outputNurbsObject    >> controledCurv.shape.a.create
	controledCurv.shape.attr( 'worldMatrix[0]' ) >> leastSquaresMod.a.worldSpaceToObjectSpace
	fol = mn.createNode( 'follicle' )
	fol.a.restPose.v = 1
	fol.a.startDirection.v = 1
	fol.a.pointLock.v = 3
	fol.a.degree.v = 3
	fol.a.sampleDensity.v = 3
	fol.a.outHair >> hrsSys.attr( 'inputHair[' + str( index ) + ']' )
	hrsSys.attr( 'outputHair[' + str( index ) + ']' ) >> fol.a.currentPosition
	controledCurv.shape.attr( 'worldSpace[0]' ) >> fol.a.startPosition
	curv = crv.Curve( mc.curve( d = 3, ep = [prevLoc.worldPosition, loc.worldPosition] ) )
	curv.name = 'spiderWeb_' + baseName + '_' + str( index ) + '_CRV'
	fol.a.outCurve >> curv.a.create
	folPar = fol.parent
	folPar.name = 'spiderWeb_' + baseName + '_' + str( index ) + '_FOL'
	return curv, folPar
开发者ID:skarone,项目名称:PipeL,代码行数:30,代码来源:spiderWebCreator.py


示例3: createPoleVector

    def createPoleVector(self, prefix=None, distanceScale=2, verbose=False):
        print 'Building pole vector...'

        if prefix is None:
            prefix = self.prefix

        # Create Joint Vectors
        shoulderIkPos = cmds.xform(self.shoulder, q=True, ws=True, t=True)
        shoulderIkVec = OpenMaya.MVector(shoulderIkPos[0], shoulderIkPos[1], shoulderIkPos[2])
        elbowIkPos = cmds.xform(self.elbow, q=True, ws=True, t=True)
        elbowIkVec = OpenMaya.MVector(elbowIkPos[0], elbowIkPos[1], elbowIkPos[2])
        wristIkPos = cmds.xform(self.wrist, q=True, ws=True, t=True)
        wristIkVec = OpenMaya.MVector(wristIkPos[0], wristIkPos[1], wristIkPos[2])

        # Transpose vectors to correct pole vector translation point
        bisectorVec = (shoulderIkVec * 0.5) + (wristIkVec * 0.5)
        transposedVec = (elbowIkVec * distanceScale) - (bisectorVec * distanceScale)
        ikChainPoleVec = bisectorVec + transposedVec

        # Create a pole vector
        poleVecCon = self.utils.createBoxControl('%selbowPV' % self.prefix, 0.125)
        poleVecPos = [ikChainPoleVec.x, ikChainPoleVec.y, ikChainPoleVec.z]
        cmds.xform(poleVecCon, t=poleVecPos)
        self.utils.orientSnap(self.elbow, poleVecCon)

        # Visualize Vectors and End Points
        if verbose:
            for vector, letter in zip([bisectorVec, transposedVec, ikChainPoleVec,
                                       shoulderIkVec, elbowIkVec, wristIkVec],
                                      ['bisectorVec', 'transposedVec', 'ikChainPoleVec',
                                      'shoulderIk', 'elbowIk', 'wristIk']):
                cmds.spaceLocator(n='%sVecLoc' % letter, p=[vector.x, vector.y, vector.z])
                cmds.curve(n='%sVecCurve' % letter, degree=1, p=[(0, 0, 0), (vector.x, vector.y, vector.z)])

        return poleVecCon
开发者ID:carlkeifer3,项目名称:tbRigKit,代码行数:35,代码来源:arm.py


示例4: buildNurbsRibbon

	def buildNurbsRibbon(self):
		if self.guideSpline:
			guideDeg = cmds.getAttr(self.guideSpline + '.degree' )
			guideSpan = cmds.getAttr(self.guideSpline + '.spans' )
			oneCurvePoints = []
			otherCurvePoints = []
			for i in xrange(guideDeg + guideSpan):
				cvPos = cmds.pointPosition(self.guideSpline + '.cv[' + str(i) + "]", w=True )
				newPara = cmds.closestPointOnCurve(self.guideSpline, ip=cvPos, paramU=True)  #Find the parameter Value
				newParaVal = cmds.getAttr(newPara + ".paramU")
				cmds.delete(newPara)
				infoNode = cmds.pointOnCurve(self.guideSpline, ch=True, pr=newParaVal)  #Now find the Position and tangent!
				posy = (cmds.getAttr(infoNode + ".position"))[0]  # returns the position
				posy = MVector(posy[0],posy[1],posy[2])
				normy = (cmds.getAttr(infoNode + ".tangent"))[0]
				normy = MVector(normy[0],normy[1],normy[2]) #Use MVector from maya.openMaya
				normy = normy.normal()
				vertVect = MVector(0,1,0)
				sideMove = normy^vertVect #This is the notation for a cross product. Pretty cool. Should be a normal movement
				sideMove = sideMove.normal() * 0.5
				sideMovePos = posy + sideMove 
				otherSideMovePos = posy - sideMove
				oneCurvePoints.append([sideMovePos[0],sideMovePos[1],sideMovePos[2]])
				otherCurvePoints.append([otherSideMovePos[0],otherSideMovePos[1],otherSideMovePos[2]])

			oneSideCurve = cmds.curve(editPoint = oneCurvePoints, degree=3)
			OtherSideCurve = cmds.curve(editPoint = otherCurvePoints, degree=3)
			self.tempConstructionParts.append(oneSideCurve)
			self.tempConstructionParts.append(OtherSideCurve)
			#Now we loft the surface between the two Curves!
			nameStart = nameBase(self.totalMarkerList[0].getName(), self.searchString, "loc", "nbs")
			nameStart += "ribbonSurface"
			self.guideNurbsRibbon = cmds.loft(oneSideCurve, OtherSideCurve, name = nameStart, constructionHistory = True, uniform = True, close = False, autoReverse = True, degree = 3, sectionSpans = 1, range = False, polygon = 0, reverseSurfaceNormals = True)
			self.guideNurbsRibbon = self.guideNurbsRibbon[0]
			self.ribbonParts.append(self.guideNurbsRibbon)
开发者ID:Everzen,项目名称:3DFr_FilmRigs_scripts,代码行数:35,代码来源:3DFR_RibbonSplineSetup.py


示例5: createSquare

def createSquare(*args):
    cmds.curve(d=1,p=[(0.5,0,0.5), (-0.5,0,0.5), 
    (-0.5,0,-0.5),(0.5,0,-0.5),(0.5,0,0.5)],
    k=[0,1,2,3,4],per=True)
    cmds.scale(2.458224,2.459224,2.459224,r=True)
    cmds.select(cl=True)
    print 'Created a Nurbs Square'
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:7,代码来源:Melville_Tobias_RBA_1201_finalToolSet.py


示例6: createLine

def createLine(_parents, _sceneData = False, _layer = False):
    nodes = []
    lineCurve = ""
    firstTime = True
    for obj in _parents:
        pos = cmds.xform(obj, q=1, t=1, ws=1)
        if firstTime:
            lineCurve = cmds.curve(d=1, p=[pos])
            nodes.append(lineCurve)
            cmds.setAttr(lineCurve+".overrideEnabled", 1)
            cmds.setAttr(lineCurve+".overrideDisplayType", 2)
            cmds.setAttr(lineCurve+".inheritsTransform", 0)
            firstTime = False
        else:
            cmds.curve(lineCurve, a=True, p=pos)
    #Clusters must be added after all the cvs are created.
    #Don't ask me why!
    for j in range(len(_parents)):
        clusterName = _parents[j]+"_CLUSTER"
        clusterPoint = cmds.cluster(lineCurve+".cv["+str(j)+"]", n=clusterName)
        nodes.append(clusterPoint[1])
        #cmds.setAttr(clusterPoint[1]+".visibility", 0)
        cmds.parent(clusterPoint[1], _parents[j], a=1)
    if(_sceneData):
        addToLayer(_sceneData, "hidden", nodes)
        if _layer:
            addToLayer(_sceneData, _layer, lineCurve)
    return nodes
开发者ID:jaredauty,项目名称:Rigging,代码行数:28,代码来源:RiggingControls.py


示例7: createCurve

	def createCurve(self,*args):
		"""
		  Create curve on locators
		"""
		prefix = mc.textFieldGrp(self.prefixFld,query=True,text=True)
		locators = mc.ls(sl=True,fl=True)
		rotations = mc.intFieldGrp(self.rotFld,query=True,v1=True)
		
		#Error checking here: Are locators selected?
		if len(locators) == 0:
			print '\nSelection is empty. Please select locators.\n'
			
		#create splineIK curve
		curve = " "
		x = 0
		while x < rotations:
			for each in locators:
				try:        #Try to append to existing curve
					x_loc = mc.getAttr('%s.localPositionX'%each)
					y_loc = mc.getAttr('%s.localPositionY'%each)
					z_loc = mc.getAttr('%s.localPositionZ'%each)
					mc.curve(curve,a=True,p=(x_loc,y_loc,z_loc) )
					
				except:     #If appending fails, means a new curve needs to be created
					x_loc = mc.getAttr('%s.localPositionX'%each)
					y_loc = mc.getAttr('%s.localPositionY'%each)
					z_loc = mc.getAttr('%s.localPositionZ'%each)
					curve = mc.curve( p=(x_loc,y_loc,z_loc), n='%s_ikCurve'%prefix ) 
			x = x + 1
开发者ID:Mauricio3000,项目名称:MSH_Maya,代码行数:29,代码来源:ms_geoChain.py


示例8: arrowController

def arrowController(name, color = 0, lockAttr = ['sc', 'vi'], lock = True):
        cmds.curve(n = name , d =  1, p = [(0, 2, 1),(0, 3, 1),(0, 0, 3), (0, -3, 1), (0, -2, 1), (0, -2, -2), (0, 2, -2), (0, 2, 1), (0, -2, -2), (0, 2, -2), (0, -2, 1)], k = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
        cmds.createNode('transform', n = '%s_grp' %name)

        #lock Attribute
        for attr in lockAttr:
                if attr == 'tr':
                        cmds.setAttr('%s.translateX' %name, lock = lock, keyable = False, channelBox = False)
                        cmds.setAttr('%s.translateY' %name, lock = lock, keyable = False, channelBox = False)
                        cmds.setAttr('%s.translateZ' %name, lock = lock, keyable = False, channelBox = False)
                elif attr == 'ro':
                        cmds.setAttr('%s.rotateX' %name, lock = lock, keyable = False, channelBox = False)
                        cmds.setAttr('%s.rotateY' %name, lock = lock, keyable = False, channelBox = False)
                        cmds.setAttr('%s.rotateZ' %name, lock = lock, keyable = False, channelBox = False)
                elif attr == 'sc':
                        cmds.setAttr('%s.scaleX' %name, lock = lock, keyable = False, channelBox = False)
                        cmds.setAttr('%s.scaleY' %name, lock = lock, keyable = False, channelBox = False)
                        cmds.setAttr('%s.scaleZ' %name, lock = lock, keyable = False, channelBox = False)
                elif attr == 'vi':
                        cmds.setAttr('%s.visibility' %name, lock = lock, keyable = False, channelBox = False)
        
        #color change
        shapeNode = cmds.listRelatives(name)
        cmds.rename(shapeNode, name + 'Shape')
        
        cmds.setAttr(name + 'Shape.overrideEnabled', 1)
        cmds.setAttr(name + 'Shape.overrideColor', color)       
        cmds.select(name, r = True)
        cmds.select('%s_grp' %name, tgl = True)
        cmds.parent()
        
        return name
开发者ID:darkuress,项目名称:arNew,代码行数:32,代码来源:controller.py


示例9: obj_single_rotate

 def obj_single_rotate ():
     ctrl_shapes = []
     ctrl_shapes.append( mc.curve( p = [( -7.105427357601002e-15, -0.3358735290035888, 0.7361468691490706 ), ( -0.030221345939771993, -0.43042515285533867, 0.6908148502394227 ), ( -0.072472769789524, -0.5107046042608161, 0.6274377144647979 ), ( -0.12400997464880703, -0.5684975545498503, 0.5501319071758723 ), ( -0.12400997464880703, -0.5684975545498503, 0.5501319071758723 ), ( -0.12400997464880703, -0.5684975545498503, 0.5501319071758723 ), ( -0.12400997464880703, -0.5819931861859402, 0.5346306603447717 ), ( -0.12400997464880703, -0.5819931861859402, 0.5346306603447717 ), ( -0.12400997464880703, -0.5819931861859402, 0.5346306603447717 ), ( -0.12400997464880703, -0.5819931861859402, 0.5346306603447717 ), ( -0.08197748359885537, -0.540253001036092, 0.5946770761304137 ), ( -0.04551343522386375, -0.48527382262420815, 0.6467685738089758 ), ( -0.015501246831107096, -0.4192182992656619, 0.6896431286557706 ), ( -0.015501246831107096, -0.4192182992656619, 0.6896431286557706 ), ( -0.015501246831107096, -0.4192182992656619, 0.6896431286557706 ), ( -0.015501246831107096, -0.7077292503941806, 0.43808875481816606 ), ( -0.015501246831107096, -0.80800092168273, -0.016811817720621902 ), ( -0.015501246831107096, -0.6943482219457593, -0.34108941639861884 ), ( -0.015501246831107096, -0.5527220271320061, -0.5148315398676033 ), ( -0.015501246831107096, -0.3348935247151239, -0.6771644412642893 ), ( -0.015501246831107096, -0.1758560186022855, -0.7361468691392242 ), ( -0.015501246831107096, -7.844604263429887e-05, -0.7361468691392242 )], per = False, d = 3, k = [0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 19, 19] ) )
     ctrl_shapes.append( mc.curve( p = [( 3.552713678800501e-15, -0.3358735290035959, 0.7361468691490706 ), ( 0.03022134593976844, -0.43042515285534577, 0.6908148502394227 ), ( 0.07247276978952044, -0.5107046042608232, 0.6274377144647979 ), ( 0.12400997464880348, -0.5684975545498574, 0.5501319071758723 ), ( 0.12400997464880348, -0.5684975545498574, 0.5501319071758723 ), ( 0.12400997464880348, -0.5684975545498574, 0.5501319071758723 ), ( 0.12400997464880348, -0.5819931861859473, 0.5346306603447717 ), ( 0.12400997464880348, -0.5819931861859473, 0.5346306603447717 ), ( 0.12400997464880348, -0.5819931861859473, 0.5346306603447717 ), ( 0.12400997464880348, -0.5819931861859473, 0.5346306603447717 ), ( 0.08197748359885182, -0.5402530010360991, 0.5946770761304137 ), ( 0.0455134352238602, -0.48527382262421526, 0.6467685738089758 ), ( 0.015501246831103543, -0.419218299265669, 0.6896431286557706 ), ( 0.015501246831103543, -0.419218299265669, 0.6896431286557706 ), ( 0.015501246831103543, -0.419218299265669, 0.6896431286557706 ), ( 0.015501246831103543, -0.7077292503941877, 0.43808875481816606 ), ( 0.015501246831103543, -0.8080009216827371, -0.016811817720621902 ), ( 0.015501246831103543, -0.6943482219457664, -0.34108941639861884 ), ( 0.015501246831103543, -0.5527220271320132, -0.5148315398676033 ), ( 0.015501246831103543, -0.334893524715131, -0.6771644412642893 ), ( 0.015501246831103543, -0.1758560186022926, -0.7361468691392242 ), ( 0.015501246831103543, -7.844604263433487e-05, -0.7361468691392242 )], per = False, d = 3, k = [0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 19, 19] ) )
     ctrl_shapes.append( mc.curve( p = [( 0.0, 0.33587352900359235, 0.7361468691490706 ), ( -0.030221345939764888, 0.4304251528553422, 0.6908148502394227 ), ( -0.07247276978951689, 0.5107046042608197, 0.6274377144647979 ), ( -0.12400997464879993, 0.5684975545498538, 0.5501319071758723 ), ( -0.12400997464879993, 0.5684975545498538, 0.5501319071758723 ), ( -0.12400997464879993, 0.5684975545498538, 0.5501319071758723 ), ( -0.12400997464879993, 0.5819931861859438, 0.5346306603447717 ), ( -0.12400997464879993, 0.5819931861859438, 0.5346306603447717 ), ( -0.12400997464879993, 0.5819931861859438, 0.5346306603447717 ), ( -0.12400997464879993, 0.5819931861859438, 0.5346306603447717 ), ( -0.08197748359884827, 0.5402530010360955, 0.5946770761304137 ), ( -0.045513435223856646, 0.4852738226242117, 0.6467685738089758 ), ( -0.01550124683109999, 0.41921829926566545, 0.6896431286557706 ), ( -0.01550124683109999, 0.41921829926566545, 0.6896431286557706 ), ( -0.01550124683109999, 0.41921829926566545, 0.6896431286557706 ), ( -0.01550124683109999, 0.7077292503941841, 0.43808875481816606 ), ( -0.01550124683109999, 0.8080009216827335, -0.016811817720621902 ), ( -0.01550124683109999, 0.6943482219457628, -0.34108941639861884 ), ( -0.01550124683109999, 0.5527220271320097, -0.5148315398676033 ), ( -0.01550124683109999, 0.33489352471512746, -0.6771644412642893 ), ( -0.01550124683109999, 0.17585601860228905, -0.7361468691392242 ), ( -0.01550124683109999, 7.844604263078215e-05, -0.7361468691392242 )], per = False, d = 3, k = [0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 19, 19] ) )
     ctrl_shapes.append( mc.curve( p = [( 3.552713678800501e-15, 0.33587352900359235, 0.7361468691490706 ), ( 0.03022134593976844, 0.4304251528553422, 0.6908148502394227 ), ( 0.07247276978952044, 0.5107046042608197, 0.6274377144647979 ), ( 0.12400997464880348, 0.5684975545498538, 0.5501319071758723 ), ( 0.12400997464880348, 0.5684975545498538, 0.5501319071758723 ), ( 0.12400997464880348, 0.5684975545498538, 0.5501319071758723 ), ( 0.12400997464880348, 0.5819931861859438, 0.5346306603447717 ), ( 0.12400997464880348, 0.5819931861859438, 0.5346306603447717 ), ( 0.12400997464880348, 0.5819931861859438, 0.5346306603447717 ), ( 0.12400997464880348, 0.5819931861859438, 0.5346306603447717 ), ( 0.08197748359885182, 0.5402530010360955, 0.5946770761304137 ), ( 0.0455134352238602, 0.4852738226242117, 0.6467685738089758 ), ( 0.015501246831103543, 0.41921829926566545, 0.6896431286557706 ), ( 0.015501246831103543, 0.41921829926566545, 0.6896431286557706 ), ( 0.015501246831103543, 0.41921829926566545, 0.6896431286557706 ), ( 0.015501246831103543, 0.7077292503941841, 0.43808875481816606 ), ( 0.015501246831103543, 0.8080009216827335, -0.016811817720621902 ), ( 0.015501246831103543, 0.6943482219457628, -0.34108941639861884 ), ( 0.015501246831103543, 0.5527220271320097, -0.5148315398676033 ), ( 0.015501246831103543, 0.33489352471512746, -0.6771644412642893 ), ( 0.015501246831103543, 0.17585601860228905, -0.7361468691392242 ), ( 0.015501246831103543, 7.844604263078215e-05, -0.7361468691392242 )], per = False, d = 3, k = [0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 19, 19] ) )
     return ctrl_shapes
开发者ID:Strangenoise,项目名称:My_rig_tools,代码行数:7,代码来源:rig_definitions.py


示例10: extraController

def extraController(name, color = 0, lockAttr = ['sc', 'vi'], lock = True):

        cmds.createNode('transform', n =  '%s_grp' %name)
        cmds.curve(n = name, d = 1, p =[(-4, 0, -3),(-1, 0, -3),(-1, 0, -2),(-3, 0, -2),(-3, 0, -1), (-1, 0, -1),(-1, 0, 0),(-3, 0, 0),(-3, 0, 1),(-1, 0, 1),(-1, 0, 2),(-4, 0, 2),(-4, 0, -3),(3, 0, -3),(2, 0, -1),(2, 0, 0),(3, 0, 2),(2, 0, 2),(1, 0, 0),(0, 0, 2),(-1, 0, 2),(0, 0, 0),(0, 0, -1),(-1, 0, -3),(0, 0, -3),(1, 0, -1),(2, 0, -3),(3, 0, -3),(3, 0, 2),(-4, 0, 2)], k= [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29])
        cmds.scale(0.2,0.2,0.2) 
        for attr in lockAttr:
                if attr == 'tr':
                        cmds.setAttr('%s.translateX' %name, lock = lock, keyable = False, channelBox = False)
                        cmds.setAttr('%s.translateY' %name, lock = lock, keyable = False, channelBox = False)
                        cmds.setAttr('%s.translateZ' %name, lock = lock, keyable = False, channelBox = False)
                elif attr == 'ro':
                        cmds.setAttr('%s.rotateX' %name, lock = lock, keyable = False, channelBox = False)
                        cmds.setAttr('%s.rotateY' %name, lock = lock, keyable = False, channelBox = False)
                        cmds.setAttr('%s.rotateZ' %name, lock = lock, keyable = False, channelBox = False)
                elif attr == 'sc':
                        cmds.setAttr('%s.scaleX' %name, lock = lock, keyable = False, channelBox = False)
                        cmds.setAttr('%s.scaleY' %name, lock = lock, keyable = False, channelBox = False)
                        cmds.setAttr('%s.scaleZ' %name, lock = lock, keyable = False, channelBox = False)
                elif attr == 'vi':
                        cmds.setAttr('%s.visibility' %name, lock = lock, keyable = False, channelBox = False)
                
        shapeNode = cmds.listRelatives(name)
                
        cmds.setAttr('%s.overrideEnabled' %shapeNode[0], 1)
        cmds.setAttr('%s.overrideColor' %shapeNode[0], color)
        
        return name
开发者ID:darkuress,项目名称:arNew,代码行数:27,代码来源:controller.py


示例11: lollipopController

def lollipopController(name, color = 0, size = [1, 1, 1], lockAttr = ['tr', 'ro', 'sc', 'vi'], lock = True):

        #cmds.createNode('transform', n =  '%s_grp' %name)
        cmds.curve(n = name, d = 1, p = [ (0, 0, 0), (0, 3, 0),(0, 4, 1),(0, 5, 0), (0, 4, -1),(0, 3, 0),(0, 4, 1),(0, 4, -1)], k = [1,2,3,4,5,6,7,8])
        cmds.scale(size[0],size[1],size[2]) 
        for attr in lockAttr:
                if attr == 'tr':
                        cmds.setAttr('%s.translateX' %name, lock = lock, keyable = False, channelBox = False)
                        cmds.setAttr('%s.translateY' %name, lock = lock, keyable = False, channelBox = False)
                        cmds.setAttr('%s.translateZ' %name, lock = lock, keyable = False, channelBox = False)
                elif attr == 'ro':
                        cmds.setAttr('%s.rotateX' %name, lock = lock, keyable = False, channelBox = False)
                        cmds.setAttr('%s.rotateY' %name, lock = lock, keyable = False, channelBox = False)
                        cmds.setAttr('%s.rotateZ' %name, lock = lock, keyable = False, channelBox = False)
                elif attr == 'sc':
                        cmds.setAttr('%s.scaleX' %name, lock = lock, keyable = False, channelBox = False)
                        cmds.setAttr('%s.scaleY' %name, lock = lock, keyable = False, channelBox = False)
                        cmds.setAttr('%s.scaleZ' %name, lock = lock, keyable = False, channelBox = False)
                elif attr == 'vi':
                        cmds.setAttr('%s.visibility' %name, lock = True, keyable = False, channelBox = False)
                
        shapeNode = cmds.listRelatives(name)
                
        cmds.setAttr('%s.overrideEnabled' %shapeNode[0], 1)
        cmds.setAttr('%s.overrideColor' %shapeNode[0], color)

        util.group(name, '%s_grp' %name)
        
        return name
开发者ID:darkuress,项目名称:arNew,代码行数:29,代码来源:controller.py


示例12: archimedesDouble

def archimedesDouble(loops,spiralDown,gaps,height):
    '''
    Creates a Archimedes spiral that spirals out then in again
    
    loops      : Number of complete turns the spiral should have
    spiralDown : Direction of the generated curve
    growth     : Growth factor
    height     : Vertical height of the spiral
    
    The curve is created and the required number of control vertices is calculated 
    along with the fraction of the height each CV needs to be placed. The polar 
    equation of a Archimedes spiral is r=a+b*theta where a rotates the spiral 
    and b controls distance between successive turnings. The polar coordinates 
    are converted to Cartesian form by x=r*math.cos(theta) and y=r*math.sin(theta).
    After half the CVs, I reverse the equation to wind the spiral back in. The 
    direction of the curve can be reversed based on the spiralDown flag.
    '''
    curve=cmds.curve(p=[(0,0,0)],n='curve_01')
    cvNo=int(loops*8)
    heightFrac = float(height)/cvNo
    for i in range(1,(cvNo/2)+1):
        theta=i*(0.25*math.pi)
        r=(gaps/(1.8*math.pi))*theta
        x=r*math.cos(theta)
        y=r*math.sin(theta)
        cmds.curve(curve,a=True,p=[(x,i*heightFrac,y)])
    for i in reversed(range(0,cvNo/2)):
        theta=i*(0.25*math.pi)
        r=(gaps/(1.8*math.pi))*theta
        x=(r*math.cos(theta))
        y=-(r*math.sin(theta))
        cmds.curve(curve,a=True,p=[(x,height-i*heightFrac,y)])
    if spiralDown==True:
        cmds.reverseCurve(curve,ch=0,rpo=1)
开发者ID:philrouse,项目名称:snowFX,代码行数:34,代码来源:curves.py


示例13: createTemplate

        def createTemplate(self , eyeMesh):
                # create eye jnt
                eyeJnt=[]
                if 'L_' in str(eyeMesh):
                        helpClu = mc.cluster(eyeMesh)[0]
                        LeyeJnt = mc.joint(p=(0,0,0),name=eyeMesh+'_skin_jnt')
                        self.fromAtoB(eyeJnt,helpClu,1)
                        ReyeJnt = mc.mirrorJoint(mirrorYZ=True,mirrorBehavior=False,searchReplace=('L_', 'R_')
                        eyeJnt.append(LeyeJnt)
                        eyeJnt.append(ReyeJnt)
                else:
                        self.mayaError('Please select the left eye.')

                return eyeJnt

        def createEyeRig(self):
                if mc.objExists(self.eyeGlobalCtrl) == False:
                        EyesGlobalCtrl = mc.curve(d=1,p=[(-1.069806, 1.027703, 0),(-1.651954,1.89895,0),(-2.523201,2.481098,0),(-3.550904,2.68552,0),(-4.578607,2.481098,0),(-5.449854,1.89895,0),(-6.032002,1.027703,0),(-6.236424,0,0),(-6.032002,-1.027703,0),(-5.449854 ,-1.89895, 0),(-4.578607,-2.481098,0), (-3.550904,-2.68552,0),(-2.523201, -2.481098, 0),(-1.651954,-1.89895,0),(-1.069806,-1.027703,0),(1.058138,-1.032345,0),(1.642915, -1.907527,0),(2.518098,-2.492305,0),( 3.550443,-2.69765,0),(4.582788,-2.492305,0),(5.45797,-1.907527,0),( 6.042748,-1.032345,0),(6.248093,0,0),(6.042748,1.032345,0),( 5.45797,1.907527,0 ),(4.582788,2.492305,0),( 3.550443,2.69765,0),(2.518098,2.492305,0 ),(1.642915,1.907527,0),(1.058138,1.032345,0),( -1.069806,1.027703,0)],k=[0,1,2,3,4,5,6,7,8,9,10,11,12 ,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],n=self.eyeGlobalCtrl)
                        L_EyeAimCtrl = mc.curve(d=1,p=[(3.653116 ,0.946994,0), (3.653116 ,0 ,0),( 2.706122, 0, 0) , (3.653116 ,0, 0),(4.600109, 0 ,0) , (3.653116 ,0, 0) , (3.653116 ,-0.946994, 0) ],k=[0, 1, 2 ,3 ,4 ,5 , 6 ],n='L_'+self.eyeAimCtrl)
                        R_EyeAimCtrl = mc.curve(d=1,p=[(3.653116 ,0.946994,0), (3.653116 ,0 ,0),( 2.706122, 0, 0) , (3.653116 ,0, 0),(4.600109, 0 ,0) , (3.653116 ,0, 0) , (3.653116 ,-0.946994, 0) ],k=[0, 1, 2 ,3 ,4 ,5 , 6 ],n='R_'+self.eyeAimCtrl)

                        mc.parent(L_EyeAimCtrl , EyesGlobalCtrl)
                        mc.parent(R_EyeAimCtrl , EyesGlobalCtrl)

                        self.fastGrp('On' , ['zero','con','sdk'],L_EyeAimCtrl)
                        self.fastGrp'On' , ['zero','con','sdk'],R_EyeAimCtrl)
                        zeroGrp = self.fastGrp('On' , ['zero','con','sdk'],EyesGlobalCtrl)[2]
开发者ID:wangqinghuaTudou,项目名称:test,代码行数:27,代码来源:Eye.py


示例14: createCurve

def createCurve(ptList,start,end,group=''):
	'''
	'''
	# Initialize Curves
	crvList = []
	for pt in ptList:
		pos = mc.pointPosition(pt)
		curve = mc.curve(p=[pos,pos],d=1)
		curve = mc.rename(curve,pt+'_curve')
		crvList.append(curve)
	
	# Track Curves
	for i in range(start,end+1):
		mc.currentTime(i)
		for n in range(len(ptList)):
			pos = mc.pointPosition(ptList[n])
			mc.curve(crvList[n],a=True,p=pos)
	
	# Remove Initial CV and Rebuild
	for crv in crvList:
		mc.delete(crv+'.cv[0]')
		mc.rebuildCurve(crv,ch=False,rpo=True,rt=0,end=1,kr=2,kcp=True,kep=True)
	
	# Group Curves
	if group:
		# Check Group
		if not mc.objExists(group): group = mc.group(em=True,n=group)
		# Parent Curves to Group
		mc.parent(crvList,group)
	
	# Return Result
	if group: return [group]
	else: return crvList
开发者ID:RiggingDojoAdmin,项目名称:glTools,代码行数:33,代码来源:motionPath.py


示例15: corners

    def corners(self):
        """
        Create corners control
        """
        ctrl = cmds.createNode('transform')

        pts = [(0.9, 0.0, 1.0), (1.0, 0.0, 1.0), (1.0, 0.0, 0.9)]
        cnr = cmds.curve(d=1, p=pts, k=range(3))
        cnrShape = cmds.listRelatives(cnr, s=True, ni=True)[0]
        cmds.parent(cnrShape, ctrl, s=True, r=True)

        pts = [(-0.9, 0.0, 1.0), (-1.0, 0.0, 1.0), (-1.0, 0.0, 0.9)]
        cnr = cmds.curve(d=1, p=pts, k=range(3))
        cnrShape = cmds.listRelatives(cnr, s=True, ni=True)[0]
        cmds.parent(cnrShape, ctrl, s=True, r=True)

        pts = [(0.9, 0.0, -1.0), (1.0, 0.0, -1.0), (1.0, 0.0, -0.9)]
        cnr = cmds.curve(d=1, p=pts, k=range(3))
        cnrShape = cmds.listRelatives(cnr, s=True, ni=True)[0]
        cmds.parent(cnrShape, ctrl, s=True, r=True)

        pts = [(-0.9, 0.0, -1.0), (-1.0, 0.0, -1.0), (-1.0, 0.0, -0.9)]
        cnr = cmds.curve(d=1, p=pts, k=range(3))
        cnrShape = cmds.listRelatives(cnr, s=True, ni=True)[0]
        cmds.parent(cnrShape, ctrl, s=True, r=True)

        return ctrl
开发者ID:bennymuller,项目名称:glTools,代码行数:27,代码来源:controlBuilder.py


示例16: archimedes

def archimedes(loops,spiralIn,gaps,height):
    '''
    Creates a Archimedes spiral
    
    loops    : Number of complete turns the spiral should have
    spiralIn : Direction of the generated curve
    gaps     : Distance between successive turnings
    height   : Vertical height of the spiral
    
    The curve is created and the required number of control vertices is calculated 
    along with the fraction of the height each CV needs to be placed. The polar 
    equation of a Archimedes spiral is r=a+b*theta where a rotates the spiral 
    and b controls distance between successive turnings. The polar coordinates 
    are converted to Cartesian form by x=r*math.cos(theta) and y=r*math.sin(theta).
    The direction of the curve can be reversed based on the spiralInwards flag.
    '''
    curve=cmds.curve(p=[(0,0,0)],n='curve_01')
    cvNo=loops*8
    heightFrac = float(height)/cvNo
    for i in range(1,cvNo+1):
        theta=i*(0.25*math.pi)
        r=(gaps/(1.8*math.pi))*theta
        x=r*math.cos(theta)
        y=r*math.sin(theta)
        cmds.curve(curve,a=True,p=[(x,i*heightFrac,y)])
    if spiralIn==True:
        cmds.reverseCurve(curve,ch=0,rpo=1)
开发者ID:philrouse,项目名称:snowFX,代码行数:27,代码来源:curves.py


示例17: logarithmic

def logarithmic(loops,spiralIn,growth,height):
    '''
    Creates a logarithmic spiral
    
    loops    : Number of complete turns the spiral should have
    spiralIn : Direction of the generated curve
    growth   : Growth factor
    height   : Vertical height of the spiral
    
    The curve is created and the required number of control vertices is calculated 
    along with the fraction of the height each CV needs to be placed. The polar 
    equation of a logarithmic spiral is r=a*e^(b*theta) where a scales the spiral 
    and b controls how tightly it winds. The polar coordinates are converted to 
    Cartesian form by x=r*math.cos(theta) and y=r*math.sin(theta). The direction 
    of the curve can be reversed based on the spiralInwards flag.
    '''
    curve=cmds.curve(p=[(0,0,0)],n='curve_01')
    cvNo=loops*8
    heightFrac = float(height)/cvNo
    for i in range(1,cvNo+1):
        theta=i*(0.25*math.pi)
        r=0.1*(1/(1.8*math.pi))*math.e**(growth*theta)
        x=r*math.cos(theta)
        y=r*math.sin(theta)
        cmds.curve(curve,a=True,p=[(x,i*heightFrac,y)])
    if spiralIn==True:
        cmds.reverseCurve(curve,ch=0,rpo=1)
开发者ID:philrouse,项目名称:snowFX,代码行数:27,代码来源:curves.py


示例18: hyperbolic

def hyperbolic(loops,spiralIn,height):
    '''
    Creates a hyperbolic spiral
    
    loops    : Number of complete turns the spiral should have
    spiralIn : Direction of the generated curve
    height   : Vertical height of the spiral
    
    The curve is created and the required number of control vertices is calculated 
    along with the fraction of the height each CV needs to be placed. The polar 
    equation of a hyperbolic spiral is r=a/theta where a scales the spiral. The 
    polar coordinates are converted to Cartesian form by x=r*math.cos(theta) and 
    y=r*math.sin(theta). The direction of the curve can be reversed based on the 
    spiralInwards flag.
    '''
    curve=cmds.curve(p=[(0,0,0)],n='curve_01')
    cvNo=loops*8
    heightFrac = float(height)/cvNo
    for i in range(1,cvNo+2):
        theta=i*(0.25*math.pi)
        r=theta**(-1)
        x=r*math.cos(theta)
        y=r*math.sin(theta)
        cmds.curve(curve,a=True,p=[(x,i*heightFrac,y)])
    cmds.delete(curve+'.cv[0]')
    if spiralIn==False:
        cmds.reverseCurve(curve,ch=0,rpo=1)
开发者ID:philrouse,项目名称:snowFX,代码行数:27,代码来源:curves.py


示例19: createCurveOnTargetPoints

def createCurveOnTargetPoints( targets, degrees=3 ):
    
    trObjs = []
    curvePoints = []
    for taregt in targets:
        if cmds.nodeType( taregt ) in ['joint', 'transform']:
            trObjs.append( taregt )
            curvePoints.append( [0,0,0] )

    if len( targets ) == 2:
        crv = cmds.curve( p=curvePoints, d=1 )
    elif len( targets ) ==3:
        crv = cmds.curve( p=curvePoints, d=2 )
    else:
        crv = cmds.curve( p=curvePoints, d=degrees )
    crvShape= cmds.listRelatives( crv, s=1 )[0]
    
    for trObj in trObjs:
        i = trObjs.index( trObj )
        mmdc = cmds.createNode( 'multMatrixDecompose' )
        cmds.connectAttr( trObj+'.wm', mmdc+'.i[0]' )
        cmds.connectAttr( crvShape+'.pim', mmdc+'.i[1]' )
        cmds.connectAttr( mmdc+'.ot', crvShape+'.controlPoints[%d]' % i )
    
    return crv
开发者ID:jonntd,项目名称:mayadev-1,代码行数:25,代码来源:sgBFunction_curve.py


示例20: sqGenerateCurves

 def sqGenerateCurves(self, *args):
     self.edgeList = cmds.ls(selection=True, flatten=True)
     if not self.edgeList == None and not self.edgeList == [] and not self.edgeList == "":
         self.baseCurve = cmds.polyToCurve(name="baseCurve", form=2, degree=1)[0]
         cmds.select(self.baseCurve+".ep[*]")
         cmds.insertKnotCurve(cmds.ls(selection=True, flatten=True), constructionHistory=True, curveOnSurface=True, numberOfKnots=1, addKnots=False, insertBetween=True, replaceOriginal=True)
         
         pointListA, pointListB, sideA, sideB = self.sqGetPointLists()
         
         toDeleteList = []
         p = 2
         for k in range((sideA+2), (sideB-1)):
             if p%2 == 0:
                 toDeleteList.append(self.baseCurve+".cv["+str(k)+"]")
                 toDeleteList.append(self.baseCurve+".cv["+str(k+len(pointListA)-1)+"]")
             p = p+1
         q = 2
         m = sideA-2
         if m >= 0:
             while m >= 0:
                 if not m == sideA and not m == sideB:
                     if q%2 == 0:
                         toDeleteList.append(self.baseCurve+".cv["+str(m)+"]")
                 m = m-1
                 q = q+1
         
         cmds.delete(toDeleteList)
         cmds.insertKnotCurve([self.baseCurve+".u["+str(len(pointListA)-1)+"]", self.baseCurve+".ep["+str(len(pointListA)-1)+"]"], constructionHistory=True, curveOnSurface=True, numberOfKnots=1, addKnots=False, insertBetween=True, replaceOriginal=True)
         
         pointListA, pointListB, sideA, sideB = self.sqGetPointLists()
         
         posListA, posListB = [], []
         for i in range(0, len(pointListA)-1):
             posListA.append(cmds.xform(pointListA[i], query=True, worldSpace=True, translation=True))
             posListB.append(cmds.xform(pointListB[i], query=True, worldSpace=True, translation=True))
         
         self.mainCurveA = cmds.curve(name="StickyLips_Main_A_Crv", degree=1, point=posListA)
         self.mainCurveB = cmds.curve(name="StickyLips_Main_B_Crv", degree=1, point=posListB)
         
         cmds.rename(cmds.listRelatives(self.mainCurveA, children=True, shapes=True)[0], self.mainCurveA+"Shape")
         cmds.rename(cmds.listRelatives(self.mainCurveB, children=True, shapes=True)[0], self.mainCurveB+"Shape")
         
         cmds.select(self.mainCurveA+".cv[*]")
         self.curveLenght = len(cmds.ls(selection=True, flatten=True))
         cmds.select(clear=True)
         
         self.sqCheckCurveDirection(self.mainCurveA)
         self.sqCheckCurveDirection(self.mainCurveB)
         
         self.baseCurveA = cmds.duplicate(self.mainCurveA, name=self.mainCurveA.replace("_Main_", "_Base_"))[0]
         self.baseCurveB = cmds.duplicate(self.mainCurveB, name=self.mainCurveB.replace("_Main_", "_Base_"))[0]
         
         cmds.delete(self.baseCurve)
         self.maxIter = len(posListA)
         
         cmds.group(self.mainCurveA, self.mainCurveB, self.baseCurveA, self.baseCurveB, name="StickyLips_StaticData_Grp")
     else:
         mel.eval("warning \"Please, select an closed edgeLoop.\";")
开发者ID:utsdab,项目名称:config,代码行数:58,代码来源:sqStickyLipsSetup.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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