Forum: Poser Python Scripting


Subject: Storyboard Capture Script

danborn opened this issue on Jan 19, 2011 · 25 posts


danborn posted Wed, 19 January 2011 at 10:07 PM

G'day All,

Noob to Poser & Python here, but am fairly-well versed in CAD and scripting automation. Basically, I'm using the animation keyframes in Poser as a comic-strip storyboard.  The net result are gross changes in camera, poses and props between keyframes, and no interpolating animation is (or will ever be) required. 

So what I'd like to accomplish is 'capturing' camera position and figure poses frame-by-frame to the Library for each comic strip, for reuse in future episodes going forward.

Currently I'm doing this manually, and it's been a real pain in my date!

User Setup:
To keep it simple, I envision capturing just poses for the 'selected' figure, and operating on the 'selected' library collections for poses and cameras.  And to further simplfy, I envision using the frame number as the library pose and camera position save-name -- thus the library collections created will be self-indexing to the comic strip episode frames from whence they came. 

So to begin, the user first selects the desired figure, and the desired library collections for poses and cameras.

Python Script Pseudocode:

Am pretty handy with a text editor (UltraEdit), VBA, VBS, Perl and Regular Expressions, but Python is new territory.  Now the user...

  1. Runs the script, and a confirmation dialog box is shown naming the user's selected figure, and and Library pose and camera collections that will be updated, with options for 'OK' and 'Cancel'.

  2. If user clicks OK, then loop thru the frames (partially based on a scrap of code I found thanks to Mr. Okham), red is my psedocode:

for n in range(scene.NumFrames()):
            scene.SetFrame(n)
           # Pad-out n with leading zeros, as required...
            nnnnnn = Pad(n)
           # Auto-overwrite any existing library elements of the same name...
            scene.SaveLibrary("Pose", nnnnn)
            scene.SaveLibrary("Camera", nnnnn)
        self.master.destroy()

  1. And that, except for the opening and closing code formalities, should be it!  Very simple, and a very big timesaver for me (and hopefully others). 

In the time it took me to write this, I could've indexed perhaps one of my comic strips.  And there's dozen more to do with many more on the way.  Going forward, as I come down the learning curve on Python, I envision adding multiple characters and props to the loop, and I do promise to share the results as a token of my appreciation for the leg-up here.

So if any of you 'Pythoncologists' out there have an extra few minutes to flesh-out this straw horse, I'd be much obliged...

Cheers!
Danborn