Amadan opened this issue on Apr 16, 2009 · 5 posts
Amadan posted Thu, 16 April 2009 at 12:59 PM
My Poser gui selects multiple light sets, so as to perform a batch render of a scene using each light set selected.
The problem is, while the light sets seem to be selected properly, when I render, Poser won't find them using the given paths.
Here is the relevant code:
""" callback for the chooseb button. Selects
lightsets to render. """
<br></br>
<span style="color:rgb(0,0,255);">def</span>
<strong>addLights</strong>(self):<br></br>
self.lightsets =
tkFileDialog.askopenfilenames(**self.file_opts)<br></br>
<span style="color:rgb(0,0,255);">for</span> i <span style="color:rgb(0,0,255);">in</span> self.lightsets:<br></br>
self.lightlist.insert(END, i)
(self.lightlist is a Listbox.)
This works fine -- I get the lightsets selected, with their full path names.
Then I press the render button, which does this:
""" render all selected lightsets
"""
<br></br>
<span style="color:rgb(0,0,255);">def</span>
<strong>renderLights</strong>(self):<br></br>
<span style="color:rgb(0,0,255);">if</span> self.outdir == 0:<br></br>
poser.DialogSimple.MessageBox(<span style="color:rgb(51,153,102);">"You must choose an output
directory!"</span>)<br></br>
<span style="color:rgb(0,0,255);">else</span>:<br></br>
scene =
poser.Scene()<br></br>
<span style="color:rgb(0,0,255);">for</span> lights <span style="color:rgb(0,0,255);">in</span> self.lightsets:<br></br>
<span style="color:rgb(0,0,255);">if</span>
os.path.exists(lights):<br></br>
scene.LoadLibraryLight(lights)<br></br>
scene.Render()<br></br>
(Code for saving files to the output directory omitted.)
Notice that I added a check that the lightset file being loaded actually exists. But this doesn't work -- the file does exist, yet when it comes to LoadLibraryLight, Poser pops up a dialog asking me to locate the file in question. Note that it pops up the dialog with the directory in which the file is located being the default location. And once I select a file, it does find all the others correctly -- and will do so again without any warnings if I hit the render button again. But it can't seem to find the file correctly the first time.
PhilC posted Thu, 16 April 2009 at 1:19 PM
Where have you got Poser installed?
Amadan posted Thu, 16 April 2009 at 1:27 PM
Quote - Where have you got Poser installed?
C:Program Filese frontierPoser 7
It's version 7.0.4.220, on Windows XP.
PhilC posted Thu, 16 April 2009 at 1:44 PM
OK that squashes that idea :)
Are the lights in a remote runtime library?
If so does it work if they are in the local library?
Amadan posted Thu, 16 April 2009 at 5:06 PM
Quote - OK that squashes that idea :)
Are the lights in a remote runtime library?
If so does it work if they are in the local library?
I've tried both -- selecting lights from the local library and remote runtimes. I get the same phenomenon.
Once I do select a light set manually (from the "Please locate file..." dialog), Poser remembers that directory, and looks for any selected light sets there. If I subsequently choose a light set from that directory, the script finds it. But if I browse to another directory and choose a light set, Poser asks me to locate the file again when it tries to load it.
Interestingly, the script also seems to remember the LAST directory from which I manually selected a light set, even between restarts of Poser. I am not sure how that's happening, since I added no code to store that information.