Ejemplo n.º 1
0
def alignToUV(targetObj="none", sourceObj="none", sourceU=0.0, sourceV=0.0, mainAxis="+z", secAxis="+x", UorV="v"):
	"""
	inputs should be 1. targetObj 2. sourceObj 3. sourceU 4. sourceV 5. mainAxis(lowerCase, + or -, i.e."-x" 8. secAxis (lowcase, + or -) 7, UorV ("u" or "v" for the direction along surface for the sec axis)
"""

	axisDict = {"+x":(1,0,0), "+y":(0,1,0), "+z":(0,0,1), "-x":(-1,0,0), "-y":(0,-1,0), "-z":(0,0,-1)}

	#Does this create a new node? no To create a node, use the flag "ch=True". That creates a pointOnSurface node
	pos = cmds.pointOnSurface(sourceObj, u=sourceU, v=sourceV, position=True)
	posVec = om.MVector(pos[0], pos[1], pos[2])
	cmds.xform(targetObj, ws=True, t=pos)

	#get normal, tanU and tanV at selected UV position on source surface
	tanV = cmds.pointOnSurface(sourceObj, u=sourceU, v=sourceV, tv=True)
	tanU = cmds.pointOnSurface(sourceObj, u=sourceU, v=sourceV, tu=True)
	norm = cmds.pointOnSurface(sourceObj, u=sourceU, v=sourceV, nn=True)

	#decide where up axis is on normal constraint, u or v tangent
	if UorV == "v":
		wup = tanV
	elif UorV == "u":
		wup = tanU

	#create normal constraint
	nc = cmds.normalConstraint(sourceObj, targetObj, aimVector=axisDict[mainAxis], upVector=axisDict[secAxis], worldUpVector=(wup))
	cmds.delete(nc) #delete constraint
Ejemplo n.º 2
0
def alignToUV(targetObj="none", sourceObj="none", sourceU=0.0, sourceV=0.0, mainAxis="+z", secAxis="+x", UorV="v"):
	"""
	inputs should be 1. targetObj 2. sourceObj 3. sourceU 4. sourceV 5. mainAxis(lowerCase, + or -, i.e."-x" 8. secAxis (lowcase, + or -) 7, UorV ("u" or "v" for the direction along surface for the sec axis)
"""

	axisDict = {"+x":(1,0,0), "+y":(0,1,0), "+z":(0,0,1), "-x":(-1,0,0), "-y":(0,-1,0), "-z":(0,0,-1)}

	#Does this create a new node? no To create a node, use the flag "ch=True". That creates a pointOnSurface node
	pos = cmds.pointOnSurface(sourceObj, u=sourceU, v=sourceV, position=True)
	posVec = om.MVector(pos[0], pos[1], pos[2])
	cmds.xform(targetObj, ws=True, t=pos)

	#get normal, tanU and tanV at selected UV position on source surface
	tanV = cmds.pointOnSurface(sourceObj, u=sourceU, v=sourceV, tv=True)
	tanU = cmds.pointOnSurface(sourceObj, u=sourceU, v=sourceV, tu=True)
	norm = cmds.pointOnSurface(sourceObj, u=sourceU, v=sourceV, nn=True)

	#decide where up axis is on normal constraint, u or v tangent
	if UorV == "v":
		wup = tanV
	elif UorV == "u":
		wup = tanU

	#create normal constraint
	nc = cmds.normalConstraint(sourceObj, targetObj, aimVector=axisDict[mainAxis], upVector=axisDict[secAxis], worldUpVector=(wup))
	cmds.delete(nc) #delete constraint
Ejemplo n.º 3
0
def snapPtsToSurface(surface, pointList):
    """
    @param surface: Nurbs surface to snap points to
    @type surface: str
    @param pointList: Point to snap to the specified surface
    @type pointList: list
    """
    # Check surface
    if not isSurface(surface):
        raise Exception('Object ' + surface + ' is not a valid surface!')

    # Check points
    pointList = cmds.ls(pointList, fl=True)

    # Transform types
    transform = ['transform', 'joint', 'ikHandle', 'effector']

    # Snap points
    for pt in pointList:
        # Check Transform
        if transform.count(cmds.objectType(pt)):
            snapToSurface(surface, pt, 0.0, 0.0, True, snapPivot=False)
            continue
        # Move Point
        pos = cmds.pointPosition(pt)
        (uParam, vParam) = closestPoint(surface, pos)
        sPt = cmds.pointOnSurface(surface, u=uParam, v=vParam, position=True)
        cmds.move(sPt[0], sPt[1], sPt[2], pt, ws=True, a=True)
Ejemplo n.º 4
0
def snapPtsToSurface(surface,pointList):
	'''
	@param surface: Nurbs surface to snap points to
	@type surface: str
	@param pointList: Point to snap to the specified surface
	@type pointList: list
	'''
	# Check surface
	if not isSurface(surface): raise UserInputError('Object '+surface+' is not a valid surface!')
	
	# Check points
	pointList = mc.ls(pointList,fl=True)
	
	# Transform types
	transform = ['transform','joint','ikHandle','effector']
	
	# Snap points
	for pt in pointList:
		# Check Transform
		if transform.count(mc.objectType(pt)):
			snapToSurface(surface,pt,0.0,0.0,True,snapPivot=False)
			continue
		# Move Point
		pos = mc.pointPosition(pt)
		(uParam,vParam) = closestPoint(surface,pos)
		sPt = mc.pointOnSurface(surface,u=uParam,v=vParam,position=True)
		mc.move(sPt[0],sPt[1],sPt[2],pt,ws=True,a=True)
Ejemplo n.º 5
0
def MakePointOnSurfaceNd(surface):
    mc.select ("mesh_*MouthLip")
    lx_mesh = mc.ls(sl=1)
    mc.select ("snd_mouthLip*")
    lx_sndJnt = mc.ls(sl=True )  
    lx_node ,lx_locGrp=[],[]
    for lx_i in lx_sndJnt :
        lx_temp=mc.xform(lx_i,q=1,ws =1,t=1)
        lx_locN= "loc_"+lx_i 
        mc.spaceLocator(n=lx_locN,a=1,p=(lx_temp[0],lx_temp[1],lx_temp[2]))
        lx_locGrp.append(lx_locN)
        lx_null = 'grp_'+lx_i+'02'
        mc.group(n=lx_null,em =1)
        mc.toggle (lx_null,la=1)
        mc.parent (lx_null ,('grp_'+lx_i+'01'))
        mc.parent (('grp_'+lx_i+'03'),lx_null)
        nd=mc.pointOnSurface(lx_mesh,ch=True )
        #lx_node.insert(1,nd);
        ndName = "pntNd_"+lx_i 
        mc.rename(nd,ndName )
        mc.connectAttr ((ndName +".position"),('grp_'+lx_i+'02.translate'))
        mc.setAttr (('grp_'+lx_i+'01.translate'),0,0,0,type ="double3")
        mc.setAttr (('grp_'+lx_i+'03.translate'),0,0,0,type="double3")
        mc.xform (('grp_'+lx_i+'01'),cp=True)
    mc.select(cl=1)
    mc.select(lx_locGrp )
    mc.group (n="grp_locMouthLip01")
