Thu, Dec 12, 10:02 PM CST

Renderosity Forums / Poser - OFFICIAL



Welcome to the Poser - OFFICIAL Forum

Forum Coordinators: RedPhantom

Poser - OFFICIAL F.A.Q (Last Updated: 2024 Dec 12 6:08 pm)



Subject: Is it possible to modify exporters?


WarKirby ( ) posted Mon, 11 January 2010 at 4:45 PM · edited Thu, 12 December 2024 at 9:52 PM

I do animation work for Second Life. And one unfortunate issue there is that hip offsets in bvh animations are halved on upload. Why this is, I don't know, but I'm kind of getting tired of waiting for someone else to fix it.

So I'm thinking, since I make animations with poser 7, maybe it's possible to add to/modify it to accomodate this issue. Essentially what I'd like to do, is modify the bvh exporter to double hip offsets when exporting. Or ideally, add an alternate bvh (fixed) exporter that does the above.

I can't seem to find anything visible that controls it though. I was assuming that exporting was handled by python scripts. If that's the case, I can't seem to find them. Can anyone point me in the right direction?

Or is this just not possible at all?


PhilC ( ) posted Mon, 11 January 2010 at 4:54 PM · edited Mon, 11 January 2010 at 4:56 PM

If the hip x,y,z translation values were doubled just prior to using the Poser BVH export would that produce the correct result in SL?

If so then that is easily scripted.


WarKirby ( ) posted Mon, 11 January 2010 at 5:06 PM · edited Mon, 11 January 2010 at 5:07 PM

Quote - If the hip x,y,z translation values were doubled just prior to using the Poser BVH export would that produce the correct result in SL?

If so then that is easily scripted.

Yes, exactly. Everything works fine if I manually double those values, for every keyframe, in every animation.

It's just a lot of annoying work and I'm looking for a way to reduce that. Not to mention that doubling the translations in poser kind of looks silly and ruins the visual guide of the thing.

Is it possible to modify an existing exporter? could you point me to the script I'd have to edit. or if not, explain roughly what else I'd have to do to make this work.  I'd like to give it a shot myself, though I may end up hiring someone to code it if it seems too bothersome.


markschum ( ) posted Tue, 12 January 2010 at 9:03 AM

a script to double the hip values in each keyframes doesnt sound too hard. I suspect that Phil will have one shortly. :) 

I dont think the exporters are exposed for changes as you describe.


PhilC ( ) posted Tue, 12 January 2010 at 10:20 AM

Here you go, try this:-

http://www.philc.net/forum/viewtopic.php?p=15654

I've given it a quick run through but if you find anything that needs changing please let me know.


WarKirby ( ) posted Tue, 12 January 2010 at 11:50 AM · edited Tue, 12 January 2010 at 11:52 AM

Wow, thank you phil. That's way more than I asked for. I appreciate it wholeheartedly :O

Oddly, you never really answered what I did want to know ;) My wording wasn't too clear since I was kind of stumbling around in the dark, but my question now, is where does this script go? what directory do I have to put it in, to make it show up as an export option.

Also, will it replace the existing bvh exporter, or add an additional bvh exporter with the hip offset changes ?

And lastly, I'd assume so given that it's posted in a publicly viewable forum, but do you mind if I distribute this? freely, and with full credit to you, of course : )
It was never meant only for personal use, but rather an idea that came about from a few animators complaining in unison. I got kind of elected to go find a solution for the community.


markschum ( ) posted Tue, 12 January 2010 at 12:08 PM

Place the script in ...runtime/python/poserscripts any folder  or .runtime/python/poserscriptsscriptsmeni to put it on the scripts pulldown.

You can run it from File > run python script from the top menu.

The script prompts for file names for the bvh and will save and restore the scene so the hib doubling is not retained after the script finishes. The script  runs the bvh exporter for you after changing the hip values.

Phil will have to answer the distribution question.


PhilC ( ) posted Tue, 12 January 2010 at 12:16 PM

You're welcome. :)

Be sure you have the current version. Just after I posted the script I realized that I'd missed out the lines to actually increase the translation values ... duh! I'd been concentrating on the less familiar BVH export.

