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

Python core.xform函数代码示例

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

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



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

示例1: makeCube

 def makeCube():
     squareCrv = dtLib.makeSquare()
     squareCrv2 = dtLib.makeSquare()
     squareCrv2.setRotation([90, 0,0])
     squareCrv2.setTranslation([0,0.5,-0.5])
     pm.makeIdentity(apply=True, translate=True, rotate=True, scale=True, normal=1)
     
     crvs = squareCrv2.getShapes()
     
     for current in crvs:
         pm.parent(current, squareCrv, relative=True, shape=True)
     pm.delete(squareCrv2)
     
     pm.select(squareCrv)
     dupCrv = pm.duplicate()
     dupCrv[0].setRotation([180, 0, 0])
     dupCrv[0].setTranslation([0,0,-1])
     pm.makeIdentity(apply=True, translate=True, rotate=True, scale=True, normal=1)
     crvs = dupCrv[0].getShapes()
     for current in crvs:
         pm.parent(current, squareCrv, relative=True, shape=True)
         
     pm.delete(dupCrv)
     #中央にピポットを移動
     pm.select(squareCrv)
     pm.xform(cp=True)
     return pm.selected()
开发者ID:Hare8563,项目名称:MayaProgramming,代码行数:27,代码来源:dtLib.py


示例2: make_stabilized_node

def make_stabilized_node(nodeName=None, centered=True):
    '''
    Very simple proc to generate a Stabilized node for
    raw MoCap tracking purposes... First selected node
    is used as the Aim axis, second selected is used as this
    aim's worldUp
    '''
    RequiredMarkers = pm.ls(sl=True, l=True)
    #pos = pm.xform(WorldUpObj, q=True, ws=True, t=True)
    curve = pm.curve(ws=True, d=1, p=(0, 0, 0), k=0)
    
    if centered:
        AimAt = RequiredMarkers[0]
        WorldUpObj = RequiredMarkers[1]
        pm.pointConstraint(RequiredMarkers, curve)
    else:
        AimAt = RequiredMarkers[1]
        WorldUpObj = RequiredMarkers[2]
        pm.pointConstraint(RequiredMarkers[0], curve)

    pm.aimConstraint((AimAt, curve),
                     weight=1,
                     aimVector=(0, 0, 1),
                     upVector=(0, 1, 0),
                     worldUpType="object",
                     worldUpObject=WorldUpObj)
        
    #Snap a curveKnot to the pivot of all referenceMarkers
    for node in RequiredMarkers:
        pm.curve(curve, a=True, ws=True, p=(pm.xform(node, q=True, ws=True, t=True)))
    pm.curve(curve, a=True, ws=True, p=(pm.xform(AimAt, q=True, ws=True, t=True)))
    
    return curve
开发者ID:Italic-,项目名称:maya-prefs,代码行数:33,代码来源:AnimationBinder.py


示例3: buildChains

    def buildChains(self, *args):
        """
        Build joint chains based on locator positions.
        """
        self.jointChain = []
        self.ikChain = []
        self.fkChain = []

        loc1Pos = pm.xform(self.loc1, q=True, ws=True, t=True)
        loc2Pos = pm.xform(self.loc2, q=True, ws=True, t=True)
        loc3Pos = pm.xform(self.loc3, q=True, ws=True, t=True)

        jnt1='%s_shldrJnt'%self.prefix
        jnt2='%s_elbow1Jnt'%self.prefix
        jnt3='%s_wristJnt'%self.prefix

        self.jointChain.append(pm.PyNode(pm.joint(p=loc1Pos, n=jnt1))) 
        self.jointChain.append(pm.PyNode(pm.joint(p=loc2Pos, n=jnt2)))
        self.jointChain.append(pm.PyNode(pm.joint(p=loc3Pos, n=jnt3)))

        #--- Orient the chain
        self.orientChain()

        #--- Creating duplicate ik/fk joint chains
        for each in pm.duplicate(self.jointChain, rc=True):
            # Slice off number maya adds during duplication
            each.rename('%s_ik' % each[:-1])
            self.ikChain.append(pm.PyNode(each))

        for each in pm.duplicate(self.jointChain, rc=True):
            each.rename('%s_fk' % each[:-1])
            self.fkChain.append(pm.PyNode(each))
开发者ID:Mauricio3000,项目名称:MSH_Maya,代码行数:32,代码来源:ms_armRig.py


示例4: GuideCrv

