Originally Posted by Marginal
I intend to add support for animations. But what do you mean by "custom" animations - are there animations that you can't create using gmax and for which you have to hack the .x file?
Many animations in FS9 and ALL
animations in FSX are defined in XML scripts, which is then parsed by MakeMDL.exe for FS9, and XtoMDL.exe for FSX.
Complicating matters is that the XML Schema used for FS9 is very different
to the XML Schema developed for FSX, so you would have to branch your script depending on which platform the user is exporting for...
...or have two different scripts at a minimum.
In addition, an FSX model requires an ProjectName.xamim
file, which together with the ProjectName.x
file are parsed by XtoMDL.exe to compile the finished .mdl file.
Max/GMax simply exports animation tracks; i.e., a key-frame matrix. The conditions and all other driving information comes from the XML scripts.
For example, here is an nnn.xanim for an object with a "rudder" animation file. This file would have to be generated by your Python script (or whatever handler you pass control to). It combines data from the model's animation matrix with data from the modeldef.xml file:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<Anim name="rudder_percent_key" guid="5433b2a0-0fd9-4192-8f7d-0ba36bf7191d" length="100.000000"
type="Sim" typeParam="AutoPlay" typeParam2="rudder_percent_key">
<AnimStream name="Rotation" id="0" partName="rudder" length="100.000000">
<Keyframe time="0.000000" type="Quaternion" data="0.000000;0.000000;0.000000;1.000000"/>
<Keyframe time="50.000000" type="Quaternion" data="0.000000;0.000000;0.174253;0.984701"/>
<Keyframe time="100.000000" type="Quaternion" data="0.000000;0.000000;0.344016;0.938964"/>
Here is the associated code from the modeldef.xml file for the named animation:
<Animation name="rudder_percent_key" guid="5433b2a0-0fd9-4192-8f7d-0ba36bf7191d" length="100" type="Sim" typeParam2="rudder_percent_key" typeParam="AutoPlay" />
<Variable>RUDDER DEFLECTION PCT</Variable>
If you like, I can easily generate sample .x files for either FS9 or FSX (or both) for any type of animation...
...to be truly successful, your script(s) would need to replicate the .X file and .XANIM files perfectly.
3d Modeler Max/GMax
C & XML Gauge Programmer
Eaglesoft Development Group
i7-3770k 4.2GHz - Crucial 16GB DDR3 - Dual Radeon HD770 1GB DDR5 (Crossfire) - Eco II Watercooling - Win7 64bit
i7-2600k 3.4GHz - Crucial 4GB DDR3 - NVIDIA GeForce GTX550Ti 1GB - Win7 64bit
i7-860 2.8GHz - Crucial 8GB DDR3 - NVIDIA GeForce GTS240 1GB - Win8 64bit
NOTE: Unless explicitly stated otherwise, everything written by my hand is MY
opinion. I do NOT
speak for any company, real or imagined...