Mon, Jan 27, 8:31 AM 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: Need Python Script to Fix Poser/BVH Rotations


tvining ( ) posted Tue, 25 September 2012 at 6:49 AM · edited Mon, 27 January 2025 at 8:29 AM

I am using BVH data imported from Optitrack Arena software into Poser that works well, except for the Hand Twist and the Forearm Side to Side. What I basically need (I think) is for the values from the Hand Twist to be added to the values of the Forearm Twist (and then the Hand Twist set to zero), and the values of the Forearm Side-to-Side to be added to the Shoulder Twist (and then Forearm Side-to-Side set to zero).

So, for example, if the Hand Twist was -10 and the Forearm Twist was +15, the script should return a value of +5, etc.

Poser theoritically can do this using the animation layers and copy and pasting animation frames around, but it's a major hassle and the results are erratic.

Does anybody know of a script that can do this? Barring that, how I could go about hiring somebody to make it?

Thanks!


markschum ( ) posted Tue, 25 September 2012 at 10:14 AM

It doesnt sound too hard. I may give it an attempt.

 

You might try Philc site , he had a BVmixer I think, Ockham may have something too.


tvining ( ) posted Tue, 25 September 2012 at 10:31 AM

Okay, thanks! It occurred to me that the fix could be made to the raw bvh file if that's simpler than scripting for Poser.

I do already use some very useful scripts by Ockham and Phil C, but this transfer of data from one body part to a different body part in just this way seems not to be out there (unless I misunderstand how some of these can work). Ockham's "Copier" is similar to what I need, in that you can copy a range of frames to another body part, but it seems to work better on like parts (like, Left Hand to Right Hand) and not to different body parts, plus I don't think it blends the frames.

Thanks for considering looking into this!

--Tim


markschum ( ) posted Tue, 25 September 2012 at 11:56 AM

file_486840.txt

OK, I have a first attempt attached here.

It does not duplicate the pose after adding the values so you might have some changes to make to the script.

I have made it as clear to follow as I can. It uses the current figure , gets the values for each bodypart (hand, forearm, shoulder) then adds the values , then sets the bodypart values , then mooves to the next frame.

I have assumed all frames are keyframes.

 


markschum ( ) posted Tue, 25 September 2012 at 11:59 AM

I use short variable names because of the language I first learned, 8 character variable ;-(

rft is right forearm twist

rfs is right forearm side

etc

I used V4 so check th Body part names.


EnglishBob ( ) posted Tue, 25 September 2012 at 11:59 AM · edited Tue, 25 September 2012 at 12:01 PM

I've done a few scripts along these lines, to correct awkward posing in animations etc., so may be able to help. I'm not hugely fluent in Python, but I do have a starting point if nothing else. Let me know if I can help.

Edit: I refreshed the thread before posting, and Mark still got in ahead of me! :P I'll hang around anyway to see how this turns out. 


tvining ( ) posted Tue, 25 September 2012 at 12:00 PM

Okay, thanks! I'll give it a spin. Yes, all keyframes.

 

Thanks again!--Tim


markschum ( ) posted Tue, 25 September 2012 at 2:21 PM

I dont think adding the rotations like that is going to give the same arm position as the original. 

Bob, if you could look at the script and yours and see if I have approached it correctly ?

 


tvining ( ) posted Tue, 25 September 2012 at 3:37 PM

file_486855.png

Gave it a try, and it works great in an initial simple test--thanks!!! The values seem to change as directed--the Forearm Side-to-Side at -100 goes to 0, and the Shoulder goes to -100, etc. I will give it a "live fire exercise" tonight when I can get at the bvh files I want to fix and see how it goes.

It looks like the pose might look quite the same as the original in all cases after processing--I imagine that's probably a Poser thing--but even working like this is huge! Attached is the first frame of the animation with the wonky forearm and hand (left), and the pose after running your script (right), which looks a little different, but the end frame of this animation which is less extreme shows both arm/hand positions looking nearly identical.

Again, thanks so much! I'll let you know how the full test goes tonight.

--Tim

PS: thanks for the offer of help, too, Bob!


EnglishBob ( ) posted Tue, 25 September 2012 at 5:47 PM

Quote - Bob, if you could look at the script and yours and see if I have approached it correctly ?

Will do - but I've so far failed to find a day with 30 hours in it, so there may be a delay... ;) 


tvining ( ) posted Wed, 26 September 2012 at 10:05 AM

Hey Markschum, last night I tried out the script on a BVH animation I had previously tried fixing by hand (I went back to the original raw file) and it worked great!!! The only glitch was that the Left Shoulder rotated "backwards" to what it should have been, but--tho I don't know anything about code--I fortunately know Poser well enough that I know that the numbers often run opposite on the left vs. right limbs, and with the help of your clear and annotated script, I thought "what the heck" and tried changing the "+" to a "–" on the Left Shoulder rotation, and that took care of it!

Again, thanks SO MUCH for this--it's going to be enormously useful to me! How can I repay your kindness??

--Tim


EnglishBob ( ) posted Wed, 26 September 2012 at 10:39 AM

Congratulations Tim, you are now a qualified Python hacker. ;-)

Mark, our approaches seem to be comparable within the variations of individual style. I used Actor.Parameter(...).Value() to read the values instead of ParameterByCode(...), but what the heck, they both work. Hopefully someone will point out the pros and cons of one versus the other.


markschum ( ) posted Wed, 26 September 2012 at 3:02 PM

I wasn't sue which to use either, the script is longer than it needs to be but I thought more readable for a new coder to hack.  I was a bit worried about using the visible parameter and bodypart names because I wasnt sure what figure was being used.

 

The original poster seems to be happy so put another + on the board ;-)

 

@tvining ,  its really not a complicated script, so dont worry about it. If you are in a position to give someone a bit of help and do so that works for me.

 

 


tvining ( ) posted Wed, 26 September 2012 at 4:22 PM

Thanks--will do!--Tim


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.