Ejemplo n.º 6
0
    def attachObjToSurf(self, obj, surf, path, stretchAmountNode, percentage):
        '''Given an object and a surface, attach object.
        Returns created nodes like (poinOnSurface,aimCns)
        '''
        #Make nodes
        aimCns = cmds.createNode('aimConstraint', n=obj + "Cns")
        moPath = cmds.createNode('motionPath', n=obj + "MoPath")
        slider = cmds.createNode('addDoubleLinear', n=obj + "Slider")
        cmds.setAttr(moPath + ".uValue", percentage)
        closePnt = cmds.createNode('closestPointOnSurface', n=obj + "ClsPnt")
        posNode1 = cmds.pointOnSurface(surf,
                                       constructionHistory=True,
                                       normal=True,
                                       normalizedNormal=True,
                                       normalizedTangentU=True,
                                       normalizedTangentV=True,
                                       parameterV=0.5,
                                       parameterU=0.5,
                                       turnOnPercentage=True)

        #Connect motion Path to closest point, then closest point to surface info node
        cmds.setAttr(moPath + ".fractionMode", 1)  #distance instead of param
        cmds.connectAttr(path + ".worldSpace[0]", moPath + ".geometryPath")
        cmds.connectAttr(surf + ".worldSpace[0]", closePnt + ".inputSurface")
        cmds.connectAttr(moPath + ".xCoordinate", closePnt + ".ipx")
        cmds.connectAttr(moPath + ".yCoordinate", closePnt + ".ipy")
        cmds.connectAttr(moPath + ".zCoordinate", closePnt + ".ipz")
        cmds.connectAttr(closePnt + ".result.u", posNode1 + ".u")
        cmds.connectAttr(closePnt + ".result.v", posNode1 + ".v")

        #Create Stretch Setup using stretchAmountNode node
        stretchCtrl = cmds.createNode("multDoubleLinear",
                                      n=obj + "StretchCtrl")
        cmds.setAttr(stretchCtrl + ".i1", percentage)
        cmds.connectAttr(stretchAmountNode + ".outputX", stretchCtrl + ".i2")
        cmds.connectAttr(stretchCtrl + ".o", slider + ".i1")
        cmds.connectAttr(slider + ".o", moPath + ".uValue")

        #Hook up surface info attrs to aimCns to calculate rotation values
        #Then hook pointOnSurface and aimCns to locator
        posNode1 = cmds.rename(posNode1, obj + 'SurfInfo')
        cmds.setAttr(aimCns + ".worldUpType", 3)
        cmds.connectAttr(posNode1 + ".position", obj + ".translate")
        cmds.connectAttr(posNode1 + '.tv',
                         aimCns + '.target[0].targetTranslate')
        cmds.connectAttr(posNode1 + '.tu', aimCns + '.worldUpVector')
        for axis in ('X', 'Y', 'Z'):
            cmds.connectAttr(aimCns + ".constraintRotate" + axis,
                             obj + ".rotate" + axis)
        cmds.parent(aimCns, obj)  #just for tidyness, doesn't matter
        return (posNode1, aimCns, moPath, slider)
Ejemplo n.º 7
0
def create_splitter_joint(splitter_surface='', number_of_joint=5, parameter=0.5):
    result = []
    
    surface_shape = cmds.listRelatives(splitter_surface, s=True)[0]
    
    for i in range(number_of_joint + 1):
        position = cmds.pointOnSurface(surface_shape,  u=i, v=parameter, position=True)
        
        cmds.select(clear=True)
        joint = cmds.joint(position = position)
        
        result.append(joint)
        
    return result        
Ejemplo n.º 8
0
 def attachObjToSurf(self,obj,surf,path,stretchAmountNode,percentage):
     '''Given an object and a surface, attach object.
     Returns created nodes like (poinOnSurface,aimCns)
     '''
     #Make nodes
     aimCns = cmds.createNode('aimConstraint',n=obj + "Cns")
     moPath = cmds.createNode('motionPath', n=obj + "MoPath")
     slider = cmds.createNode('addDoubleLinear',n=obj + "Slider")
     cmds.setAttr(moPath + ".uValue", percentage)
     closePnt = cmds.createNode('closestPointOnSurface', n=obj + "ClsPnt")
     posNode1 = cmds.pointOnSurface(surf,
         constructionHistory=True,
         normal=True,
         normalizedNormal=True, 
         normalizedTangentU=True, 
         normalizedTangentV=True, 
         parameterV=0.5, 
         parameterU=0.5, 
         turnOnPercentage=True
     ) 
     
     #Connect motion Path to closest point, then closest point to surface info node
     cmds.setAttr(moPath + ".fractionMode", 1) #distance instead of param
     cmds.connectAttr(path + ".worldSpace[0]", moPath + ".geometryPath")
     cmds.connectAttr(surf + ".worldSpace[0]", closePnt + ".inputSurface")
     cmds.connectAttr(moPath + ".xCoordinate", closePnt + ".ipx")
     cmds.connectAttr(moPath + ".yCoordinate", closePnt + ".ipy")
     cmds.connectAttr(moPath + ".zCoordinate", closePnt + ".ipz")
     cmds.connectAttr(closePnt + ".result.u", posNode1 + ".u")
     cmds.connectAttr(closePnt + ".result.v", posNode1 + ".v") 
     
     #Create Stretch Setup using stretchAmountNode node
     stretchCtrl = cmds.createNode("multDoubleLinear", n=obj + "StretchCtrl")
     cmds.setAttr(stretchCtrl + ".i1", percentage)
     cmds.connectAttr(stretchAmountNode + ".outputX",stretchCtrl + ".i2")
     cmds.connectAttr(stretchCtrl + ".o", slider + ".i1")
     cmds.connectAttr(slider + ".o", moPath + ".uValue")
     
     #Hook up surface info attrs to aimCns to calculate rotation values
     #Then hook pointOnSurface and aimCns to locator
     posNode1 = cmds.rename(posNode1,obj + 'SurfInfo')
     cmds.setAttr(aimCns + ".worldUpType", 3)
     cmds.connectAttr(posNode1 + ".position", obj + ".translate")
     cmds.connectAttr(posNode1 + '.tv',aimCns + '.target[0].targetTranslate')
     cmds.connectAttr(posNode1 + '.tu',aimCns + '.worldUpVector')
     for axis in ('X','Y','Z'):
         cmds.connectAttr(aimCns + ".constraintRotate" + axis, obj + ".rotate" + axis)
     cmds.parent(aimCns,obj) #just for tidyness, doesn't matter
     return (posNode1,aimCns,moPath,slider)
