Exemplo n.º 1
0
def meshReduce(meshes=[], percent=90):
    if meshes == []:
        meshes = pm.selected()
    pm.polyReduce(meshes,
                  keepQuadsWeight=1,
                  ch=1,
                  p=percent,
                  keepFaceGroupBorder=1,
                  keepMapBorderWeight=0.5,
                  replaceOriginal=1,
                  vertexMapName="",
                  keepBorder=1,
                  ver=1,
                  keepColorBorder=1,
                  keepCreaseEdge=1,
                  keepBorderWeight=0.5,
                  keepHardEdgeWeight=0.5,
                  vct=0,
                  tct=0,
                  useVirtualSymmetry=0,
                  keepColorBorderWeight=0.5,
                  symmetryTolerance=0.01,
                  keepHardEdge=1,
                  keepCreaseEdgeWeight=0.5,
                  sy=1,
                  shp=0,
                  sz=0,
                  keepFaceGroupBorderWeight=0.5,
                  sx=0,
                  trm=0,
                  keepMapBorder=1,
                  sw=0,
                  cachingReduce=1,
                  preserveTopology=1)
Exemplo n.º 2
0
def shadowMesh(triCount=10000):
    meshArg = pm.ls(sl=True)
    meshList = pm.duplicate(meshArg, rr=True)
    shadowGeo = pm.polyUnite(meshList, ch=False, name='ShadowGeo')[0]
    pm.delete(meshList)  #deleting leftover garbage transform nodes
    pm.parent(shadowGeo, 'CharaA')

    newSkinClust = pm.skinCluster(
        shadowGeo, pm.listRelatives('CharaA', ad=True,
                                    type='joint'))  #skinning begins

    pm.select(meshArg)
    pm.select(shadowGeo, add=True)
    pm.copySkinWeights(
        noMirror=True,
        surfaceAssociation='closestPoint',
        influenceAssociation='closestJoint')  #copying skin weights
    pm.selectMode(o=True)
    #shadowmesh starts here
    pm.select(shadowGeo)
    mel.eval(
        'polyCleanupArgList 3 { "0","1","1","0","0","0","0","0","0","1e-005","0","1e-005","0","1e-005","0","1","0" };'
    )  #clean up before reduction
    pm.selectMode(o=True)
    #reduce polycount to fall under budget
    pm.polyReduce(shadowGeo,
                  ver=1,
                  trm=2,
                  triangleCount=triCount,
                  sharpness=0,
                  keepBorder=1,
                  keepColorBorder=1,
                  keepFaceGroupBorder=1,
                  keepHardEdge=1,
                  keepCreaseEdge=1,
                  keepBorderWeight=0.5,
                  keepMapBorderWeight=0,
                  keepColorBorderWeight=0,
                  keepFaceGroupBorderWeight=0,
                  keepHardEdgeWeight=0.25,
                  keepCreaseEdgeWeight=0,
                  useVirtualSymmetry=0,
                  symmetryTolerance=0.01,
                  sx=0,
                  sy=1,
                  sz=0,
                  sw=0,
                  preserveTopology=1,
                  keepQuadsWeight=1,
                  vertexMapName="",
                  replaceOriginal=1,
                  cachingReduce=1,
                  constructionHistory=1)
    pm.select(deselect=True)
    pm.bakePartialHistory(shadowGeo, prePostDeformers=True, preDeformers=True)
    pm.select(shadowGeo)
    print('EKKO shadowMesh successful!\nShadow Mesh specs:')
    print(pm.polyEvaluate(shadowGeo, fmt=True))
