本文整理汇总了Python中maya.cmds.pointPosition函数的典型用法代码示例。如果您正苦于以下问题:Python pointPosition函数的具体用法?Python pointPosition怎么用?Python pointPosition使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pointPosition函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: curveCoord
def curveCoord(surfaceSkin,influence,controlPoints,curve):
'''
Set the target coordinates for the specified control points to lie along a given isoparm
@param surfaceSkin: surfaceSkin node to apply the coordinates to
@type surfaceSkin: str
@param influence: surfaceSkin influence to get coordinate for
@type influence: str
@param controlPoints: List of control points to set the target coordinates for
@type controlPoints: list
@param curve: Curve to derive coordinates from
@type curve: str
'''
# Check surfaceSkin
if not ssUtil.verifyNode(surfaceSkin):
raise Exception('Object "'+surfaceSkin+'" is not a valid surfaceSkin node!')
# Iterate through control point list
for controlPoint in controlPoints:
# Get component position
pos = mc.pointPosition(controlPoint)
# Get closest point on curve
cCoord = glTools.utils.curve.closestPoint(curve,pos)
pos = mc.pointPosition(curve+'.u['+str(cCoord)+']')
# Get surface coordinate
uvCoord = glTools.utils.surface.closestPoint(influence,pos)
# Apply Coord
applyCoord(surfaceSkin,influence,controlPoint,uvCoord)
开发者ID:auqeyjf,项目名称:pubTool,代码行数:27,代码来源:coordinateUtilities.py
示例2: doIt
def doIt(self,argList):
#print "Trying to build a house..."
selected = cmds.ls(orderedSelection=True)
if(len(selected) != 1):
house = building([20,20],[0,0,0])
else:
print "Selected %s" %(selected[0])
tmp = selected[0]
a = cmds.pointPosition(tmp+'.vtx[0]')
b = cmds.pointPosition(tmp+'.vtx[1]')
c = cmds.pointPosition(tmp+'.vtx[2]')
d = cmds.pointPosition(tmp+'.vtx[3]')
width = int(b[0] - a[0])
print width
depth = int(b[2] - c[2])
print depth
offsetX = b[0] - width/2
offsetY = int(b[1])
offsetZ = b[2] - depth/2
# print "Calculated %d x %d lot at [ %d, %d ]." %(width, depth, offsetX, offsetY )
house = building([width-2,depth-2],[offsetX,offsetY,offsetZ])
house.build()
开发者ID:udde,项目名称:Building-generation-maya-plugin,代码行数:25,代码来源:building.py
示例3: 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
示例4: distanceBetween
def distanceBetween(*args): # distance between two points
if len(args) == 0:
args = mc.ls(sl=True)
if len(args) == 0:
return
p = []
for a in args:
if isIterable(a) and len(a) >= 3 and isinstance(a[0], (float, long, int)) and len(a) >= 3:
p.append(a)
elif isinstance(a, basestring) and mc.objExists(a):
if len(a.split(".")) > 1:
try:
p.append(mc.pointPosition(a))
except:
pass
else:
try:
p.append(mc.pointPosition(a + ".rp"))
except:
err = True
if len(p) < 1:
return
if len(p) > 2:
p[:] = p[:2]
dx = abs(p[0][0] - p[1][0])
dy = abs(p[0][1] - p[1][1])
dz = abs(p[0][2] - p[1][2])
return sqrt(dx * dx + dy * dy + dz * dz)
开发者ID:kurtontheway,项目名称:zentools,代码行数:28,代码来源:distanceBetween.py
示例5: splitBlendShape
def splitBlendShape( percentRange = .1 ):
#USER CAN CHANGE THIS NUMBER
###################
# percentRange = .1
#### .1 = 10% falloff
#### .3 = 30% falloff
#### 1 = 100% falloff (probably looks bad)
###################
(sourceObj, targetObj) = cmds.ls(sl=1)
sourceShape = getShapeNode(sourceObj)
#look at number of verticies
cmds.select(sourceObj)
numVerts = cmds.polyEvaluate(v=1)
#figure out width of face (assume X axis)
rgtX = 0
lftX = 0
for i in range(0,numVerts):
testX = cmds.pointPosition(targetObj + ".vtx[" + str(i) + "]", l=1)[0]
if testX < rgtX:
rgtX = testX
if testX > lftX:
lftX = testX
#duplicate face twice (one left, one right)
cmds.select(targetObj)
targetObj_Lft = cmds.duplicate(n=targetObj+'_Lft')[0]
cmds.move(rgtX * -2.1, 0, 0, r=1)
cmds.select(targetObj)
targetObj_Rgt = cmds.duplicate(n=targetObj+'_Rgt')[0]
cmds.move(rgtX * 2.1, 0, 0, r=1)
side = 1
#on each object
for target in ([targetObj_Lft, targetObj_Rgt]):
side *= -1
#for each vert
for i in range(0,numVerts):
#get vert positions
#sourcePos = cmds.getAttr(sourceShape + '.pnts[' + str(i) + ']')[0]
#targetPos = cmds.getAttr(target + '.pnts[' + str(i) + ']')[0]
sourcePos = cmds.pointPosition(sourceObj + ".vtx[" + str(i) + "]", l=1)
targetPos = cmds.pointPosition(target + ".vtx[" + str(i) + "]", l=1)
#find difference
differencePos = (sourcePos[0] - targetPos[0], sourcePos[1] - targetPos[1], sourcePos[2] - targetPos[2])
#get falloff amount from side of object
testX = cmds.pointPosition(sourceObj + ".vtx[" + str(i) + "]", l=1)[0]
falloff = getValue(testX, percentRange, rgtX * side)
#move vert difference * falloff amount
cmds.xform(target + '.vtx[' + str(i) + ']', rt=(differencePos[0] * falloff, differencePos[1] * falloff, differencePos[2] * falloff))
cmds.select(cl=True)
开发者ID:kyuhoChoi,项目名称:mayaTools,代码行数:57,代码来源:splitBlendShape.py
示例6: averageCV
def averageCV(amount=1.0):
for cv in mc.ls(sl=True,fl=True):
num = int(cv.split('.cv[')[-1].split(']')[0])
baseObj = cv.split('.')[0]
pos1 = mc.pointPosition('%s.cv[%i]' % (baseObj, num+1))
pos2 = mc.pointPosition('%s.cv[%i]' % (baseObj, num-1))
pos3 = mc.pointPosition('%s.cv[%i]' % (baseObj, num))
average = [(pos1[0]+pos2[0]+pos3[0])/3, (pos1[1]+pos2[1]+pos3[1])/3, (pos1[2]+pos2[2]+pos3[2])/3]
relAvg = [average[0]-pos3[0], average[1]-pos3[1], average[2]-pos3[2]]
mc.move(relAvg[0]*amount, relAvg[1]*amount, relAvg[2]*amount, cv, r=True)
开发者ID:cgfile,项目名称:hairTools,代码行数:10,代码来源:hairTools.py
示例7: getDelta
def getDelta(targetVert, referenceGeo):
'''
returns delta of vert based on referenceGeo
'''
targetGeo = getMeshName(targetVert)
referenceVert = targetVert.replace(targetGeo, referenceGeo)
targetPos = mc.pointPosition(targetVert, l=True)
referencePos = mc.pointPosition(referenceVert, l=True)
return [tP - rP for (tP, rP) in zip(targetPos, referencePos)]
开发者ID:sayehaye3d,项目名称:ls-rigging-tools,代码行数:11,代码来源:__init__.py
示例8: createInterpolatedCurve
def createInterpolatedCurve(curve1, curve2, v):
interpolatedCurve = mc.duplicate(curve1, rr=True, rc=True)[0]
for shape in mc.listRelatives(curve2,shapes=True,fullPath=True):
cvList = (mc.ls([shape+'.cv[*]'],flatten=True))
mc.rebuildCurve(interpolatedCurve, ch=0, rpo=1, rt= 0, end = 1, kr = 0, kcp = 0, kep = 1, kt = 0, s = len(cvList)-3, d = 3, tol = 0)
for i in range(len(cvList)):
pos1 = mc.pointPosition('%s.cv[%i]' % (interpolatedCurve,i))
pos2 = mc.pointPosition('%s.cv[%i]' % (curve2,i))
newPos = ((pos2[0]-pos1[0])*v+pos1[0], (pos2[1]-pos1[1])*v+pos1[1], (pos2[2]-pos1[2])*v+pos1[2])
mc.move(newPos[0], newPos[1], newPos[2], '%s.cv[%i]' % (interpolatedCurve,i), a=True)
return interpolatedCurve
开发者ID:cgfile,项目名称:hairTools,代码行数:14,代码来源:hairTools.py
示例9: snapComponentsOnClosestVertex
def snapComponentsOnClosestVertex(referenceObject, components, tolerance) :
"""
This function snaps vertices onto the reference object vertices.
:param referenceObject: Reference mesh.
:type referenceObject: str
:param components: Components.
:type components: list
"""
vertices = cmds.ls(cmds.polyListComponentConversion(components, toVertex=True), fl=True)
progressBar = mel.eval("$container=$gMainProgressBar");
cmds.progressBar(progressBar, edit=True, beginProgress=True, isInterruptable=True, status="Snapping vertices ...", maxValue=len(vertices))
loadPlugin("nearestPointOnMesh")
nearestPointOnMeshNode = mel.eval("nearestPointOnMesh " + referenceObject)
for vertex in vertices :
if cmds.progressBar(progressBar, query=True, isCancelled=True) :
break
closestDistance = MAXIMUM_SEARCH_DISTANCE
vertexPosition = cmds.pointPosition(vertex, world=True)
cmds.setAttr(nearestPointOnMeshNode + ".inPosition", vertexPosition[0], vertexPosition[1], vertexPosition[2])
associatedFaceId = cmds.getAttr(nearestPointOnMeshNode + ".nearestFaceIndex")
vtxsFaces = cmds.filterExpand(cmds.polyListComponentConversion((referenceObject + ".f[" + str(associatedFaceId) + "]"), fromFace=True, toVertexFace=True), sm=70, expand=True)
closestPosition = []
for vtxsFace in vtxsFaces :
associatedVtx = cmds.polyListComponentConversion(vtxsFace, fromVertexFace=True, toVertex=True)
associatedVtxPosition = cmds.pointPosition(associatedVtx, world=True)
distance = norme(vertexPosition, associatedVtxPosition)
if distance < closestDistance :
closestDistance = distance
closestPosition = associatedVtxPosition
if closestDistance < tolerance :
cmds.move(closestPosition[0], closestPosition[1], closestPosition[2], vertex, worldSpace=True)
cmds.progressBar(progressBar, edit=True, step=1)
cmds.progressBar(progressBar, edit=True, endProgress=True)
cmds.delete(nearestPointOnMeshNode)
开发者ID:KelSolaar,项目名称:Snippets,代码行数:50,代码来源:snapOnClosestVertex.py
示例10: createEyelidsPlane
def createEyelidsPlane():
curSel = cmds.ls(sl=1,fl=1)
eyeCtr = cmds.xform(curSel[2],ws=1,piv=1,q=1)[0:3]
eyeCnra = cmds.pointPosition(curSel[0],w=1)
eyeCnrb = cmds.pointPosition(curSel[1],w=1)
eyeballPlane = cmds.polyCreateFacet(n='tmp_eyeball_plane',ch=0,p=[eyeCtr,eyeCnra,eyeCnrb])
eyelidsPlane = cmds.polyPlane(n='tmp_eyelids_plane')
cmds.select((eyelidsPlane[0]+'.vtx[60]'),(eyelidsPlane[0]+'.vtx[70:71]'),(eyeballPlane[0]+'.vtx[0:2]'),r=1)
mel.eval('snap3PointsTo3Points(0)')
cmds.select(eyelidsPlane,r=1)
cmds.xform(eyelidsPlane,os=1,r=1,ro=(0,0,90))
cmds.delete(eyeballPlane)
开发者ID:aaronfang,项目名称:personal_scripts,代码行数:14,代码来源:createEyelidsPlane.py
示例11: locMeEdgeLoop
def locMeEdgeLoop(polyEdge):
"""
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
DESCRIPTION:
Creates a locator from an edgeloop
ARGUMENTS:
polyEdge(string)
RETURNS:
locatorName(string)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
"""
# Get the loop
if ':' in polyEdge:
edges = mc.ls(polyEdge,flatten=True)
elif ',' in polyEdge:
edges = polyEdge
else:
edges = search.returnEdgeLoopFromEdge(polyEdge)
mc.select(cl=True)
mc.select(edges)
mel.eval("PolySelectConvert 3")
edgeVerts = mc.ls(sl=True,fl=True)
postList = []
for vert in edgeVerts:
posList.append(mc.pointPosition(vert,w=True))
objTrans = distance.returnAveragePointPosition(posList)
mc.select(cl=True)
# Make the loc
locatorName = createLocFromObject(polyEdge)
mc.move (objTrans[0],objTrans[1],objTrans[2], locatorName)
# aim it
posList = []
for vtx in edgeVerts:
posList.append( mc.pointPosition(vtx,w=True) )
polyBuffer = geo.createPolyFromPosList(posList)
constBuffer = mc.normalConstraint(polyBuffer,locatorName)
mc.delete(constBuffer[0])
mc.delete(polyBuffer)
return locatorName
开发者ID:Italic-,项目名称:maya-prefs,代码行数:48,代码来源:locators.py
示例12: snapToVertex
def snapToVertex(mesh, transform, vtxId=-1, snapPivot=False):
"""
Snap a transform the the closest point on a specified mesh
@param mesh: Mesh to snap to
@type mesh: str
@param transform: Transform to snap to mesh
@type transform: str
@param vtxId: Integer vertex id to snap to. If -1, snap to closest vertex.
@type vtxId: int
@param snapPivot: Move only the objects pivot to the vertex
@type snapPivot: bool
"""
# Check mesh
if not isMesh(mesh):
raise Exception("Object " + mesh + " is not a valid mesh!")
# Get transform position
pos = mc.xform(transform, q=True, ws=True, rp=True)
# Get mesh vertex to snap to
if vtxId < 0:
vtxId = closestVertex(mesh, pos)
# Get vertex position
vtxPt = mc.pointPosition(mesh + ".vtx[" + str(vtxId) + "]")
# Snap to Vertex
if snapPivot:
mc.xform(obj, piv=vtxPt, ws=True)
else:
mc.move(vtxPt[0] - pos[0], vtxPt[1] - pos[1], vtxPt[2] - pos[2], transform, r=True, ws=True)
# Retrun result
return vtxPt
开发者ID:RiggingDojoAdmin,项目名称:glTools,代码行数:34,代码来源:mesh.py
示例13: 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
示例14: locMeCvFromCvIndex
def locMeCvFromCvIndex(shape,cvIndex):
"""
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
DESCRIPTION:
Places locators on the cv's closest position on a curve
ARGUMENTS:
curve(string)
RETURNS:
locList(list)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
"""
cv = ('%s%s%i%s'%(shape,'.cv[',cvIndex,']'))
if mc.objExists(cv):
cvPos = mc.pointPosition (cv,w=True)
wantedName = (cv + 'loc')
actualName = mc.spaceLocator (n= wantedName)
mc.move (cvPos[0],cvPos[1],cvPos[2], [actualName[0]])
uPos = distance.returnClosestUPosition (actualName[0],shape)
mc.move (uPos[0],uPos[1],uPos[2], [actualName[0]])
return actualName[0]
else:
guiFactory.warning ('Shape does not exist')
return False
开发者ID:Italic-,项目名称:maya-prefs,代码行数:25,代码来源:locators.py
示例15: locMeCVOnCurve
def locMeCVOnCurve(curveCV):
"""
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
DESCRIPTION:
Places locators on the cv's closest position on a curve
ARGUMENTS:
curve(string)
RETURNS:
locList(list)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
"""
if search.returnObjectType(curveCV) == 'curveCV':
cvPos = mc.pointPosition (curveCV,w=True)
wantedName = (curveCV + '_loc')
actualName = mc.spaceLocator (n= wantedName)
mc.move (cvPos[0],cvPos[1],cvPos[2], [actualName[0]])
splitBuffer = curveCV.split('.')
uPos = distance.returnClosestUPosition (actualName[0],splitBuffer[0])
mc.move (uPos[0],uPos[1],uPos[2], [actualName[0]])
return actualName[0]
else:
guiFactory.warning ('Not a curveCV')
return False
开发者ID:Italic-,项目名称:maya-prefs,代码行数:25,代码来源:locators.py
示例16: kmSelectVtxFromSide
def kmSelectVtxFromSide(searchVtx, pos):
pX = []
mc.select(clear=True)
for vtx in searchVtx:
vtxPos = mc.pointPosition(vtx)
if pos[0] > 0:
if vtxPos[0] > 0:
pX.append(vtx)
elif pos[0] < 0:
if vtxPos[0] < 0:
pX.append(vtx)
if pos[1] > 0:
if vtxPos[1] > 0:
pX.append(vtx)
elif pos[1] < 0:
if vtxPos[1] < 0:
pX.append(vtx)
if pos[2] > 0:
if vtxPos[2] > 0:
pX.append(vtx)
elif pos[2] < 0:
if vtxPos[2] < 0:
pX.append(vtx)
mc.select(pX)
开发者ID:smymc,项目名称:Maya-Python,代码行数:29,代码来源:kmSelectVtxFromSide.py
示例17: avgElementPos
def avgElementPos(verts, *args):
"""uses a list of verts and gets the average position"""
#get a selection of verts and avg their position
xVal = []
yVal = []
zVal = []
xAll = 0.0
yAll = 0.0
zAll = 0.0
for vert in verts:
pos = cmds.pointPosition(vert)
xVal.append(pos[0])
yVal.append(pos[1])
zVal.append(pos[2])
for x in xVal:
xAll += x
for y in yVal:
yAll += y
for z in zVal:
zAll += z
avgX = xAll/len(xVal)
avgY = yAll/len(yVal)
avgZ = zAll/len(zVal)
avgPos = (avgX, avgY, avgZ)
return avgPos
开发者ID:zethwillie,项目名称:zbw_python_tools,代码行数:30,代码来源:zbw_softDeformer.py
示例18: getCrvData
def getCrvData(crvList):
"""
This method finds all the ctrl objects in a scene, and creates a data set
describing the positions of the cvs in world space. This data is used to
reposition the controls after the rig is built.
This is the format of the data:
data = [('ctrlA':['ctrlAShape':[[point1.X, point1.Y, point1.Z],
[point2.X, point2.Y, point2.Z],
etc...]]),
('ctrlB':['ctrlBShape':[[point1.X, point1.Y, point1.Z],
[point2.X, point2.Y, point2.Z],
etc...],
'ctrlBShape1':[point1.X, point1.Y, point1.Z]]),
]
:Returns:
A list of ctrlData tuples
:Rtype:
`list`
"""
data = []
for crv in crvList:
shapes = cmds.listRelatives(crv, shapes=1, type="nurbsCurve")
shapeData = {}
for shape in shapes:
pointData = []
for i in range(cmds.getAttr("%s.controlPoints" % shape, size=1)):
pointData.append(cmds.pointPosition("%s.cv[%s]" % (shape, i), w=1))
shapeData[shape] = pointData
data.append((crv, shapeData))
return data
开发者ID:WillDiGi,项目名称:mayaUtils,代码行数:35,代码来源:utils.py
示例19: nurbsCVSmoothWeights
def nurbsCVSmoothWeights(cv):
surface = '.'.join(cv.split('.')[0:-1])
skinCluster = querySkinCluster (surface)
cvPos = mc.pointPosition (cv,world=True)
wantedName = (cv + 'loc')
actualName = mc.spaceLocator (n= wantedName)
mc.move (cvPos[0],cvPos[1],cvPos[2], [actualName[0]])
influenceObjects = queryInfluences (skinCluster)
culledList = influenceObjects
"""figure out our closest objects"""
bestChoices = []
cnt = 5
while cnt >= 0:
goodChoice = (distance.returnClosestObjToCV (cv, culledList))
culledList.remove(goodChoice)
bestChoices.append (goodChoice)
print bestChoices
cnt-=1
distanceList = []
for obj in bestChoices:
distanceList.append (distance.returnDistanceBetweenObjects(actualName[0],obj))
print distanceList
""" return normalization value """
buffer=0
y = 1 + (x-A)*(10-1)/(B-A)
for value in distanceList:
buffer += value
print buffer
normalize = ((len(distanceList))*.1)
print normalize
mc.delete (actualName[0])
开发者ID:Italic-,项目名称:maya-prefs,代码行数:31,代码来源:skinning.py
示例20: createFromTo
def createFromTo(objs=[], divisions=4, degree=3):
from maya.cmds import ls, attributeQuery, xform, pointPosition, curve
from ezLib import transform
# no objs put it: get from selection
if not objs:
objs = ls(sl=1)
if len(objs) != 2:
raise IOError, 'need 2 objs to get start & end from!'
print ('objs: ' + str(objs))
pos = []
for i in range(2):
# to get transforms/joints or anything that has translate attributes
if attributeQuery('t', node=objs[i], exists=1):
pos.append(xform(objs[i],q=1,t=1,ws=1))
else:
try:
pos.append(pointPosition(objs[i], world=1))
except IOError:
print 'cannot get position from ' + objs[i]
#vector from start to end
posArray = transform.posRange(pos[0], pos[1], divisions + 1)
crv = curve(p=posArray)
# center pivot and reset pivot
xform(crv, centerPivots=1)
transform.resetPivot(crv)
开发者ID:ewerybody,项目名称:melDrop,代码行数:28,代码来源:curve.py
注:本文中的maya.cmds.pointPosition函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论