Ejemplo n.º 9
0
def distToSurface(surface, pos=(0, 0, 0)):
    """
    """
    # Get point world position
    pos = glTools.utils.base.getPosition(pos)

    # Get closest point to surface
    uv = closestPoint(surface, pos)
    pt = cmds.pointOnSurface(surface, u=uv[0], v=uv[1], p=True)

    # Get distance to surface point
    dist = glTools.utils.mathUtils.distanceBetween(pos, pt)

    # Return Result
    return dist
Ejemplo n.º 10
0
def add(surface,
        targetList,
        surfacePointsNode='',
        alignTo='u',
        rotate=True,
        tangentUAxis='x',
        tangentVAxis='y',
        prefix=''):
    '''
	@param surface: Nurbs surface to constrain to
	@type surface: str
	@param targetList: List of target transforms/positions/coordinates
	@type targetList: list
	@param surfacePointsNode: Name for a new or existing surfacePoints node
	@type surfacePointsNode: str
	@param alignTo: Surface direction to align to. This option is ignored if the specified surface points node already exists
	@type alignTo: str
	@param rotate: Calculate rotation
	@type rotate: bool
	@param tangentUAxis: Transform axis to align with the surface U tangent
	@type tangentUAxis: str
	@param tangentVAxis: Transform axis to align with the surface V tangent
	@type tangentVAxis: str
	@param prefix: Name prefix for newly created nodes
	@type prefix: str
	'''
    # Check surface
    if not glTools.utils.surface.isSurface(surface):
        raise UserInputError('Object "" is not a valid nurbs surface!!')

    # Check prefix
    nameUtil = glTools.common.namingConvention.NamingConvention()
    if not prefix: prefix = nameUtil.stripSuffix(surface)

    # Check targetList
    if not targetList: raise UserInputError('Invalid target list!!')

    # Check surfacePoints node
    if not surfacePointsNode:
        surfacePointsNode = nameUtil.appendName(prefix,
                                                nameUtil.node['surfacePoints'],
                                                stripNameSuffix=False)
    if mc.objExists(surfacePointsNode):
        if not mc.objectType(surfacePointsNode) == 'surfacePoints':
            raise UserInputError('Object "' + surfacePointsNode +
                                 '" is not a valid surfacePoints node!!')
    else:
        # Create new surface points node
        surfacePointsNode = mc.createNode('surfacePoints', n=surfacePointsNode)
        mc.connectAttr(surface + '.worldSpace[0]',
                       surfacePointsNode + '.inputSurface')
        # Apply settings
        mc.setAttr(surfacePointsNode + '.calculateRotation', rotate)
        if alignTo == 'u': mc.setAttr(surfacePointsNode + '.alignTo', 0)
        else: mc.setAttr(surfacePointsNode + '.alignTo', 1)
        # Tangent Axis
        axisDict = {'x': 0, 'y': 1, 'z': 2, '-x': 3, '-y': 4, '-z': 5}
        mc.setAttr(surfacePointsNode + '.tangentUAxis', axisDict[tangentUAxis])
        mc.setAttr(surfacePointsNode + '.tangentVAxis', axisDict[tangentVAxis])

    # Find next available input index
    nextIndex = getNextAvailableIndex(surfacePointsNode)

    # Create surface constraints
    transformList = []
    for i in range(len(targetList)):

        # Get current input index
        ind = str(nextIndex + i)
        if int(ind) < 10: ind = '0' + ind

        # Initialize UV parameter variable
        uv = (0.0, 0.0)
        pos = (0.0, 0.0, 0.0)
        # Get target surface point for current target
        if type(targetList[i]) == str or type(targetList[i]) == unicode:
            if not mc.objExists(targetList[i]):
                raise UserInputError('Target list object "' + targetList[i] +
                                     '" does not exist')
            pos = mc.pointPosition(targetList[i])
            uv = glTools.utils.surface.closestPoint(surface, pos)
        elif type(targetList[i]) == tuple or type(targetList[i]) == list:
            if len(targetList[i]) == 3:
                pos = targetList[i]
                uv = glTools.utils.surface.closestPoint(surface, pos)
            elif len(targetList[i]) == 2:
                uv = targetList[i]
                pos = mc.pointOnSurface(surface, u=uv[0], v=uv[1], p=True)
        paramU = uv[0]
        paramV = uv[1]

        # Get surface point information
        pnt = mc.pointOnSurface(surface, u=paramU, v=paramV, p=True)
        normal = mc.pointOnSurface(surface, u=paramU, v=paramV, nn=True)
        tangentU = mc.pointOnSurface(surface, u=paramU, v=paramV, ntu=True)
        tangentV = mc.pointOnSurface(surface, u=paramU, v=paramV, ntv=True)

        # Clamp param to safe values
        minU = mc.getAttr(surface + '.minValueU')
        maxU = mc.getAttr(surface + '.maxValueU')
        minV = mc.getAttr(surface + '.minValueV')
        maxV = mc.getAttr(surface + '.maxValueV')
        if paramU < (minU + 0.001): paramU = minU
        elif paramU > (maxU - 0.001): paramU = maxU
        if paramV < (minV + 0.001): paramV = minV
        elif paramV > (maxV - 0.001): paramV = maxV

        # Create constraint transform
        transform = nameUtil.appendName(prefix,
                                        nameUtil.subPart['surfacePoint'] +
                                        ind + nameUtil.delineator +
                                        nameUtil.node['transform'],
                                        stripNameSuffix=False)
        transform = mc.createNode('transform', n=transform)
        transformList.append(transform)

        # Add param attributes
        mc.addAttr(transform, ln='param', at='compound', numberOfChildren=2)
        mc.addAttr(transform,
                   ln='paramU',
                   at='double',
                   min=minU,
                   max=maxU,
                   dv=paramU,
                   k=True,
                   p='param')
        mc.addAttr(transform,
                   ln='paramV',
                   at='double',
                   min=minV,
                   max=maxV,
                   dv=paramV,
                   k=True,
                   p='param')

        # Connect to surfacePoints node
        #mc.setAttr(surfacePointsNode+'.offset['+ind+']',offsetU,offsetV,offsetN)
        mc.connectAttr(transform + '.param',
                       surfacePointsNode + '.param[' + ind + ']',
                       f=True)
        mc.connectAttr(transform + '.parentMatrix',
                       surfacePointsNode + '.targetMatrix[' + ind + ']',
                       f=True)

        # Connect to transform
        mc.connectAttr(surfacePointsNode + '.outTranslate[' + ind + ']',
                       transform + '.translate',
                       f=True)
        if rotate:
            mc.connectAttr(surfacePointsNode + '.outRotate[' + ind + ']',
                           transform + '.rotate',
                           f=True)

    # Return result
    return (surfacePointsNode, transformList)
