Start a new topic

unused texture mapping////unused materials

looking to create a script to get rid unused materials and texture mappings. i was using a unused texture script and changed out a few words thinking it would work..it doesn't. Are any of these possible?


def MatchNodeType(db,parent,rec,userData):

        if (mgGetCode (rec) == userData):

                return MG_TRUE

        return MG_TRUE



def removeUnusedMaterials(db,rec,parent,userData):

        usedMaterialsList [ ]

        code = fltPolygon

        polyTXNodes = mgFind ( db, MatchNodeType, code, 0)

        numPoly = mgGetRecListCOunt (polyTXNodes)

        for i in range (0, numPoly):

                rec, matrix = mgGetNextRecInList (polyTXNodes)

                nodeName = mgGetName(rec)

                numAttr, texIndexCode, texIndex = mgGetAttList(rec, fltPolyMaterial)

                usedMaterialsList.append (matIndex)

        gotOne,index,name = mgGetFirstMaterial(db)

        while (gotOne == MG_TRUE):

                if (index in usedMaterialsList):

                       GoOn = 1

                else:

                       mgDeleteMaterial(db,index)

        gotOne,index,name = mgGetNextMaterial(db)





mgWalk (db, removeUnusedMaterials, None , None, MWALK_ON)

1 Comment

Chris? know of any voodoo to handle any of this? 

Login to post a comment