当前位置: 首页>>代码示例>>Python>>正文


Python cmds.polyEvaluate方法代码示例

本文整理汇总了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#スキップしない 
开发者ID:ShikouYamaue,项目名称:SISideBar,代码行数:18,代码来源:uv.py

示例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 
开发者ID:justinfx,项目名称:tutorials,代码行数:20,代码来源:benchmark.py

示例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) 
开发者ID:wiremas,项目名称:spore,代码行数:17,代码来源:AEsporeNodeTemplate.py

示例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) 
开发者ID:ShikouYamaue,项目名称:SISideBar,代码行数:9,代码来源:freeze.py

示例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 
开发者ID:duncanskertchly,项目名称:dm2skin,代码行数:15,代码来源:dm2skin.py

示例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 
开发者ID:duncanskertchly,项目名称:dm2skin,代码行数:11,代码来源:dm2skin.py

示例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 
开发者ID:chrisevans3d,项目名称:uExport,代码行数:60,代码来源:uExport.py

示例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 
开发者ID:heimlich1024,项目名称:OD_CopyPasteExternal,代码行数:44,代码来源:maya_ExportToExternal.py


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