Ejemplo n.º 11
0
def get_closest_point_data(targetSurface = None, targetObj = None, targetPoint = None):
    """
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    DESCRIPTION:
    Returns pertinent info of the closest point of a mesh to a target object -
    position, normal, parameterU,parameterV,closestFaceIndex,closestVertexIndex

    ARGUMENTS:
    targetObj(string)
    mesh(string)

    RETURNS:
    closestPointInfo(dict)
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    """
    try:
        _str_func = 'get_closest_point_data'
        
        _point = False
        if targetObj is not None:
            _point = POS.get(targetObj)
        elif targetPoint:
            _point = targetPoint
        if not _point:raise ValueError,"Must have point of reference"
        
        _loc = mc.spaceLocator()[0]
        POS.set(_loc,_point)  
        
        _created = create_closest_point_node(_loc, targetSurface,singleReturn=True)
            
        _node = _created[1]
        _shape = _created[2]
        _type = _created[3]

        #_norm = get_normalized_uv(_shape, _u,_v)
        _res = {}
        
        _res['shape'] = _shape
        _res['type'] = _type
        _res['position']=ATTR.get(_node,'position')
        _res['normal']=ATTR.get(_node,'normal')
        
        if _type == 'nurbsCurve':
            _res['parameter']= ATTR.get(_node,'parameter')
        else:
            _u = mc.getAttr(_node+'.parameterU')
            _v = mc.getAttr(_node+'.parameterV')
            _res['parameterU']= _u
            _res['parameterV']= _v
            
            if _type == 'nurbsSurface':
                _norm = get_normalized_uv(_shape, _u,_v)
                _res['normUV'] = _norm['uv']
                _res['normalizedU'] = _norm['uValue']
                _res['normalizedV'] = _norm['vValue']
                
                _res['normal'] = mc.pointOnSurface([targetSurface], u = _u, v= _v, normal=True)
                _res['normalizedNormal'] = mc.pointOnSurface([targetSurface],u = _u, v= _v,
                                                             normalizedNormal=True)
                
            else:
                _res['closestFaceIndex']=mc.getAttr(_node+'.closestFaceIndex')
                _res['closestVertexIndex']=mc.getAttr(_node+'.closestVertexIndex')
        mc.delete([_loc],_created[0],_node)
        return _res
    except Exception,err:cgmGEN.cgmExceptCB(Exception,err)
Ejemplo n.º 12
0
mc.setAttr("bs_MouthKouXingBase.mesh_KouXingBase", 1)
mc.setAttr("bs_MouthKouXingBase.mesh_KouXingBase", lock=True)

# ########################### 华丽丽的分隔线 ##################################################

import maya.cmds as mc
#根据骨骼点的数量在mesh上生成相应数量pointOnSurface node

# 在生成的同时,生成对应数量的空组,并显示局部坐标
lx_mesh = mc.ls(sl=1)

lx_jnt = mc.ls(sl=1)
lx_node = []
for lx_temp in lx_jnt:
    nd = mc.pointOnSurface(lx_mesh, ch=True)
    lx_node.insert(1, nd)
    mc.rename(nd, "pntNd_" + lx_temp)
    mc.group(empty=1, n=("nl_" + lx_temp))
    mc.connectAttr(("pntNd_" + lx_temp + ".position"),
                   ("nl_" + lx_temp + ".translate"))
    mc.toggle(("nl_" + lx_temp), localAxis=1)

import maya.cmds as mc
# 合并上一步生成的空组和之前生成的次级骨骼的组。
lx_jntgrp = mc.ls(sl=1)
lx_nlgrp = mc.ls("nl_*")

for lx_i in lx_jntgrp:
    lx_chr = "grp_" + lx_i + "01"
    lx_pnt = "nl_" + lx_i
