Forum: Poser - OFFICIAL


Subject: Any way to List Files used reliably?

cortic opened this issue on Nov 23, 2014 · 3 posts


cortic posted Sun, 23 November 2014 at 6:49 AM

I've been trying to clean my runtimes, found this script in the python folders called 'listFiles.py' that seems to list all used files in scene so... In JavaScript and Perl i write a sorting program that i could paste in 'listFiles.py' readouts and it would fish out the files and put them into a clean runtime... then i would just copy over the menu bits (cr2, png) ending up with a nice shiny runtime that only had the files it needed to open the things in the menu... not the perfect solution as it would break some pose actions that required textures, but good for me as i have limited room on my SSD.

A day later, 17 hours of work and i find 'listFiles.py' in fact was not listing all the files! Usually bump map image files missing, but some Geometry files and basic texture files were missing as well as any secondary cr2 files needed.

I don't know Python, so could someone tell me whats wrong with this script, or even just point me to a better script somewhere?  Will paste the contents of listFiles.py here;

###############

textures  = { }
geomNames = { }
def printGeom(actor):
    geomName = actor.GeomFileName()
    if (geomName != ""):
        try:
            if (geomNames[geomName] != 1):
                geomNames[geomName] = 1
        except:
            print geomName    
            geomNames[geomName] = 1

def printTextures(actor):
    try:
        materials = actor.Materials()
        for material in materials:
            if (material.BumpMapFileName() != "No Bump"):
                textureName = material.BumpMapFileName()
                try:
                    if (textures[textureName] != 1):
                        textures[textureName] = 1
                except:
                    print textureName    
                    textures[textureName] = 1

            textureName = material.TextureMapFileName()
            if (textureName != "None" and textureName != "No Texture"):
                try:
                    if (textures[textureName] != 1):
                        textures[textureName] = 1
                except:
                    print textureName    
                    textures[textureName] = 1

            textureName = material.ReflectionMapFileName()
            if (textureName != "None" and textureName != "No Texture"):
                try:
                    if (textures[textureName] != 1):
                        textures[textureName] = 1
                except:
                    print textureName    
                    textures[textureName] = 1

            textureName = material.TransparencyMapFileName()
            if (textureName != "None" and textureName != "No Texture"):
                try:
                    if (textures[textureName] != 1):
                        textures[textureName] = 1
                except:
                    print textureName    
                    textures[textureName] = 1
    except:
        # do nothing
        a = 1
scene = poser.Scene()
print " "
print "Python scripts attached to scene or figures:"
if (scene.StartupScript() != ""):
    print scene.StartupScript()

for figure in scene.Figures():
    if (figure.StartupScript() != ""):
        print figure.StartupScript()

print " "
print "Geometry files in use:"
for figure in scene.Figures():
    printGeom(figure)
    for actor in figure.Actors():
        printGeom(actor)
for actor in scene.Actors():
    printGeom(actor)

print " "
print "Texture files in use:"
for figure in scene.Figures():
    printTextures(figure)
    for actor in figure.Actors():
        printTextures(actor)
for actor in scene.Actors():
    printTextures(actor)

if (scene.BackgroundMovie() != ""):
    print " "
    print "Background Movie:"
    print scene.BackgroundMovie()

if (scene.BackgroundImage() != ""):
    print " "
    print "Background Image:"
    print scene.BackgroundImage()

print " "

#################