def GuideCrv ( startGuider=None , endGuider=None ):

	if startGuider==None or endGuider==None:
		startGuider,endGuider = pm.ls(sl=True)
	
	pm.select(clear=True)
	
	startJnt = pm.joint ( n = startGuider.name()+"_guideCrvJnt")
	pm.parent (startJnt , startGuider)
	startJnt.translate.set (0,0,0)
	startJnt.visibility.set (0)
	pm.setAttr ( startJnt.visibility , lock=True  )
	
	
	endJnt = pm.joint (  n = endGuider.name()+"_guideCrvJnt" )
	pm.parent (endJnt , endGuider)
	endJnt.translate.set (0,0,0)
	endJnt.visibility.set (0)
	pm.setAttr ( endJnt.visibility , lock=True  )
	
	startJntPos = pm.xform ( startJnt , q=True , ws=True , t=True)
	endJntPos = pm.xform ( endJnt , q=True , ws=True , t=True)
	
	guideCrv = pm.curve ( degree=1 , p = (startJntPos ,endJntPos) , k=(1,2)  )
	
	pm.rename ( guideCrv , startGuider.name()+"_guideCrv")
	
	pm.skinCluster ( guideCrv , startJnt , endJnt  )
	
	guideCrv.inheritsTransform.set(0)
	guideCrv.template.set(1)
	
	pm.select(clear=True)
	
	return guideCrv
开发者ID:satishgoda,项目名称:EHM_tools,代码行数:35,代码来源:guideCrv.py


示例5: vis_orbits

	def vis_orbits(self):
		global vis_orbGrp
		vis_orbGrp = pm.group(n='olp_visOrbits', em=True)

		intervValue = self.interv_int.value()
		distValue = self.distance_float.value()
		orbitValue = self.orbit_int.value()

		global all_orbitObjs
		all_orbitObjs = []
		for orbit in range(orbitValue):
			orbitRot = orbit * 360/float(orbitValue*2)
			
			orbit_visObject = pm.circle(n='olp_orbCircle{0}'.format(orbit+1), r=distValue, s=intervValue*2, nr=[1, 0, 0], ch=True)[0]
			pm.parent(orbit_visObject, vis_orbGrp)

			orbit_visObject.overrideEnabled.set(1)
			orbit_visObject.overrideColorRGB.set(0, 1, 1)
			orbit_visObject.overrideRGBColors.set(1)

			pm.xform(orbit_visObject, ro=[0, 0, orbitRot])

			all_orbitObjs.append(orbit_visObject)

		pm.xform(vis_orbGrp, a=True, t=sel_center)
		pm.parent(vis_orbGrp, vis_mainGrp)
		pm.select(sel_objects, r=True)
		return vis_orbGrp
开发者ID:Huston94,项目名称:Orbital_Light_Previewer,代码行数:28,代码来源:orbitLights_UI.py


示例6: create_hook

    def create_hook(cls, asset="asset", side="c",  part="part",
                    snap_to=None, in_out='in'):
        """
        Settings for generating hooks in the autorig.

        :parameters:
            asset: For naming convention.
            side: For naming convention. (l, r, c)
            part: For naming convention.
            snap_to: Object to snap to.
            in_out: default value.
        """
        hook_name = NameUtils.get_unique_name(asset, side, part, "loc")
        hook = pm.createNode(settings.HOOK_NODE_TYPE, n=hook_name)

        if settings.HOOK_NODE_TYPE == "locator":
            hook = hook.getParent()
            hook.rename(hook_name)

        digit_type = 0
        if in_out == 'out':
            digit_type = 1

        hook.addAttr('hookType', at='float', dv=digit_type)
        hook.attr('hookType').lock(1)
        if snap_to:
            pm.xform(hook, ws=1, matrix=snap_to.wm.get())
        return hook
开发者ID:ABCTD,项目名称:abc_pipe,代码行数:28,代码来源:hook_utils.py


示例7: autoPoleVector