Ejemplo n.º 13
0
def setNeighbour(vertexList=[],
                 referenceObject='',
                 dnDirectionalSmoothNode='',
                 direction='u'):
    '''
	'''
    # Flatten vertex list
    vertexList = mc.ls(vertexList, fl=True)

    # Get dnDirectionalSmoothNode object and target plug
    sel = OpenMaya.MSelectionList()
    OpenMaya.MGlobal.getSelectionListByName(dnDirectionalSmoothNode, sel)
    dnDirectionalSmoothNodeObj = OpenMaya.MObject()
    sel.getDependNode(0, dnDirectionalSmoothNodeObj)
    dnDirectionalSmoothNodeNode = OpenMaya.MFnDependencyNode(
        dnDirectionalSmoothNodeObj)
    neighbourDataPlug = dnDirectionalSmoothNodeNode.findPlug('neighbourData')
    neighbourDataArrayPlug = neighbourDataPlug.elementByLogicalIndex(0)

    # Check reference object
    isCurve = True
    if not glTools.utils.curve.isCurve(referenceObject):
        isCurve = False
    elif not glTools.utils.curve.isSurface(referenceObject):
        raise UserInputError(
            'Reference object must be a valid nurbs curve or surface!!')

    # Create neighbourData object
    neighbourData = OpenMaya.MVectorArray()

    # Get mesh and vertex list
    mesh = glTools.utils.component.getComponentIndexList(vertexList).keys()[0]

    # Get vertexIterator for mesh
    sel = OpenMaya.MSelectionList()
    OpenMaya.MGlobal.getSelectionListByName(mesh, sel)
    meshObj = OpenMaya.MObject()
    sel.getDependNode(0, meshObj)
    meshIt = OpenMaya.MItMeshVertex(meshObj)

    # Get neighbour data
    neighbourIndexList = OpenMaya.MIntArray()
    for i in range(len(vertexList)):

        # Get current point
        pnt = mc.pointPosition(vertexList[i])
        pntId = glTools.utils.component.getComponentIndexList([vertexList[i]
                                                               ])[mesh][0]

        # Get closest U tangent
        if isCurve:
            u = glTools.utils.curve.closestPoint(referenceObject, pnt)
            tan = mc.pointOnCurve(referenceObject, pr=u, nt=True)
        else:
            uv = glTools.utils.surface.closestPoint(referenceObject, pnt)
            tan = [0, 0, 0]
            if direction == 'u':
                tan = mc.pointOnSurface(referenceObject,
                                        u=uv[0],
                                        v=uv[1],
                                        ntu=True)
            elif direction == 'v':
                tan = mc.pointOnSurface(referenceObject,
                                        u=uv[0],
                                        v=uv[1],
                                        ntv=True)
            else:
                raise Exception('Invalid direction value!')
        tan = glTools.utils.mathUtils.normalizeVector(tan)

        # Get neighbouring points
        conFaces = mc.ls(mc.polyListComponentConversion(vertexList[i],
                                                        fv=True,
                                                        tf=True),
                         fl=True)
        conVerts = mc.ls(mc.polyListComponentConversion(conFaces,
                                                        ff=True,
                                                        tv=True),
                         fl=True)
        conVertList = glTools.utils.component.getComponentIndexList(
            conVerts)[mesh]

        # Determine neighbours
        n1Id = -1
        n2Id = -1
        n1Dist = 0.5
        n2Dist = 0.5
        minDot = 0.0
        maxDot = 0.0
        # Iterate through connected verts
        for n in range(len(conVertList)):
            nPnt = mc.pointPosition(mesh + '.vtx[' + str(conVertList[n]) + ']')
            dist = glTools.utils.mathUtils.offsetVector(pnt, nPnt)
            nDist = glTools.utils.mathUtils.normalizeVector(dist)
            dot = glTools.utils.mathUtils.dotProduct(tan, nDist)
            if dot > maxDot:
                n1Id = conVertList[n]
                n1Dist = glTools.utils.mathUtils.mag(dist)
                maxDot = dot
            if dot < minDot:
                n2Id = conVertList[n]
                n2Dist = glTools.utils.mathUtils.mag(dist)
                minDot = dot

        # Build neighbour data vector
        tDist = n1Dist + n2Dist
        n1Dist = 1.0 - (n1Dist / tDist)
        n2Dist = 1.0 - (n2Dist / tDist)
        neighbourData.append(
            OpenMaya.MVector(float(pntId), n1Id + n1Dist, n2Id + n2Dist))

    # Set value
    neighbourDataArrayPlug.setMObject(
        OpenMaya.MFnVectorArrayData().create(neighbourData))

    # Return result
    return neighbourData
Ejemplo n.º 14
0
def orientToSurface(surface,
                    obj,
                    uValue=0.0,
                    vValue=0.0,
                    useClosestPoint=False,
                    tangentUAxis='x',
                    tangentVAxis='y',
                    alignTo='u'):
    """
    Orient object to a specified point on a surface.
    @param surface: Surface to orient object to
    @type surface: str
    @param obj: Object to orient
    @type obj: str
    @param uValue: U Paramater value of the surface to orient to
    @type uValue: float
    @param vValue: V Paramater value of the surface to orient to
    @type vValue: float
    @param useClosestPoint: Use the closest point on the surface instead of the specified uv parameter
    @type useClosestPoint: bool
    @param tangentUAxis: Basis axis that will be derived from the U tangent of the surface point
    @type tangentUAxis: str
    @param tangentVAxis: Basis axis that will be derived from the V tangent of the surface point
    @type tangentVAxis: str
    @param upAxis: Basis axis that will be derived from the upVector
    @type upAxis: str
    """
    # Check surface
    if not isSurface(surface):
        raise Exception('Object ' + surface + ' is not a valid surface!!')
    # Check Obj
    transform = ['transform', 'joint', 'ikHandle', 'effector']
    if not transform.count(cmds.objectType(obj)):
        raise Exception('Object ' + obj + ' is not a valid transform!!')
    # Check uValue/vValue
    minu = cmds.getAttr(surface + '.minValueU')
    maxu = cmds.getAttr(surface + '.maxValueU')
    minv = cmds.getAttr(surface + '.minValueV')
    maxv = cmds.getAttr(surface + '.maxValueV')
    # Closest Point
    if useClosestPoint:
        pos = cmds.xform(obj, q=True, ws=True, rp=True)
        (uValue, vValue) = closestPoint(surface, pos)
    # Verify surface parameter
    if uValue < minu or uValue > maxu:
        raise Exception('U paramater ' + str(uValue) +
                        ' is not within the U parameter range for ' + surface +
                        '!!')
    if vValue < minv or vValue > maxv:
        raise Exception('V paramater ' + str(uValue) +
                        ' is not within the V parameter range for ' + surface +
                        '!!')

    # Check object
    if not cmds.objExists(obj):
        raise Exception('Object ' + obj + ' does not exist!!')
    rotateOrder = cmds.getAttr(obj + '.ro')

    # Get tangents at surface point
    tanU = cmds.pointOnSurface(surface, u=uValue, v=vValue, ntu=True)
    tanV = cmds.pointOnSurface(surface, u=uValue, v=vValue, ntv=True)

    # Build rotation matrix
    aimVector = tanU
    if alignTo == 'v': aimVector = tanV
    upVector = tanV
    if alignTo == 'v': upVector = tanU
    aimAxis = tangentUAxis
    if alignTo == 'v': aimAxis = tangentVAxis
    upAxis = tangentVAxis
    if alignTo == 'v': upAxis = tangentUAxis

    mat = glTools.utils.matrix.buildRotation(aimVector, upVector, aimAxis,
                                             upAxis)
    rot = glTools.utils.matrix.getRotation(mat, rotateOrder)

    # Orient object to surface
    cmds.rotate(rot[0], rot[1], rot[2], obj, a=True, ws=True)
