z opened this issue on Apr 02, 2009 · 15 posts
Rocketship3D posted Thu, 07 May 2009 at 9:07 AM
Hi everyone,
Ben Margolis here, from Rocketship Software, makers of PzDB.
I’ve been watching this thread because we have had several requests to have PzDB index Pz3 files too. And if we’re going to do that, we’re going to need something very much like this script.
So Z, I’ve found the bug you found in that If statement. (he forgot to add the file path to the name)
So that line should be:
if not os.path.exists(myfilepath + cfo):
And as you requested here’s a version that lets you enter any list of files, instead of doing whole directories:
import poser
import os
myq = []
myq.append ("E:PoserFilesCharactersDaveX1File1.pz3")
myq.append ("E:PoserFilesCharactersDaveX1File2.pz3")
myq.append ("E:PoserFilesCharactersDaveNew FolderFile3.pz3")
#add more files here
**
**#and then render them all
mql = len(myq)print "Rendering a possible " + str(mql) + " pz3 files."
for cf in myq:
cfo = cf[0:-4] + ".png"
cfd = cf
if not os.path.exists(cfo):
# open the scene file
print "Processing File: " + cfd
poser.OpenDocument(cfd)
# get the scene and set render type , output size
scn = poser.Scene()
scn.SetCurrentRenderEngine(poser.kRenderEngineCodeFIREFLY)
scn.SetOutputRes(300,300)
scn.SetFrame(0)
# render the scene
print "Rendering: "+ cfd
prr = scn.Render()
print prr
# save the image , same path, as png
print "Saving image as: " + cfo
scn.SaveImage("png", cfo )
# and close the document
poser.CloseDocument(1)
print "done"
markschum, If you wouldn’t mind I’d like to use this as a starting point for a Script that we include in the next PzdDB. It’ll need better error handling though, and I’d love a GUI window with a cancel button, any idea about how to do that?
Ben Margolis
Rocketship Software