def autoPoleVector( baseJnt=None, endJnt=None, side='L' ):

	baseJntPos = pm.xform( baseJnt, q=True, t=True, ws=True )
	endJntPos = pm.xform( endJnt, q=True, t=True, ws=True )

	pm.select(clear=True)
	poleVectorJnt_one = pm.joint( p=baseJntPos )
	poleVectorJnt_two = pm.joint( p=endJntPos )
	poleVectorIKstuff = pm.ikHandle(  sj = poleVectorJnt_one, ee = poleVectorJnt_two, solver = "ikSCsolver"  )

	pv = pm.spaceLocator()
	pv.setParent( poleVectorJnt_two )
	pv.translate.set( 0,0,0 )
	pvZeros = ZeroGrp( pv )

	pm.pointConstraint( poleVectorIKstuff[0], pvZeros[0] )

	if side=='L':
		pv.translateX.set( 1 )
	elif side=='R':
		pv.translateX.set( -1 )


	pvZeros[0].setParent( poleVectorJnt_two )

	return ( pv, poleVectorIKstuff, (poleVectorJnt_one, poleVectorJnt_two) ) 
开发者ID:satishgoda,项目名称:EHM_tools,代码行数:26,代码来源:rigIK.py


示例8: create_bind_proxy

def create_bind_proxy(jnt):
    if jnt.getChildren():
        name=jnt.name() + "_bindProxy"
         
        distance = jnt.getChildren()[0].translateX.get()
        if not pm.objExists(name):
            proxy = pm.polyCylinder(r=0.25, h=0.5, sx=12, sy=4, sz=4, ax=[1,0,0], rcp=1, cuv=0, ch=0, name=name)[0]
            pm.xform(proxy, piv=[-0.5, 0, 0])
             
            pm.parent(proxy, 'bind_proxy')
             
            pm.delete(pm.parentConstraint(jnt, proxy, mo=False))
            proxy.scale.set(distance, distance, distance)
             
            try:
                jnt.addAttr('iterations', at='long', min=1, max=5, dv=3, k=True)
                jnt.addAttr('bind_proxy', at='message')
            except:
                pass            
                 
        else:
            proxy = pm.PyNode(name)

        
        pm.skinCluster( jnt, proxy, tsb=True)
        proxy.message >> jnt.bind_proxy            
开发者ID:adamfok,项目名称:afok_toolset,代码行数:26,代码来源:utils_deltaMush.py


示例9: __areaSkin

    def __areaSkin(self,*args):

        geo = pm.ls(sl = 1)[0]
        skinCluster = mel.eval('findRelatedSkinCluster ' + geo)
        vertex = pm.polyEvaluate(geo,v = 1)
        joints = pm.skinCluster(skinCluster,q = 1,inf = 1)
        skinList = {}

        for num in range(0,vertex):
            vertex = geo + '.vtx[' + str(num) + ']'
            vertPos = pm.xform(vertex,q = 1,t = 1,ws = 1)
            tempDict = {}
          
            for joint in joints:
                jntPos = pm.xform(joint,q = 1,t = 1,ws = 1)
                dist = math.sqrt(pow(vertPos[0] - jntPos[0],2) + pow(vertPos[1] - jntPos[1],2) + pow(vertPos[2] - jntPos[2],2))
                tempDict.setdefault(joint,dist)
                  
            minDistVal = min(distVal for distVal in tempDict.values())
          
            for joint in tempDict.keys(): 
                if minDistVal == tempDict[joint]:
                    if joint not in skinList:
                        skinList[joint] = []
                    skinList[joint].append(vertex)
                      
        for item in skinList.items():
            joint =  item[0]
            vertex = item[1]
            for vert in vertex:
                pm.skinPercent(skinCluster,vert,transformValue = (joint,1))        
开发者ID:RyugasakiHu,项目名称:AT_Rigging,代码行数:31,代码来源:toolModule.py


示例10: set_newPivot

def set_newPivot(*args):
    sel = pm.ls(sl=True)
    source = sel[-1]
    piv = pm.xform (source, piv=True, q=True, ws=True)
    
    for obj in sel[:-1]:
        pm.xform (obj, ws=True, piv=(piv[0], piv[1], piv[2]) )
开发者ID:michaelanieves,项目名称:Rigging,代码行数:7,代码来源:newPivot.py


示例11: locatorGrid

