Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 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"
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.
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.
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"