本文整理匯總了Python中maya.cmds.polyEvaluate方法的典型用法代碼示例。如果您正苦於以下問題:Python cmds.polyEvaluate方法的具體用法?Python cmds.polyEvaluate怎麽用?Python cmds.polyEvaluate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類maya.cmds
的用法示例。
在下文中一共展示了cmds.polyEvaluate方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: checkCurrentUV
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyEvaluate [as 別名]
def checkCurrentUV(self):
if self.force:
return True
if cmds.polyEvaluate(self.mesh, uv=True, uvs=self.currentSet[0]) == 0:
msg04 = lang.Lang(
en=str(self.mesh)+' : Current UVSet ['+str(self.currentSet[0])+'] is empty.\nDo you skip this mesh?',
ja=self.mesh+u' : 現在のUVSet ['+self.currentSet[0]+u'] が空です。\nこのメッシュをスキップしますか?'
)
self.msg04 = msg04.output()
self.skipMesh = cmds.confirmDialog(m=self.msg04, t='', b= [self.msg02, self.msg03], db=self.msg02, cb=self.msg03, icn='question',ds=self.msg03)
else:
return True#スキップしない
if self.skipMesh == self.msg02:
return False#スキップする
else:
return True#スキップしない
示例2: testPyCmds
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyEvaluate [as 別名]
def testPyCmds():
start = time.time()
helix = cmds.polyHelix(**HELIX_OPTS)
pHelix = helix[0]
size = cmds.polyEvaluate(v=True)
for i in xrange(size):
x = RAND.uniform(LOW, HIGH)
attrib = '%s.vtx[%s]' % (pHelix, i)
cmds.move(x, attrib, x=True)
cmds.delete(pHelix)
end = time.time()
return end-start
示例3: estimate_num_samples
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyEvaluate [as 別名]
def estimate_num_samples(self, node):
""" estimate how many random samples we need for grid or disk sampling """
self._node = node
emit_type = cmds.getAttr('{}.emitType'.format(node))
if emit_type == 1:
cell_size = cmds.getAttr(self._node + '.cellSize')
elif emit_type == 2:
cell_size = cmds.getAttr(self._node + '.minRadius') / math.sqrt(3)
else:
return
in_mesh = node_utils.get_connected_in_mesh(self._node)
area = cmds.polyEvaluate(in_mesh, worldArea=True)
cmds.setAttr(self._node + '.numSamples', int(area/cell_size) * 5)
示例4: deleteZeroShape
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyEvaluate [as 別名]
def deleteZeroShape(node):
meshnode = cmds.listRelatives(node, s=True, pa=True, type='mesh', fullPath=True)
for mesh in meshnode:
triNum = cmds.polyEvaluate(mesh, triangle=True)
historyNode = cmds.listHistory(mesh, f=True)
if len(historyNode) <= 1:
cmds.delete(mesh)
示例5: dm2skin_getVertexPositionsOverRange
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyEvaluate [as 別名]
def dm2skin_getVertexPositionsOverRange(mesh, startFrame=0, endFrame=1):
"""Gets a list of lists of vertex positions for the given mesh. One list for
each frame between startFrame and endFrame."""
numVerts = cmds.polyEvaluate(mesh, v=True)
resultList = []
for i in range(startFrame, endFrame + 1):
tempList = []
cmds.currentTime(i)
for j in range(0, numVerts):
tempPos = cmds.xform(mesh + '.vtx[' + str(j) + ']', q=True, ws=True, t=True)
tempList.append(np.array([tempPos[0], tempPos[1], tempPos[2]]))
resultList.append(tempList)
return resultList
示例6: dm2skin_getVertexLocationList
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyEvaluate [as 別名]
def dm2skin_getVertexLocationList(mesh, frame=0):
"""Gets a list of vertex locations on the given frame."""
numVerts = cmds.polyEvaluate(mesh, v=True)
resultList = []
cmds.currentTime(frame)
for v in range(0, numVerts):
pos = cmds.xform(mesh + '.vtx[' + str(v) + ']', q=True, ws=True, t=True)
resultList.append(np.array([pos[0], pos[1], pos[2], 1.0]))
return resultList
示例7: LOD_transferWeights
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyEvaluate [as 別名]
def LOD_transferWeights(meshes, jointsToRemove, jointToTransferTo, debug=1, pruneWeights=0.001, *args):
'''
Original function by Charles Anderson @ Epic Games
'''
for mesh in meshes:
# Find the skin cluster for the current mesh
cluster = findCluster(mesh)
if debug:
print "MESH: ", mesh
print "CLUSTER: ", cluster
# Prune weights on the current mesh
if pruneWeights:
cmds.skinPercent(cluster, mesh, prw=pruneWeights)
# Find all of the current influences on the current skin cluster.
meshInfluences = cmds.skinCluster(cluster, q=True, inf=True)
#print "Current Influences: ", meshInfluences
for joint in jointsToRemove:
if joint in meshInfluences:
#print "Current Joint: ", joint
# If the jointToTransferTo is not already an influence on the current mesh then add it.
currentInfluences = cmds.skinCluster(cluster, q=True, inf=True)
if jointToTransferTo not in currentInfluences:
cmds.skinCluster(cluster, e=True, wt=0, ai=jointToTransferTo)
# Now transfer all of the influences we want to remove onto the jointToTransferTo.
for x in range(cmds.polyEvaluate(mesh, v=True)):
#print "TRANSFERRING DATA....."
value = cmds.skinPercent(cluster, (mesh+".vtx["+str(x)+"]"), t=joint, q=True)
if value > 0:
cmds.skinPercent(cluster, (mesh+".vtx["+str(x)+"]"), tmw=[joint, jointToTransferTo])
# Remove unused influences
currentInfluences = cmds.skinCluster(cluster, q=True, inf=True)
#print "Current Influences: ", currentInfluences
influencesToRemove = []
weightedInfs = cmds.skinCluster(cluster, q=True, weightedInfluence=True)
#print "Weighted Influences: ", weightedInfs
for inf in currentInfluences:
#print "Influence: ", inf
if inf not in weightedInfs:
#print "Update Influences to Remove List: ", inf
influencesToRemove.append(inf)
#print "ToRemove Influences: ", influencesToRemove
if influencesToRemove != []:
for inf in influencesToRemove:
cmds.skinCluster(cluster, e=True, ri=inf)
## UI RELATED
########################################################################
#event filter to grab and discern right/left click
示例8: fn_getObjectData
# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import polyEvaluate [as 別名]
def fn_getObjectData():
global exportedObj
curSel = cmds.ls(selection = True)
if len(curSel) > 0:
exportedObj.name = curSel[0]
exportedObj.vertexCount = cmds.polyEvaluate(exportedObj.name, vertex = True)
exportedObj.polyCount = cmds.polyEvaluate(exportedObj.name, face = True)
exportedObj.vertices = []
exportedObj.polys = []
exportedObj.weightMap = []
for v in range(0,exportedObj.vertexCount - 0, 1):
vStr = exportedObj.name + ".vtx[" + str(v) + "]"
vPos = cmds.xform(vStr, q= True, os = True, translation = True)
exportedObj.vertices.append(vPos)
try:
w = cmds.polyColorPerVertex(vStr, q = True, r = True)[0]
except:
w = -1
exportedObj.weightMap.append(w)
for f in range(0,exportedObj.polyCount - 0, 1):
vStr = exportedObj.name + ".f[" + str(f) + "]"
cmds.select(vStr, replace = True)
verts = cmds.polyInfo(fv = True)
vertsTemp = verts[0].split(":")
vertsTemp = vertsTemp[1].split(" ")
vList = []
for fv in vertsTemp:
if fv.strip() != "":
vList.append(int(fv))
exportedObj.polys.append(vList)
cmds.select(curSel, replace = True)
return True
else:
cmds.confirmDialog(title='Error:', message='No object selected!',button='Ok')
print "Nothing selected!"
return False