Exemplo n.º 3
0
def shadowMesh(arg = 2, triCount = 10000):
    #please ask kaneko-san to select all the mesh to be exported again
    shadowGeo = oneSkin(arg)
    print('EKKO shadowMesh in progress! Performing poly reduction now!')
    #shadowmesh starts here
    pm.selectMode(o = True)
    pm.select(shadowGeo)
    mel.eval('polyCleanupArgList 3 { "0","1","1","0","0","0","0","0","0","1e-005","0","1e-005","0","1e-005","0","1","0" };') #clean up before reduction
    pm.selectMode(o = True)
    #reduce polycount to fall under budget
    pm.polyReduce(shadowGeo, ver = 1, trm = 2, triangleCount = triCount, sharpness = 0, keepBorder = 1, keepColorBorder = 1, keepFaceGroupBorder = 1, keepHardEdge = 1, keepCreaseEdge = 1, keepBorderWeight = 0.5, keepMapBorderWeight = 0, keepColorBorderWeight = 0, keepFaceGroupBorderWeight = 0, keepHardEdgeWeight = 0.25, keepCreaseEdgeWeight = 0, useVirtualSymmetry = 0, symmetryTolerance = 0.01, sx = 0, sy = 1, sz = 0, sw = 0, preserveTopology = 1, keepQuadsWeight = 1, vertexMapName = "", replaceOriginal = 1, cachingReduce = 1, constructionHistory = 1)
    pm.select(deselect = True)
    pm.bakePartialHistory(shadowGeo, prePostDeformers = True, preDeformers = True)
    renamedGeo = pm.rename(shadowGeo, 'ShadowGeo')
    pm.select(renamedGeo)
    print('EKKO shadowMesh successful!\nShadow Mesh specs:')
    print(pm.polyEvaluate(shadowGeo, fmt = True))
Exemplo n.º 4
0
    def makeProxyGeo(self, geo, percentage=50):
        proxyName = name.removeSuffix(geo.name()) + 'Proxy_GEO'
        proxyGeo = pm.duplicate(geo, n=proxyName)[0]
        pm.polyReduce(proxyGeo,
                      p=percentage,
                      ver=1,
                      trm=0,
                      shp=0,
                      keepBorder=1,
                      keepMapBorder=1,
                      keepColorBorder=1,
                      keepFaceGroupBorder=1,
                      keepHardEdge=1,
                      keepCreaseEdge=1,
                      keepBorderWeight=0.5,
                      keepMapBorderWeight=0.5,
                      keepColorBorderWeight=0.5,
                      keepFaceGroupBorderWeight=0.5,
                      keepHardEdgeWeight=0.5,
                      keepCreaseEdgeWeight=0.5,
                      useVirtualSymmetry=0,
                      symmetryTolerance=0.01,
                      sx=0,
                      sy=1,
                      sz=0,
                      sw=0,
                      preserveTopology=1,
                      keepQuadsWeight=1,
                      vertexMapName='',
                      cachingReduce=1,
                      ch=1,
                      vct=0,
                      tct=0,
                      replaceOriginal=1)
        common.deleteHistory(proxyGeo)

        return proxyGeo
Exemplo n.º 5
0
                                         defaultButton='OK',
                                         cancelButton='Cancel',
                                         dismissString='Cancel')
    if endNameInputWindow == u'\u786e\u8ba4':
        endName = pm.promptDialog(query=True, text=True)
    else:
        endName = ''
    startIndexInputWindow = pm.promptDialog(title='起始值设置',
                                            message='起始值:',
                                            button=['确认', '取消'],
                                            defaultButton='OK',
                                            cancelButton='Cancel',
                                            dismissString='Cancel')
    if startIndexInputWindow == u'\u786e\u8ba4':
        startIndex = pm.promptDialog(query=True, text=True)
    else:
        startIndex = '0'
    for j in range(fileCount):
        pm.select('_Mesh' + str(j))
        mel.eval(
            'polyCleanupArgList 4 { "0","1","1","0","0","0","0","0","0","1e-05","0","1e-05","0","1e-05","0","1","0","1" }'
        )
        pm.select('_Mesh' + str(j))
        pm.polyReduce(ver=1, p=reducePercent, n="_Mesh" + str(j))
        indexName = '%04d' % (j + int(startIndex))
        pm.exportSelected(
            pathOfFiles + '/ReducedFiles/' + startName + indexName + endName +
            '.obj',
            force=1,
            options='groups=0;ptgroups=0;materials=0;smoothing=0;normals=0')