You can run the script from anywhere. If you want it to be easily accessible from the Poser Scripts menu I suggest placing it in Poser 7RuntimePythonposerScriptsscriptsMenuPhilC

This is not an export option per se, it will not affect anything in the Poser > File > Export menu. It is just a script that automates the export process to include your translation requirements. It does not replace the existing BVH exporter, that is still there unaltered as before.

I'd prefer that folks were pointed back to the forum thread rather than have it distributed. That way they will be more likely to rummage around and find more good stuff. However that is just a preference and not a binding restriction.

Glad you found it useful :)


fbunse ( ) posted Wed, 13 January 2010 at 2:41 AM

Hello PhilC and others

first of all thank you a LOT for this script. The weird y-offsets have always been the biggest bugger when exporting for SL.

Unfortunately the script does not work for me. When I create a bvh-file using this script the root is "wold_root" instead of "hip" like it is with a regular bvh-export and required for SL. Also there are additional xyz-scale parameters.

Is there any way to fix this? From how I read your script youre calling the internal bvh-exporter so I am wondering why the results differ so much from the regular export.

Also from my experience the modification only needs to be made for the y-offset and not for x, z. But that one should be an easy fix by deleting the two corresponding lines.


fbunse ( ) posted Wed, 13 January 2010 at 4:45 AM

is there no way to edit the previous post?

I played a bit with the sceneSelectionCallback function inside your script and whatever result it gives there does not seem to be any difference in the resulting bvh. Am I just dump (I dont know python and poser) or is there a bug with Poser 8? 


PhilC ( ) posted Wed, 13 January 2010 at 5:03 AM · edited Wed, 13 January 2010 at 5:04 AM

No I'm looking at it also and came to the same conclusion.

I'm currently looking at the available export option kExOptCodeSCALEFACTOR, trying different values.

Oh and just this minute noticed that kImOptCodeARMALIGNMENTAXIS is an import option ont an export option so should be removed. I'll try that now.

I really don't want to write the BVH file from scratch because I'd have difficulty justifying the time for a freebie.


PhilC ( ) posted Wed, 13 January 2010 at 5:32 AM · edited Wed, 13 January 2010 at 5:33 AM

I ran a script to get the actual code numbers for the BVH exporter. Although it is very reasonable to assume that kExOptCodeSCALEFACTOR relates to BVH it is just an assumption.

Try removing the line:

exoptions[poser.kExOptCodeSCALEFACTOR] = 0

and replacing it with:

exoptions[17] = 1

When run this gives similar values to the Poser auto scale option, and the root is now the hip.

Does this then work for you? :)


fbunse ( ) posted Wed, 13 January 2010 at 5:58 AM · edited Wed, 13 January 2010 at 6:02 AM

Thanks! :)

From a first check this seems to work. Even the modification to the x and z offsets seem to be ok. I dont have time to play with it toroughly right now but Ill give it a shoot with some "real" animations later.

 Thanks again, I really appreciate this script as its a great helper and timesaver!


fbunse ( ) posted Wed, 13 January 2010 at 7:22 AM

Oh well, seems I was a little quick with this one. The exported file now has the proper format but however the values dont seem changed at all. Doing a compare between the bvh created by the regular exporter and the one exported by the script shows identical files.

Setting exoptions[17] = 0 again results in the file that was created earlier before your mod. Which again is the same as Poser exports if you disable autoscale in the dialog. So it seems all the changes you make to the offsets are discarded.

...please tell me this does not mean you can't save the modified animation? Maybe there is just a refresh missing or something like that?


PhilC ( ) posted Wed, 13 January 2010 at 7:58 AM

