Wed, Jan 22, 10:26 PM CST

Renderosity Forums / Poser Python Scripting



Welcome to the Poser Python Scripting Forum

Forum Moderators: Staff

Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 pm)

We now have a ProPack Section in the Poser FreeStuff.
Check out the new Poser Python Wish List thread. If you have an idea for a script, jot it down and maybe someone can write it. If you're looking to write a script, check out this thread for useful suggestions.

Also, check out the official Python site for interpreters, sample code, applications, cool links and debuggers. This is THE central site for Python.

You can now attach text files to your posts to pass around scripts. Just attach the script as a txt file like you would a jpg or gif. Since the forum will use a random name for the file in the link, you should give instructions on what the file name should be and where to install it. Its a good idea to usually put that info right in the script file as well.

Checkout the Renderosity MarketPlace - Your source for digital art content!



Subject: Does not find light sets?


Amadan ( ) posted Thu, 16 April 2009 at 12:59 PM · edited Sat, 10 August 2024 at 12:00 AM

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.


Privacy Notice

This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.