PDA

View Full Version : Mass retargeting BVH files?


mm3guy
05-21-2008, 05:20 AM
Hi!

I have almost 1000 BVH files which all use the same skeleton, so the same tag template can be used. Once retargeted to my VALVe Biped, I need to do a minor adjustment on the Y axis with MOTOR so it won't float in the air, then the animation is perfect. And exported to the Source engine nicely with the ValveSource plugin.

The problem is it's impractical to do 1000 BVH files by hand this way. So I found XSI has batch support through XSISDK.

So could any of you gurus out there point me in the right direction towards making XSI load each BVH file in a folder, one by one, retargeting it and exporting an SMD animation to another specified folder using the same filename as the BVH was? I can handle the batch process of getting it into the Source engine, it's just the XSI part that's stumping me.

Any help is appreciated!

thiago
05-21-2008, 02:10 PM
It's quite very simple.
If you don't have scripting experience, I suggest you do a simple prototype:

- open XSI, open the script editor
- right click on the log panel and "clean"
- import your model, tag it, do whatever you have to do.
- copy all the log of what you did to the script area
- now make a new scene, and run the script log of the script editor. XSI will repeat every operation you did, ending exactly in the same place.

Now start to look at your script, and change the string values by variables.

So you'll need a function to search a directory and put all the files in an array.
Then you make a simple loop that will pass through each item of this array and execute all the operations you logged.

You'll need to know basic Jscript, VBscript or Python.
Start to do it and post here when if you get stuck somewhere.

mm3guy
05-22-2008, 12:58 AM
This is the code I based it off of, it anyone's interested. I expanded it, however.
Set fso = CreateObject("Scripting.FileSystemObject")
Set folderObject = fso.GetFolder("[bvh folder]")
Set filesObject = folderObject.Files

For Each file In filesObject
LogMessage file.Name
Next

All the Source SMD export window outputs is "SMDExport2", so I don't know what to do from there. Also, how do I make it automatically set the keyframe thing at the bottom to use the same amount of frames as the BVH I retargeted has?

Anyways, of the about 1000, there's only 10 or 20 I need right now, so I guess I could do those by hand.