def locatorGrid(width, height, depth, offset, centered=True):
	'''Create a grid of locators to test upon
	Args:
		width (int): Width of the grid
		height (int): Height of the grid
		offset (float): Adds an offset multiplier to the locator positions
		centered (bool): determines whether it's centered in world space
	Returns (pm.PyNode): The top group of the locator grid
	Usage: locatorGrid(5,5,5,2)
	'''
	if not pm.objExists('locatorGrid'):
		grp=pm.group(em=True,n='locatorGrid')
		for d in range(0,depth):
			for w in range(0,width):
				for h in range(0,height):
					loc = pm.polyCube(w=.5, h=.5, d=.5, ch=0)[0]
					pm.move(loc,(w*offset,h*offset,d*offset), rpr=True)
					loc.setParent(grp)
					if loc.getShape().type() == "locator":
						loc.localScale.set(.2,.2,.2)
		if centered:
			pm.xform(grp, cp=1)
			pm.move(grp, (0, 0, 0), rpr=1)
			pm.makeIdentity(grp, apply=True, r=1,s=1,t=1)
		return grp
开发者ID:AndresMWeber,项目名称:aw,代码行数:25,代码来源:aw_influenceGrid.py


示例12: setPosUv

def setPosUv(vtxs,length,side,uvDistorted):
    startUv = pm.ls(pm.polyListComponentConversion(vtxs[0],fv=1,tuv=1),fl=1)

    if side == 'left':
        pm.polyEditUV(startUv,r=0,u=0,v=0)
    else:
        pm.polyEditUV(startUv,r=0,u=1,v=0)
    

    for i in range(1,len(vtxs)):
        vtx1Pos = pm.xform(vtxs[i-1],q=1,t=1,ws=1)
        vtx2Pos = pm.xform(vtxs[i],q=1,t=1,ws=1)
        vtx1PosVec = MVector(vtx1Pos[0],vtx1Pos[1],vtx1Pos[2])
        vtx2PosVec = MVector(vtx2Pos[0],vtx2Pos[1],vtx2Pos[2])
        dist = (vtx2PosVec  - vtx1PosVec).length()
        
        factor=0.0
        if uvDistorted:
            factor = dist / length
        else:
            factor = 1.0 / (len(vtxs) - 1)
            
                             
        uv1 = pm.ls(pm.polyListComponentConversion(vtxs[i-1],fv=1,tuv=1),fl=1)
        uv2 = pm.ls(pm.polyListComponentConversion(vtxs[i],fv=1,tuv=1),fl=1)
        uv1Pos = pm.polyEditUV(uv1,q=1)
        uv2Pos = uv1Pos[1] + factor
        if side == 'left':
            pm.polyEditUV(uv2,r=0,u=0,v=uv2Pos)
        else:
            pm.polyEditUV(uv2,r=0,u=1,v=uv2Pos)
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:31,代码来源:bdTrailUV.py


示例13: generateShape

    def generateShape(self, *args):
        sel = pm.ls(sl=1)
        if len(sel) != 4:
            pm.mel.warning('Must select: Neutral, TargetA, TargetB, TargetC meshes')
            return
        
        meshN = sel[0]
        meshA = sel[1]
        meshB = sel[2]
        meshC = sel[3]
        
        # Create new mesh
        new = pm.duplicate(meshN, n='Corrective')[0]
        
        # Per vertex, translate in world space: C-(A+B)
        for vtx in new.vtx:
            vert = vtx.split('.')[1]
            n_pos = pmd.Point(pm.xform( vtx, query=True, ws=True, t=True))
            a_pos = pmd.Point(pm.xform( meshA + '.' + vert, query=True, ws=True, t=True))
            b_pos = pmd.Point(pm.xform( meshB + '.' + vert, query=True, ws=True, t=True))
            c_pos = pmd.Point(pm.xform( meshC + '.' + vert, query=True, ws=True, t=True))
            
            aVec = a_pos - n_pos
            bVec = b_pos - n_pos
            cVec = c_pos - n_pos

            delta = cVec - (aVec + bVec)
            
            pm.move(vtx, delta, r=1)
开发者ID:Mauricio3000,项目名称:MSH_Maya,代码行数:29,代码来源:BlendshapeCorrective.py


