Forum: Poser Python Scripting


Subject: pls help this scaling script

amacord opened this issue on Jan 04, 2007 ยท 5 posts


amacord posted Thu, 04 January 2007 at 10:53 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

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.