Ejemplo n.º 15
0
def buildRig(surface, uValue):
    '''
	Build basic groom surface scuplting rig.
	@param surface: Surface to build joints along
	@type surface: str
	@param uValue: U isoparm to build joints along
	@type uValue: float
	'''
    # ==========
    # - Checks -
    # ==========

    if not glTools.utils.surface.isSurface(surface):
        raise Exception('Object "' + surface + '" is not a valid surface!')

    # Check Domain
    if uValue > mc.getAttr(surface + '.maxValueU'):
        raise Exception('U value "' + str(uValue) +
                        '" is outside the parameter range!')
    if uValue < mc.getAttr(surface + '.minValueU'):
        raise Exception('U value "' + str(uValue) +
                        '" is outside the parameter range!')

    # Check SkinCluster
    skinCluster = glTools.utils.skinCluster.findRelatedSkinCluster(surface)
    if skinCluster:
        raise Exception('Surface "' + skinCluster +
                        '" is already attached to an existing skinCluster!')

    # Get Surface Info
    surfFn = glTools.utils.surface.getSurfaceFn(surface)
    cvs = surfFn.numCVsInU()

    # ================
    # - Build Joints -
    # ================

    # Extract IsoParm
    crv = mc.duplicateCurve(surface + '.u[' + str(uValue) + ']', ch=False)[0]

    # Get Curve Points
    pts = glTools.utils.base.getPointArray(crv)
    mc.delete(crv)

    # Create Joint Chain
    jnts = []
    mc.select(cl=True)
    for i in range(len(pts)):
        # Select Prev Joint
        if i: mc.select(jnts[-1])
        # Get Index String
        ind = glTools.utils.stringUtils.stringIndex(i)
        # Create Joint
        jnt = mc.joint(p=pts[i], n=surface + str(i) + '_jnt')
        # Append Return List
        jnts.append(jnt)
    for i in range(len(pts)):
        # Orient Joint
        uv = glTools.utils.surface.closestPoint(surface, pos=pts[i])
        uTangent = mc.pointOnSurface(surface, u=uv[0], v=uv[1], ntu=True)
        glTools.utils.joint.orient(jnts[i], upVec=uTangent)

    # ======================
    # - Create SkinCluster -
    # ======================

    skinCluster = mc.skinCluster(surface, jnts, tsb=True)[0]

    # Clear Weights
    glTools.utils.skinCluster.clearWeights(surface)
    # Set Weights
    for i in range(len(pts)):
        # Generate Weights
        wts = []
        for k in range(cvs):
            for n in range(len(pts)):
                if i == n:
                    wts.append(1.0)
                else:
                    wts.append(0.0)
        # Set Influence Weights
        glTools.utils.skinCluster.setInfluenceWeights(skinCluster,
                                                      jnts[i],
                                                      wts,
                                                      normalize=False)

    # =================
    # - Return Result -
    # =================

    return jnts
