Thu, Jan 9, 3:45 PM CST

Renderosity Forums / Poser Python Scripting



Welcome to the Poser Python Scripting Forum

Forum Moderators: Staff

Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 pm)

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: How should I read all parameters with keyframes? NextKeyFrame()?


timarender ( ) posted Tue, 10 December 2013 at 7:05 AM · edited Thu, 09 January 2025 at 6:40 AM

I would like to access the values of any parameters of Actors which contain keyframes. Andy's Chest, for example includes Twist, Side-Side, Bend, Scale etc.

My slightly ugly code below does NOT work. And I don't understand why not.

Please. Can anyone put me out my misery - how am I supposed to do it?

 

scene = poser.Scene()
scene.SetFrame(0)
figs = scene.Figures()
for fig in figs:
    acts= fig.Actors()
    for actor in acts:
        scene.SelectActor(actor)
        frame = 0
        scene.SetFrame(frame)
        for parm in actor.Parameters():
            frame = 0
            while( frame < scene.NumFrames()-1):
                frame = parm.NextKeyFrame()
            if(not frame):
                 frame = scene.NumFrames()
            else:
                scene.SetFrame(frame)
                print frame, actor.Name(), parm.Name(), parm.Value()


PhilC ( ) posted Tue, 10 December 2013 at 8:44 AM

You need to indent:-

if(not frame):

and all the lines below it.


timarender ( ) posted Tue, 10 December 2013 at 9:11 AM

Many thanks! I have corrected it and it runs. But oddly, at any keyframe it only finds one paramater for one actor. e.g.

I Load Andy. At frame 11, I set values for his "Chest", for Twist, Side-Side and Bend. When I run the script, it only finds "Twist". And not for the other two parameters.

It feels like Keyframes are attached to the Actor, but don't indicate all the Parameters which may have contributed to being a Keyframe for the Actor.

Hoping I am making sense. And more hopeful that I am missing something obvious.

Thank you.


PhilC ( ) posted Tue, 10 December 2013 at 9:29 AM

You need to reset the scene frame to zero at the start of the loop "for parm in actor.Parameters():"


timarender ( ) posted Tue, 10 December 2013 at 9:59 AM

Many thanks PhilC! That works perfectly.


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.