Working for me. (don't you just love it when the other guy says that :)

My animation using the P4 Casual Man is:-

Frame 1
T position, all hip translations zero

Frame 30
Arms by side
hip Y rotate 90
hip X translate 1.000 Poser Units
hip Y translate 1.000 Poser Units
hip Z translate 1.000 Poser Units

Exported using Poser BVH export then used the script.

These are my files:-
http://www.philc.net/temp/BVH/


fbunse ( ) posted Wed, 13 January 2010 at 8:37 AM

Ok, it seems that I just found the problem. 

It has to be related with layers. When I am in the layer tab and activate or deactivate additional layers the result is pretty much impredictable. Either the avatar is shooting forward by insane amounts or the animation looks totally unchanged.

Going back to the keyframes and scrubbing once through the whole animation seems to fix this.

I will do some more tests later when my lil daughter is in bed and stopped nagging me so I actually can concentrate on what I am doing ;)

My Poser (8.0.2.10911) has some problems updating anyway so its maybe related to that.

You write "actList and sceneSelectionCallback apparently have no effect.". So I suppose one can NULL the sceneSelectionCallback and remove the first loop to populate the actList to speed it up?


PhilC ( ) posted Wed, 13 January 2010 at 8:45 AM

Yep :)

The callback works with the OBJ exporter. The Poser documentations is a little vague regarding its use with the BVH exporter.


fbunse ( ) posted Wed, 13 January 2010 at 9:00 AM

The poser documentation is a little vague regarding almost anything ;)

Thanks, I'll try it out later and hopefully can also come up with results regarding the layers - this really starts to confuse me.


PhilC ( ) posted Wed, 13 January 2010 at 9:10 AM

I think this is sufficiently far down the thread to avoid over self promotion. You may be interested in the Poser for Python Manual that I wrote.


fbunse ( ) posted Wed, 13 January 2010 at 12:51 PM · edited Wed, 13 January 2010 at 1:01 PM

It is more than far down enough and in fact I've already been looking for a Poser/Python reference. Silly me just never checked the "tutorial" section in your shop.

Apart from that I would have been ok to cash out some for a script like that anyway so now I get a script and the just ordered manual. Seems like a good deal to me :)

 Back to the script - I ran a few tests and it seems that just beeing in the "layer" tab already is enough to break the exported bvh. Whenever I load a scene which exports fine the export looks like the regular export when I activate the tab without making any modifications. Now if I click "include" for a layer the result is totally strange and the avatar is shooting forward. Going back to the keyframe tab fixes this problem.

So it looks to me the problem really comes from Poser and not the script. And I am hoping your book will explain how I can activate the keyframe tab again - ...or you might add it to the script already ;)

However to make sure I did an uninstall of Poser and reinstalled it from the scratch, including the current service pack and the problem still persists.


WarKirby ( ) posted Sat, 16 January 2010 at 11:21 AM · edited Sat, 16 January 2010 at 11:21 AM

Hi phil. fbunse is one of those other animators I mentioned :)

I'm doing a little testing with the version here: http://www.philc.net/temp/BVH/

Everything works fine, except that it makes poser freeze and crash after an export. It comes up with the little dialog that it successfully exported to but that never goes away, and poser goes into Not Responding state at that point.  I still get the exported bvh so it's not that bad, just somewhat annoying. Using poser 7.0.0.63

Any idea what my problem might be ?


PhilC ( ) posted Sat, 16 January 2010 at 11:26 AM

Try updating with the current Poser 7 service release. You are a few versions behind. In Poser click Help > Smith Micro Web Links > Updates.


WarKirby ( ) posted Wed, 27 January 2010 at 1:43 PM

Well, I was a bit hasty. seems it's not actually crashing. it just freezes up for a little and then returns to normal. maybe because of reversing the hip joint doubling.

An unforseen but very welcome side effect, is that unlike the native bvh exporter, it doesn't make every frame in my pz3 into a keyframe. I finally no longer have to worry about accidentally saving after an export, and destroying all the keyframes. so yay.

I've lost many animations that way before. What a stupid feature.


fbunse ( ) posted Wed, 27 January 2010 at 3:41 PM · edited Wed, 27 January 2010 at 3:41 PM

Yes, Poser becomes a bit unresponsive when browsing through keyframes. It looks like this happens when the cache kicks in. Try closing the keyframe window when you export - at least in Poser 8 processing is much faster and without the lockups. 

I can't confirm the issue about turning frames into keyframes with the regular export tho. Maybe this "feature" was removed with ver 8.


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.