Ejemplo n.º 16
0
def altRivet():
    sel = cmds.ls(sl=True, fl=True)
    for N in sel:
        obj = N
        jack = obj.split(".")[0]
    cmds.select(sel)
    obj = cmds.ls(sl=True, fl=True)
    for e in obj:
        lofta = cmds.loft(obj,
                          ch=1,
                          u=True,
                          c=False,
                          ar=False,
                          d=3,
                          ss=True,
                          rn=False,
                          po=False,
                          rsn=True)
        renamE = cmds.rename(lofta[1], "Riv_Loft")
        infoNode = cmds.pointOnSurface(lofta[0], ch=True, u=0.55, v=0.33)
        infoSetAtt = cmds.setAttr(infoNode + ".turnOnPercentage", 1)
        infoNodeRen = cmds.rename(infoNode, renamE + "pointOnSurfaceUI")
        conPos = cmds.connectAttr(renamE + ".outputSurface",
                                  infoNodeRen + ".inputSurface",
                                  f=True)
        matrixFourNode = cmds.shadingNode("fourByFourMatrix",
                                          asUtility=True,
                                          n=renamE + "_matrixFourNode")

        connNorX = cmds.connectAttr(infoNodeRen + ".normalizedNormalX",
                                    matrixFourNode + ".in00",
                                    f=True)
        connNorY = cmds.connectAttr(infoNodeRen + ".normalizedNormalY",
                                    matrixFourNode + ".in01",
                                    f=True)
        connNorZ = cmds.connectAttr(infoNodeRen + ".normalizedNormalZ",
                                    matrixFourNode + ".in02",
                                    f=True)

        connTanUX = cmds.connectAttr(infoNodeRen + ".normalizedTangentUX",
                                     matrixFourNode + ".in10",
                                     f=True)
        connTanUY = cmds.connectAttr(infoNodeRen + ".normalizedTangentUY",
                                     matrixFourNode + ".in11",
                                     f=True)
        connTanUZ = cmds.connectAttr(infoNodeRen + ".normalizedTangentUZ",
                                     matrixFourNode + ".in12",
                                     f=True)

        connTanVX = cmds.connectAttr(infoNodeRen + ".normalizedTangentVX",
                                     matrixFourNode + ".in20",
                                     f=True)
        connTanVY = cmds.connectAttr(infoNodeRen + ".normalizedTangentVY",
                                     matrixFourNode + ".in21",
                                     f=True)
        connTanVZ = cmds.connectAttr(infoNodeRen + ".normalizedTangentVZ",
                                     matrixFourNode + ".in22",
                                     f=True)

        connPosX = cmds.connectAttr(infoNodeRen + ".positionX",
                                    matrixFourNode + ".in30",
                                    f=True)
        connPosY = cmds.connectAttr(infoNodeRen + ".positionY",
                                    matrixFourNode + ".in31",
                                    f=True)
        connPosZ = cmds.connectAttr(infoNodeRen + ".positionZ",
                                    matrixFourNode + ".in32",
                                    f=True)

        matrixDecompNode = cmds.shadingNode("decomposeMatrix",
                                            asUtility=True,
                                            n=renamE + "_matrixDecompose")
        connDeMat = cmds.connectAttr(matrixFourNode + ".output",
                                     matrixDecompNode + ".inputMatrix",
                                     f=True)
        matrixGrp = cmds.group(em=True, n="matrixRivet")
        matrixGrpTrn = cmds.connectAttr(matrixDecompNode + ".outputTranslate",
                                        matrixGrp + ".translate",
                                        f=True)
        matrixGrpRot = cmds.connectAttr(matrixDecompNode + ".outputRotate",
                                        matrixGrp + ".rotate",
                                        f=True)

        for u in matrixGrp:
            mel.eval(
                'curve -d 1 -p 0 1 0 -p 0 0.987688 -0.156435 -p 0 0.951057 -0.309017 -p 0 0.891007 -0.453991 -p 0 0.809017 -0.587786 -p 0 0.707107 -0.707107 -p 0 0.587785 -0.809017 -p 0 0.453991 -0.891007 -p 0 0.309017 -0.951057 -p 0 0.156434 -0.987689 -p 0 0 -1 -p 0 -0.156434 -0.987689 -p 0 -0.309017 -0.951057 -p 0 -0.453991 -0.891007 -p 0 -0.587785 -0.809017 -p 0 -0.707107 -0.707107 -p 0 -0.809017 -0.587786 -p 0 -0.891007 -0.453991 -p 0 -0.951057 -0.309017 -p 0 -0.987688 -0.156435 -p 0 -1 0 -p -4.66211e-09 -0.987688 0.156434 -p -9.20942e-09 -0.951057 0.309017 -p -1.353e-08 -0.891007 0.453991 -p -1.75174e-08 -0.809017 0.587785 -p -2.10734e-08 -0.707107 0.707107 -p -2.41106e-08 -0.587785 0.809017 -p -2.65541e-08 -0.453991 0.891007 -p -2.83437e-08 -0.309017 0.951057 -p -2.94354e-08 -0.156434 0.987688 -p -2.98023e-08 0 1 -p -2.94354e-08 0.156434 0.987688 -p -2.83437e-08 0.309017 0.951057 -p -2.65541e-08 0.453991 0.891007 -p -2.41106e-08 0.587785 0.809017 -p -2.10734e-08 0.707107 0.707107 -p -1.75174e-08 0.809017 0.587785 -p -1.353e-08 0.891007 0.453991 -p -9.20942e-09 0.951057 0.309017 -p -4.66211e-09 0.987688 0.156434 -p 0 1 0 -p -0.156435 0.987688 0 -p -0.309017 0.951057 0 -p -0.453991 0.891007 0 -p -0.587785 0.809017 0 -p -0.707107 0.707107 0 -p -0.809017 0.587785 0 -p -0.891007 0.453991 0 -p -0.951057 0.309017 0 -p -0.987689 0.156434 0 -p -1 0 0 -p -0.987689 -0.156434 0 -p -0.951057 -0.309017 0 -p -0.891007 -0.453991 0 -p -0.809017 -0.587785 0 -p -0.707107 -0.707107 0 -p -0.587785 -0.809017 0 -p -0.453991 -0.891007 0 -p -0.309017 -0.951057 0 -p -0.156435 -0.987688 0 -p 0 -1 0 -p 0.156434 -0.987688 0 -p 0.309017 -0.951057 0 -p 0.453991 -0.891007 0 -p 0.587785 -0.809017 0 -p 0.707107 -0.707107 0 -p 0.809017 -0.587785 0 -p 0.891006 -0.453991 0 -p 0.951057 -0.309017 0 -p 0.987688 -0.156434 0 -p 1 0 0 -p 0.951057 0 -0.309017 -p 0.809018 0 -0.587786 -p 0.587786 0 -0.809017 -p 0.309017 0 -0.951057 -p 0 0 -1 -p -0.309017 0 -0.951057 -p -0.587785 0 -0.809017 -p -0.809017 0 -0.587785 -p -0.951057 0 -0.309017 -p -1 0 0 -p -0.951057 0 0.309017 -p -0.809017 0 0.587785 -p -0.587785 0 0.809017 -p -0.309017 0 0.951057 -p -2.98023e-08 0 1 -p 0.309017 0 0.951057 -p 0.587785 0 0.809017 -p 0.809017 0 0.587785 -p 0.951057 0 0.309017 -p 1 0 0 -p 0.987688 0.156434 0 -p 0.951057 0.309017 0 -p 0.891006 0.453991 0 -p 0.809017 0.587785 0 -p 0.707107 0.707107 0 -p 0.587785 0.809017 0 -p 0.453991 0.891007 0 -p 0.309017 0.951057 0 -p 0.156434 0.987688 0 -p 0 1 0 ;'
            )
            cmds.addAttr(matrixGrp,
                         at='enum',
                         keyable=True,
                         en='Off:On',
                         ln='ShapeVis')
            cmds.addAttr(matrixGrp, at='double', keyable=True, ln='parameterU')
            cmds.addAttr(matrixGrp, at='double', keyable=True, ln='parameterV')
            cmds.setAttr(matrixGrp + '.parameterU', 0.500)
            cmds.setAttr(matrixGrp + '.parameterV', 0.500)
            cmds.connectAttr(matrixGrp + '.parameterU',
                             infoNodeRen + '.parameterU',
                             f=True)
            cmds.connectAttr(matrixGrp + '.parameterV',
                             infoNodeRen + '.parameterV',
                             f=True)

            infoNode

            myCircle = cmds.ls(sl=True, fl=True)
            myshp = cmds.listRelatives(myCircle[0], shapes=True)
            reN = cmds.rename(myshp, matrixGrp + 'Shape')
            cmds.parent(myCircle[0], matrixGrp)
            cmds.makeIdentity(myCircle[0], apply=False, t=1, r=1, s=1, n=0)
            cmds.parent(reN, matrixGrp, r=1, s=1)
            cmds.delete(myCircle[0])
            break
        cmds.delete(lofta[0])
        break