示例14: ChangeNumberOfJoints

	def ChangeNumberOfJoints(self, *args):
		self.blueprint_UI_instance.DeleteScriptJob()
		
		# Collect information from current spline module
		joints = self.GetJoints()
		numJoints = len(joints)
		
		newNumJoints = pm.intField(self.numberOfJointsField, query = True, value = True)
		
		startPos = pm.xform(self.GetTranslationControl(joints[0]), query = True, worldSpace = True, translation = True)
		endPos = pm.xform(self.GetTranslationControl(joints[numJoints - 1]), query = True, worldSpace = True, translation = True)
		
		hookObj = self.FindHookObjectForLock()
		
		rotateOrder = pm.getAttr("%s.rotateOrder" %joints[0])
		sao_local = pm.getAttr("%s:module_grp.sao_local" %self.moduleNamespace)
		sao_world = pm.getAttr("%s:module_grp.sao_world" %self.moduleNamespace)
		
		# Delete current spline module
		self.Delete()
		
		# Create new spline module with new joint count
		newInstance = Spline(self.userSpecifiedName, hookObj, newNumJoints, startPos, endPos)
		newInstance.Install()
		
		# Apply previous attribute values
		newJoints = newInstance.GetJoints()
		pm.setAttr("%s.rotateOrder" %newJoints[0], rotateOrder)
		pm.setAttr("%s:module_grp.sao_local" %newInstance.moduleNamespace, sao_local)
		pm.setAttr("%s:module_grp.sao_world" %newInstance.moduleNamespace, sao_world)
		
		self.blueprint_UI_instance.CreateScriptJob()
		
		pm.select("%s:module_transform" %newInstance.moduleNamespace, replace = True)
开发者ID:Shadowtags,项目名称:ModularRiggingTool,代码行数:34,代码来源:spline.py


示例15: build_between_points

 def build_between_points(cls, start_xform, end_xform, num_joints, name={'name':'chain'}, freeze=True, chain=True, parent=None, offset=False):
     """ Create joints based on given 3D spatial positions/rotations e.g. [[[10,5.3,1.4],[0,90,0]],...,nPos]
     Args:
         start_xform [pm.nt.Transform]: starting position
         end_xform [pm.nt.Transform]: ending position
         name (str): base name for the chain
         chain (bool): whether or not to make a chain, or isolated joints
         offset (bool): whether or not to build in offset groups for the joints
         parent (pm.nt.Transform): final parent of the joints, empty if kept at root level
     Returns:
         [pm.nt.Joint]: list of joints
     Usage:
         Joint.build_between_points(pm.ls(sl=True)[0], pm.ls(sl=True)[1], 5, chain=True, offset=True, freeze=True)
     """
     xform_interps = transform.spatial_interpolate(pm.xform(start_xform, q=True, t=True, ws=True),
                                                   pm.xform(end_xform, q=True, t=True, ws=True),
                                                   num_joints)
     
     rotation_interps = transform.spatial_interpolate(pm.xform(start_xform, q=True, ro=True, ws=True),
                                                      pm.xform(end_xform, q=True, ro=True, ws=True),
                                                      num_joints)
     
     positions = [[xform_interp, rotation_interp] for xform_interp, rotation_interp in zip(xform_interps, rotation_interps)]
     
     return cls.build_from_points(positions, name=name, chain=chain, parent=parent, offset=offset, freeze=freeze)
开发者ID:AndresMWeber,项目名称:Forge,代码行数:25,代码来源:joint.py


示例16: getShapePos

def getShapePos(*nodes, **kwargs):
    """
    @return: dictionary of {shapePyNode: [pointPositionList],...}
    """
    ws = kwargs.get('ws', False)
    if ws:
        space = 'world'
    else:
        space = 'preTransform'

    vertObjs, crvObjs, surfObjs = filterShapes(*nodes)
    result = {}

    for obj in vertObjs:
        assert isinstance(obj, pm.nodetypes.Mesh)
        result[obj] = obj.getPoints(space=space)

    for obj in crvObjs:
        assert (isinstance(obj, pm.nodetypes.NurbsCurve))
        result[obj] = []
        for i in range(obj.numCVs()):
            result[obj].append(pm.xform(obj.cv[i], q=True, ws=ws, t=True))
        #this might have a bug?
        #result[obj] = obj.getCVs(space='world')
        #result[obj].append(.getPosition(space='world'))
    for obj in surfObjs:
        assert(isinstance(obj, pm.nodetypes.NurbsSurface))
        result[obj] = []
        for u in range(obj.numCVsInU()):
            for v in range(obj.numCVsInV()):
                result[obj].append(pm.xform(obj.cv[u][v], q=True, ws=ws, t=True))
    return result
开发者ID:jspatrick,项目名称:beings,代码行数:32,代码来源:GeneralUtils.py


示例17: mirror_nurb

