Mon, Sep 9, 5:24 AM CDT

Renderosity Forums / Poser Python Scripting



Welcome to the Poser Python Scripting Forum

Forum Moderators: Staff

Poser Python Scripting F.A.Q (Last Updated: 2024 Sep 08 5:10 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: Add lights to a scene lt2-not replace via script


grichter ( ) posted Sat, 08 December 2012 at 7:45 PM · edited Fri, 30 August 2024 at 10:18 PM

You can add a light set (lt2) a scene and it acts like a normal light set and replaces all lights with the new light set with this simple code...

import os
import poser
scene = poser.Scene()

def loadLibraryFile():
   path = "/runtime/Libraries/Collections/My Lights/Revised.lt2"
   try:
        scene.LoadLibraryLight(path)
   except:
      pass

loadLibraryFile()

But if you want to say add a pre-defined spot where you have set the shadows, etc and location of where it loads, using the above method it over writes all the lights instead of just adding one more spot to the scene.

Is there a simple scene method to add the lights vs apply the lights like the single and double check boxes in the poser library pallet?

I looked thru the methods manual and can't locate something that looks like it does the trick and I need to know if I skipped over something by not understanding its function.

Yes I know you can write a script to create a light, but it would be much easier if I could use the scene method up at the top and bring in a pre-made light set saved off the the library.

Thanks in advance for any help or suggestions

Gary

Gary

"Those who lose themselves in a passion lose less than those who lose their passion"


markschum ( ) posted Sat, 08 December 2012 at 10:02 PM

The only way I know is to create the light and then apply a pose to position it etc.

You could possibly import a pz3 file of lights, but I dont see a command to do that.


semidieu ( ) posted Mon, 10 December 2012 at 2:32 PM

Adding a light isn't that easy... I made it possible by saving the current light settings in a temporary file, merge the new ligh lt2 file with the temporary version (there are things to take care of...) and then load the merged file...

 

If someone has a better verison - let me know!


grichter ( ) posted Mon, 10 December 2012 at 3:48 PM

Thanks guys. Appreciate the feedback...back to the drawing board...

semidieu, what do you mean adding a light is not easy...Have you seen the Shaderworks Light script package at RDNA. It has a create light feature! :biggrin:

Gary

"Those who lose themselves in a passion lose less than those who lose their passion"


semidieu ( ) posted Mon, 10 December 2012 at 4:14 PM

Yes I saw it :) Well... I did it :) And it's using this feature :)


markschum ( ) posted Tue, 11 December 2012 at 1:10 AM

I wrote a script that merges two sets of lights but I was never sure it worked. I will send it if you can pm me an email address.

 


lesbentley ( ) posted Mon, 07 January 2013 at 5:24 PM

I can't speak on the Python aspect of this issue, but as to the Poser library file aspect...

In P8 and up, you have two ways of loading a light set from the library, Replace (single tick), or Add (double tick). Using Add, you can add as many instances of the light(s) as you like. I don't know if there is any way of choosing between Add and Replace if you are loading the lt2 via Python.  

In P8 and up, if you load a light from a pp2, each new instance will have the name incremented by a number, so you can load any amount of new instances of the light from the same pp2 file (and without affecting existing lights). The pp2 should be in the appropriate folder, I think just renaming an lt2 to pp2 and leaving it in the Light folder may cause problems. It works the same for loading lights from a cr2, but again, a cr2 has both Add and Replace loading modes, so it may not work via Python. A pp2 only has the Add loading mode, so I assume it should work OK via python.

If I remember correctly, the above method does not work in P6, in that version, any method of loading a light will overwrite an existing light of the same name. I don't know how it works in P7, as I never owned that version.

On the separate issue of loading a new light set turning off the pre-existing lights in the scene, I think loading the lights via a cr2 or pp2 overcomes that problem in any Poser version.

When I used P4-P6 I often parented lights to a figure (one with only a BODY actor), so that I could load the light set without turning off other lights in the scene.


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.