Ejemplo n.º 17
0
def neighbour(vertexList, referenceObject, meshRelax):
    '''
	'''
    # Get meshRelax object and target plug
    sel = OpenMaya.MSelectionList()
    OpenMaya.MGlobal.getSelectionListByName(meshRelax, sel)
    meshRelaxObj = OpenMaya.MObject()
    sel.getDependNode(0, meshRelaxObj)
    meshRelaxNode = OpenMaya.MFnDependencyNode(meshRelaxObj)
    neighbourDataPlug = meshRelaxNode.findPlug('neighbourData')
    neighbourDataArrayPlug = neighbourDataPlug.elementByLogicalIndex(0)

    # Check reference object
    isCurve = True
    if not glTools.utils.curve.isCurve(referenceObject):
        isCurve = False
    elif not glTools.utils.curve.isSurface(referenceObject):
        raise UserInputError(
            'Reference object must be a valid nurbs curve or surface!!')

    # Create neighbourData object
    neighbourData = OpenMaya.MVectorArray()

    # Get mesh and vertex list
    mesh = glTools.utils.component.getComponentIndexList(vertexList).keys()[0]

    # Get vertexIterator for mesh
    sel = OpenMaya.MSelectionList()
    OpenMaya.MGlobal.getSelectionListByName(mesh, sel)
    meshObj = OpenMaya.MObject()
    sel.getDependNode(0, meshObj)
    meshIt = OpenMaya.MItMeshVertex(meshObj)

    # Get neighbour data
    for i in range(len(vertexList)):

        # Get current point
        pnt = mc.pointPosition(vertexList[i])
        pntId = glTools.utils.component.getComponentIndexList([vertexList[i]
                                                               ])[mesh][0]

        # Get closest U tangent
        if isCurve:
            u = glTools.utils.curve.closestPoint(referenceObject, pnt)
            tan = mc.pointOnCurve(referenceObject, pr=u, nt=True)
        else:
            uv = glTools.utils.surface.closestPoint(referenceObject, pnt)
            tan = mc.pointOnSurface(referenceObject,
                                    u=uv[0],
                                    v=uv[1],
                                    ntu=True)
        tangent = OpenMaya.MVector(tan[0], tan[1], tan[2])

        # Get neighbouring points
        n1 = mc.pickWalk(vertexList[i], d='up')[0]
        n1Id = glTools.utils.component.getComponentIndexList([n1])[mesh][0]
        n1Pt = mc.pointPosition(n1)
        n1Dist = glTools.utils.mathUtils.distanceBetween(pnt, n1Pt)

        n2 = mc.pickWalk(vertexList[i], d='down')[0]
        n2Id = glTools.utils.component.getComponentIndexList([n2])[mesh][0]
        n2Pt = mc.pointPosition(n2)
        n2Dist = glTools.utils.mathUtils.distanceBetween(pnt, n2Pt)

        # Build neighbour data vector
        tDist = n1Dist + n2Dist
        neighbourData.append(
            OpenMaya.MVector(float(pntId), n1Id + (n1Dist / tDist),
                             n2Id + (n2Dist / tDist)))

    # Set value
    neighbourDataArrayPlug.setMObject(
        OpenMaya.MFnVectorArrayData().create(neighbourData))
Ejemplo n.º 18
0
def alignToUV(targetObj="none",
              sourceObj="none",
              sourceU=0.0,
              sourceV=0.0,
              mainAxis="+z",
              secAxis="+x",
              UorV="v"):
    """
	inputs should be 1. targetObj 2. sourceObj 3. sourceU 4. sourceV 5. mainAxis(lowerCase, + or -, i.e."-x" 8. secAxis (lowcase, + or -) 7, UorV ("u" or "v" for the direction along surface for the sec axis)
"""

    axisDict = {
        "+x": (1, 0, 0),
        "+y": (0, 1, 0),
        "+z": (0, 0, 1),
        "-x": (-1, 0, 0),
        "-y": (0, -1, 0),
        "-z": (0, 0, -1)
    }

    #Does this create a new node? no To create a node, use the flag "ch=True". That creates a pointOnSurface node
    pos = cmds.pointOnSurface(sourceObj, u=sourceU, v=sourceV, position=True)
    posVec = om.MVector(pos[0], pos[1], pos[2])
    cmds.xform(targetObj, ws=True, t=pos)

    #get tangent in the right direction (u or v), use this as up vector for normal constraint
    #oooorrrrrr be fancy and create a matrix for the axes to use from normal and tans
    tanV = cmds.pointOnSurface(sourceObj, u=sourceU, v=sourceV, tv=True)
    tanU = cmds.pointOnSurface(targetObj, u=sourceU, v=sourceV, tu=True)
    norm = cmds.pointOnSurface(targetObj, u=sourceU, v=sourceV, nn=True)

    #decide where up axis is on normal constraint, u or v tangent
    if UorV == "v":
        wup = tanV
    elif UorV == "u":
        wup = tanU

    #create normal constraint
    nc = cmds.normalConstraint(sourceObj,
                               targetObj,
                               aimVector=axisDict[mainAxis],
                               upVector=axisDict[secAxis],
                               worldUpVector=(wup))
    cmds.delete(nc)  #delete constraint

    #-------check that targetObj is a nurbsSurface (later figure out if it's a mesh or surface)

    # pos = cmds.pointOnSurface(targetObj, u=sourceU, v=sourceV, position=True)
    # vPos = om.MVector(pos[0], pos[1], pos[2])

    # tanV = cmds.pointOnSurface(targetObj, u=sourceU, v=sourceV, tv=True)
    # vTanV = om.MVector(tanV[0], tanV[1], tanV[2])

    # tanU = cmds.pointOnSurface(targetObj, u=sourceU, v=sourceV, tu=True)
    # vTanU = om.MVector(tanU[0], tanU[1], tanU[2])

    # norm = cmds.pointOnSurface(targetObj, u=sourceU, v=sourceV, nn=True)
    # vNorm = om.MVector(norm[0], norm[1], norm[2])

    # mat4x4 = om.MMatrix()

    # matSetRow(mat4x4, 0, vTanU)
    # matSetRow(mat4x4, 1, vNorm)
    # matSetRow(mat4x4, 2, vTanV)
    # matSetRow(mat4x4, 3, vPos)
    # matSetCell(mat4x4, 0, 3, 0)
    # matSetCell(mat4x4, 1, 3, 0)
    # matSetCell(mat4x4, 2, 3, 0)
    # matSetCell(mat4x4, 3, 3, 1)

    # mTrans = om.MTransformationMatrix(mat4x4)
    # mEuler = mTrans.eulerRotation()
    # mTranslate = mTrans.getTranslation("kWorld") #need to get MDagPath object for this

    # print "translation = %f, %f, %f"%(mTranslate
    # 	[0], mTranslate[1], mTranslate[2])

    # print "%f %f %f" % (radsToDegrees(mEuler[0]),
    # radsToDegrees(mEuler[1]), radsToDegrees(mEuler[2]))
Ejemplo n.º 19
0
def makePosNode(obj, *args):
    posNode = cmds.pointOnSurface("nurbsSphere1", ch=True)

    return posNode