Forum: Poser Python Scripting


Subject: New light script for free..

MungoPark opened this issue on Feb 18, 2003 ยท 6 posts


MungoPark posted Tue, 18 February 2003 at 7:28 AM

Hi, I have written a small light manipulation script which does the following, may be its usefull for somebody: #Load-loads a special light file from disk - creates new lights and does not distroy old ones #Save-Saves the selected lights from listbox to text file on disk. Does not support pointat at the moment #Rename-Renames selected lights #Dim-Dims the selected light in 0.1 steps #Brighten -Brightens the selected lights #DelInvis -Deletes invisible lights #Reset- Deletes all selected lights Its a dirty hack - I havent tested it neither on P5 nor WIN - so try it out and tell me if it runs. Download the script here....... Enjoy Mungo


ockham posted Tue, 18 February 2003 at 1:27 PM

Wow! That's elegant code. You're way ahead of me on TK coding, and I've learned a couple things from your code already. I didn't test all choices, but the basic action works in P4 and P5 on Windows. Incidentally, you've found the key to making a script work in all forms. This part right here: def Quit(self): ~self.master.destroy() ~self.master.quit() I had found a much more clumsy way to make scripts work in both, but your way is simple and clear.

My python page
My ShareCG freebies


MungoPark posted Tue, 18 February 2003 at 2:35 PM

do you think its ready for free stuff ? thanx for the compliments - Mungo


ockham posted Tue, 18 February 2003 at 2:42 PM

Yes, I'd say it's ready. We seem to be working in parallel here; I've just finished, and placed in Freestuff, a similar script that focuses mainly on changing the P5 light attributes. But your basic idea is different.

My python page
My ShareCG freebies


MungoPark posted Tue, 18 February 2003 at 3:05 PM

Id like to continue on the "project collector" see post below. The only thing what is missing for me is how to copy a file in Python. I told this idea long ago to MartinC - he thinks it will prosper copyright violations, nevertheless i will do it. Mungo (BTW - how do you format these posts `?)


ockham posted Tue, 18 February 2003 at 3:41 PM

Copying a file: It can be done using "os" commands, like os.rename() and os.dup(). I don't see a simple os.copy() in the help files that I have. Alternately, you can read a file, filter the lines to change certain things, and rewrite it under a different folder. (My latest LightPanel includes an example of this, because it is the only way to modify the P5 attributes which are not available to Python.) There is -no- copyright problem with copying a file. If the user tries to -sell- the result of that copying (which he could have done by ordinary methods as well as by Python) there is a problem at that point. But the violation is not in the copying; if that were the case, every computer would be violating copyrights 100% of the time! Formatting here: The convention is to use the tilde ~ to replace a tab for indentation, because Renderosity removes all leading tabs and spaces.

My python page
My ShareCG freebies