def mirror_nurb(patches, negative_x=True, reverse=False):
    """
    Args:
        patches (pm.nt.Transform): nurbsies
        negative_x (bool): mirror from +x => -x or vice versa
    Usage:
        mirror_nurb(pm.ls(sl=True, type='transform'), negative_x=True, reverse=False)
    """
    for patch in patches:
        shape = patch.getShape()
        cvu, cvv = shape.numCVsInU(), shape.numCVsInV()
        if reverse:
            cvu, cvv = shape.numCVsInV(), shape.numCVsInU()
        
        for column in range(cvv):
            even_odd = cvu % 2
            
            for row in range(cvu/2):
                if negative_x:
                    row_mirrored = row
                    row = (row*-1) - 1
                else:
                    row_mirrored = (row*-1) - 1
                
                pos = pm.xform(shape.cv[row][column], q=True,ws=True,t=True)
                pos_mirrored = [a*b for a,b in zip(pos, [-1,1,1])]
                pm.xform(shape.cv[row_mirrored][column], t=pos_mirrored, ws=True)
                
开发者ID:AndresMWeber,项目名称:aw,代码行数:27,代码来源:aw_nurbs.py


示例18: strokePath

def strokePath(node, radius=.1):
    """
    Create a nurbs surface from a curve control
    """
    curveNodes = separateShapes(node)
    for curveNode in curveNodes:
        shape = curveNode.listRelatives(type='nurbsCurve')[0]
        t = pm.pointOnCurve(shape, p=0, nt=1)
        pos = pm.pointOnCurve(shape, p=0)
        cir = pm.circle(r=radius)[0]
        pm.xform(cir, t=pos, ws=1)

        #align the circule along the curve
        l = pm.spaceLocator()
        pm.xform(l, t=[pos[0]+t[0], pos[1]+t[1], pos[2]+t[2]], ws=1)
        pm.delete(pm.aimConstraint(l, cir, aimVector=[0,0,1]))
        pm.delete(l)

        newxf = pm.extrude(cir, curveNode, rn=False, po=0, et=2, ucp=1,
                            fpt=1, upn=1, scale=1, rsp=1, ch=1)[0]
        pm.delete(cir)
        pm.delete(curveNode.listRelatives(type='nurbsCurve'))
        parentShape(curveNode, newxf)
    if len(curveNodes) > 1:
        for i in range(1, len(curveNodes)):
            parentShape(curveNodes[0], curveNodes[i])
    return curveNodes[0]
开发者ID:jspatrick,项目名称:beings,代码行数:27,代码来源:GeneralUtils.py


示例19: Snap

def Snap(target, source, translation=True, rotation=True):
    ''' Snaps source object to target object.
    If point is True, translation will snap.
    If orient is True, orientation will snap.
    If source is None, then it looks for lists for translation,rotation and scale
    '''

    #if source doesnt exists and passing in transform lists
    if not source:
        if isinstance(translation, list):
            pm.xform(target, ws=True, translation=translation)
        if isinstance(rotation, list):
            pm.xform(target, ws=True, rotation=rotation)

        return

    #translation
    if translation:
        trans = pm.xform(source, q=True, ws=True, translation=True)
        pm.xform(target, ws=True, translation=trans)

    #orientation
    if rotation:
        rot = pm.xform(source, q=True, ws=True, rotation=True)
        pm.xform(target, ws=True, rotation=rot)
开发者ID:leandropim,项目名称:Tapp,代码行数:25,代码来源:utils.py


示例20: getXProductFromNodes

def getXProductFromNodes(midObj, topObj, btmObj):
    """
    get a cross product based upon the position of the first three objects in objList
    Returns the cross product of two vectors: midObj to topObj and midObj to btmObj
    """

    #get the vectors
    midPos = pm.xform(midObj, q=True, worldSpace=True, translation=True)
    topPos = pm.xform(topObj, q=True, worldSpace=True, translation=True)
    btmPos = pm.xform(btmObj, q=True, worldSpace=True, translation=True)

    topVector = [topPos[0] - midPos[0], topPos[1] - midPos[1], topPos[2] - midPos[2]]
    btmVector = [btmPos[0] - midPos[0], btmPos[1] - midPos[1], btmPos[2] - midPos[2]]

    #create a temporary vectorProduct node
    vp = pm.createNode("vectorProduct")
    #set to cross product
    vp.operation.set(2)
    vp.input1.set(btmVector)
    vp.input2.set(topVector)

    #store the cross product
    cp = vp.output.get()

    #delete the vector node
    pm.delete(vp)
    return cp
开发者ID:jspatrick,项目名称:beings,代码行数:27,代码来源:GeneralUtils.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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