Sun, Oct 6, 7: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 18 2:50 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: pls help this scaling script


amacord ( ) posted Thu, 04 January 2007 at 10:53 PM · edited Sat, 05 October 2024 at 7:01 PM

first of all, all this py-business is terra incognita for me... what i want to do - or rather, what i want to get done - is basically to scale EVERYTHING in a poser scene together, including lights and cameras. one more thing that might be important: most of my pz3's are multi-frame scenes, not exactly animations, it's variations of more or less the same content, just like a comic-book. (i have p6, but i do most things in p5) nruddock kindly gave me a script, which is doing a couple of strange things. with his kind permission i post it here to ask for your help: __________________________________________________________________ import poser, traceback # The main bit: scene = poser.Scene() figures = scene.Figures() actors = scene.Actors() try: scaleAmt = 10 if scaleAmt > 0.0: ng = poser.NewGeometry() dummy = scene.CreatePropFromGeom(ng, "Dummy") param = dummy.ParameterByCode(poser.kParmCodeASCALE) # All the Figures for eachFigure in figures: eachFigure.ParentActor().SetParent(dummy) # All the Non-Figure Actors (lights, camera, etc.) for eachActor in actors: doScale = (eachActor.IsProp() and not(eachActor.IsBase() or eachActor.IsDeformer() or eachActor.IsZone())) doScale = doScale or eachActor.IsLight() if (doScale): doParent = eachActor.Parent() != None doParent = doParent and (eachActor.Parent().Name() == "UNIVERSE") if (doParent): eachActor.SetParent(dummy) if param != None: param.SetValue(scaleAmt) scene.DrawAll() dummy.Delete() except: traceback.print_exc() __________________________________________________________________ the problems i've found are: - the script does not affect infinite lights. propably normal;) - spot lights are not scaled, only moved accordingly. strange, but no problem... - props parented to other props are completely ignored. - cameras are completely ignored. the weirdest thing is a bit hard to explain... - in a multi-frame scene, when a prop is not 'keyed' in all frames, it scales right in all keyframes, but freaks out in the other frames. figures don't seem to have this problem..... TIA A.


PhilC ( ) posted Fri, 05 January 2007 at 2:42 AM

You may need to keyframe every frame. This could be added to the script, but may I ask why you want to scale everything in the first place? If I do not understand the why then its hard for me to come up with the how :)

Thanks,


amacord ( ) posted Fri, 05 January 2007 at 3:55 AM

why? my answer to this question will make you laugh: i think this scaling thing could be an additional option to deal with shadow min bias. actually i am busy testing this idea with differing results. sometimes it seems to be easier to set the value right with a bigger universe, but i can't say for sure at the moment. might well be that i am wasting my time. accordingly, if you'd help me, you might well waste your time too:) success or failure, a script for that would be most welcome... ;)A.


PhilC ( ) posted Fri, 05 January 2007 at 6:55 AM

file_364622.jpg

Here is another approach. Not better just different. Right click the broken image and save as ScaleAllSceneElements.py

Its not perfect (see notes in the header) but may give you enought for you to test with.


amacord ( ) posted Fri, 05 January 2007 at 7:18 AM

wow, now that was quick! thanks a lot for your help (and understanding;) off to start poser A.


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.