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 " "

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


bagginsbill posted Sun, 23 November 2014 at 7:14 AM

The listFiles.py script comes with Poser but has not been updated in years. 

There is another script that is better and certainly more up-to-date. It is in the Scripts menu under Utility/collectSceneInventory. Not only does it find everything, it copies all the files to one folder for you.

Since you said you post-processed the listFiles output to copy the files, you probably would have wasted less time by starting with collectSceneInventory and adjusting it to your desires - it already does what you're trying to do. 


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


cortic posted Sun, 23 November 2014 at 10:01 AM

thanks, that seems to work better :)