Filter: Safe | Mon, May 18, 9:01 PM CDT

Renderosity Forums / Poser Python Scripting



Welcome to the Poser Python Scripting Forum

Forum Moderators: Lobo3433, Staff Forum Coordinators: Anim8dtoon

Poser Python Scripting F.A.Q (Last Updated: 2026 Apr 22 10:09 am)

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: Calling for a Guru : Request for a Lighting Script


Khai ( ) posted Thu, 23 March 2006 at 10:07 AM · edited Sat, 09 May 2026 at 1:47 AM

can anyone make a simple script for me? (I can't program lol) what I want to do is simple - in my modeler I setup a set of, say, cubes that are in the position I want my lights in the eniviroment I'm building. I bring that set of cubes into poser run the script that then replaces each cube with a spotlight or pointlight. can this be done? can someone make it for me? plllllllleeeeaaaasseee... ok.. I'll stop the bad Roger Rabbit impression...


nruddock ( ) posted Thu, 23 March 2006 at 3:12 PM

If your prepared to name your cubes SpotlightNN or PointlightNN (where NN = 01 thru 99).

Will the cubes be in a seperately loaded OBJ file (one group per cube) or part of the environment object (again on group per cube) or something else ?

There will need to be some convention to determine the spotlight direction if you expect that to be set automatically (perhaps another cube called SpotlightTargetNN).

Besides direction most of the other light parameters will need defaults in the script (could possibly make use of materials to set the colour).

Now no singing or I'll have to find some Dip ;)


Khai ( ) posted Thu, 23 March 2006 at 4:06 PM

"f your prepared to name your cubes SpotlightNN or PointlightNN (where NN = 01 thru 99)." thats exactly the idea I was thinking of for that part.. "Will the cubes be in a seperately loaded OBJ file (one group per cube) or part of the environment object (again on group per cube) or something else ?" was thinking 1 OBJ with each Cube as a group "There will need to be some convention to determine the spotlight direction if you expect that to be set automatically (perhaps another cube called SpotlightTargetNN)." Had'nt thought of that LOL.. but that sounds like a good idea.. not DIP!!!


nruddock ( ) posted Thu, 23 March 2006 at 5:30 PM

Just to summarise.
There will be one OBJ file (a single Poser prop) which will have one group per light (conveniently named to determine the type of light).
In the case of a Spotlight there will be another group (conveniently named) used to determine where the Spotlight will point at.

To determine the actual location of a light, the average position of the vertices in the relevant group seems the best choice.
To avoid having to do some math, I was thinking that creating a new Prop (would be invisible) for each target and then using the built-in PointAt for the Spot would be good (hopefully it won't cause problems even if there are a lot of lights).

I won't be attempting this before tomorrow (Friday) night.


Khai ( ) posted Thu, 23 March 2006 at 7:13 PM · edited Thu, 23 March 2006 at 7:13 PM

whenever is good for you mate ... I'm just glad someones gonna write it :)

I owe you one :)

Message edited on: 03/23/2006 19:13


nruddock ( ) posted Fri, 24 March 2006 at 3:43 PM

Save attached file to e.g. CubesToLights.py

Import OBJ with suitably named groups, select the guide object and run script (if freshly imported should be selected by default).

Default naming convention is :-
Group name = "SpotLight" + 2 digits => Spotlight.
Group name = "PointLight" + 2 digits => Point light.
Group name = "Target" + 2 digits => Target for spotlight with same 2 digits.

Naming convention, number of digits, whether to delete existing lights, and whether to hide the original prop are configurable by editing the variables at the beginning of the script.


Khai ( ) posted Fri, 24 March 2006 at 3:49 PM

thank you! I owe you one! :):):):):)


Khai ( ) posted Tue, 28 March 2006 at 4:30 PM

aargh sorry fo not getting back sooner - (hadda refit the bathroom ...) when I run the script I get the following 'Traceback (most recent call last): File "", line 100, in ? File "", line 78, in AddPointsToList NameError: global name 'NUM_DIGITS' is not defined'


nruddock ( ) posted Tue, 28 March 2006 at 5:00 PM

file_335938.jpg

Sorry about that, it should be _NUM_DIGITS (add an underscore before the N).

Fixed version attached.


TrekkieGrrrl ( ) posted Mon, 08 May 2006 at 6:02 AM

Any chance of attaching this once more? Seems it didn't make it through the Forum conversion and I'd like to try this one out as well...

FREEBIES! | My Gallery | My Store | My FB | Tumblr |
You just can't put the words "Poserites" and "happy" in the same sentence - didn't you know that? LaurieA
  Using Poser since 2002. Currently at Version 11.1 - Win 10.



nruddock ( ) posted Mon, 08 May 2006 at 11:32 AM

The script is intact, but the conversion treated all attachments as images.

Just right click and select "Save As ..." or "Save Link Target As ...".
When the File Save dialog comes up just change the extension to .py and click OK.


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.