• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Syntax in modeldef.xml for animations

Messages
27
Country
switzerland
Hello

Does anybody know the special attention to the syntax in the modeldef.xml file concerning misplaced blanks or other general characters.

Thanks and best regards
Kurt Stoeckli
 
Last edited:
Could you possibly make your question more vague, as I've no clue as to what you actually want to know... :o

With regards to syntax errors, unlike its predecessor, makemdl.parts.xml, only the 'XML blurb' containing the error is affected. All other 'XML blurbs' will continue to work as written.

The syntax is rigorous and precise: capitalization is critical, as are spaces in unique tags such as "if{ " and "els{ " where the space is an integral part of the tag.
 
I received the Gmax file incl. the makemdl.parts.xml of the F-5E Tiger done for FS2004. Now I want to convert it to FSX-material and -animation. I did all the texturing and the transparent parts. It all worked out.
I now changed the makemdl.parts.xml to the modeldef.xml including capitalization and the GUIDs for each animation name (as in the SDK).
Questions:
- What else do I have to consider in the modeldef.xml file
- When is it a "Standard" or a "Sim" type. The SDK is not precise enough
- When is typeParam "AutoPlay" and/or "Random" or just "". The SDK is not precise enough.

I hope this is understandable.
Thanks in advance for any advise.

regards
Kurt Stoeckli
 
Last edited:
With the sole exception of code that is only for a <Visibility> condition, all <Name=...> tags will require a corresponding <Animation Name=...GUID...> entry as well.

Each GUID must be unique, but for practical use simply copy/pasting any existing GUID from another entry, then changing at least one number in each group will provide a unique number.

For our purposes, only type="Sim" need be considered. The type="Standard" although not documented, seems only to be required for XML used in Missions.

I've snipped the following from a reply I made months ago at Freeflight Design.

http://www.aerodynamika.com/cgi-bin/yabb/YaBB.cgi?num=1189961020/7#7

The long answer is yes, you can cut-and-paste, but...

...you will need to "translate" the "old XML schema" to the "new XML schema..."

...AND you must create an <Animation name=....GUID#.....> entry for each new bit of code, whether the actual code is for an animation or not. 8-)

There are several examples posted in the XML Parts forum.

For example, compare the same "switch_strobe_light" code for both schemas:

FS9 XML Schema -
Code:
   <part>
      <name>switch_strobe_light</name>
      <animation>
         <parameter>
            <sim>
               <variable>LIGHT STROBE</variable>
               <units>bool</units>
               <scale>50</scale>
            </sim>
            <lag>400</lag>
         </parameter>
      </animation>
      <mouserect>
         <cursor>Hand</cursor>
         <help_id>HELPID_GAUGE_LIGHT_SWITCH_STROBE</help_id>
         <tooltip_id>TOOLTIPTEXT_LIGHT_SWITCH_STROBE</tooltip_id>
         <event_id>STROBES_TOGGLE</event_id>
      </mouserect>
   </part>

FSX XML Schema -
Code:
<Animation name="switch_strobe_light" guid="a2db42b1-28c7-4fde-a659-71e016de7f46" length="50" type="Sim" typeParam2="switch_strobe_light" typeParam="AutoPlay" />


    <PartInfo>
        <Name>switch_strobe_light</Name>
        <AnimLength>50</AnimLength>
        <Animation>
            <Parameter>
                <Sim>
                    <Variable>LIGHT STROBE</Variable>
                    <Units>bool</Units>
                    <Scale>50</Scale>
                </Sim>
                <Lag>400</Lag>
            </Parameter>
        </Animation>
        <MouseRect>
            <Cursor>Hand</Cursor>
            <HelpID>HELPID_GAUGE_LIGHT_SWITCH_STROBE</HelpID>
            <TooltipID>TOOLTIPTEXT_LIGHT_SWITCH_STROBE</TooltipID>
            <EventID>STROBES_TOGGLE</EventID>
        </MouseRect>
    </PartInfo>

Quite aside from the addition of the <Animation name=....> line, note that every <tag> in FSX XML schema is mixed-case. This is critical because unlike FS9's schema, FSX is "case sensitive."

Thus <part> becomes <PartInfo>, and <Partinfo> or <partinfo> or <partInfo> won't work!

However, all that said, the process of "translating" is extremely easy, and takes only a few minutes...

That is because, aside from the <Tags> themselves, the actual contents between the <Tags> hasn't changed at all! ;D
 
Hello Bill

Thanks very much for your fast answers.
I made all changes to the FSX XML Schema except the line <AnimLength>50</AnimLength>. I will insert that as well.

In the line with the GUID of your example, you have typeParam="AutoPlay". How critical is that and how is the rule for "Random", "Autoplay", "Random, Autoplay" or ""?

I could make all standard animations working like Gear, Door Flaps etc. It is actually easy using the Animation Manager in Gmax.

Best regards
Kurt Stoeckli:)
 
All I can say regarding "AutoPlay" vs. "Random" is to cite the SDK:

AutoPlay: The animation will run when the object is rendered.

Random: The animation will be started at a random point along its timeline.

Essentially, for our purposes we will always use "AutoPlay" because we would want our animation to react immediately. It would be rather disconcerting to have flaps deploy whenever they felt like it, rather than on command... :eek:

I will point out that the <VisibleInRange> function does not work so don't even waste any time trying to use it... ;)
 
Hello Bill

Thanks very much for your answers, they were all helpfull.

At the end of your last post you say that the function <VisibleInRange> does not work. In my FS9 XML Schema, the old function (<visible_in_range>) is used often. What would you use instead of <VisibleInRange> in the FSX XML Schema?

Best regards
Kurt Stoeckli
 
Hello Bill

Thanks very much for your answers, they were all helpfull.

At the end of your last post you say that the function <VisibleInRange> does not work. In my FS9 XML Schema, the old function (<visible_in_range>) is used often. What would you use instead of <VisibleInRange> in the FSX XML Schema?

Best regards
Kurt Stoeckli

Some folks have pointed to "default code" in the SDKs modeldef.xml that uses the <VisibleInRange> tags. What they haven't realized is that those examples don't work! Why ACES left "bad code" in their SDK modeldef.xml file is anyone's guess. I would be charitable and posit that they simply forgot about it... :)

I have to move the condition to the <Code> section of the XML script, so I can create a boolean condition from the result to control the <Visibility>

For example, suppose I wanted to have something only visible between the range of an (L:MyVariable,number) 40-60:
Code:
<Code>
     (L:MyVariable,number) 40 &gt; 
     (L:MyVariable,number) 60 &lt; 
     and 
     if{ 1 } els{ 0 }
</Code>

In the example above the return result is "1" only when both conditions are true, otherwise the return result is "0"... ;)
 
Last edited:
Hi Bill

Thanks very much for your helpful answers. It works fine with <Visibility> and with <Code>.
But I discovered one very important thing:
I have some parts (pilot's ladder etc.) without animation, but these parts have to be visible under certain conditions. In this case, the part name has to be the same as the animation name in the modeldef.xml. This is not the case for parts with animation.
Can you confirm that?

Randomly the "FS Tools" in the menu bar of Gmax disappears. Sometime I have to restart Gmax several times for the "FS Tools" to appear again. Do you know anything about that?

Besr regards
Kurt Stoeckli
 
But I discovered one very important thing:
I have some parts (pilot's ladder etc.) without animation, but these parts have to be visible under certain conditions. In this case, the part name has to be the same as the animation name in the modeldef.xml. This is not the case for parts with animation.
Can you confirm that?

I cannot say I've run into this myself. I've not found that the partname has any significance in FSX Animations. Instead it is the XML "name" that is associated with any specific part that has meaning.

Randomly the "FS Tools" in the menu bar of Gmax disappears. Sometime I have to restart Gmax several times for the "FS Tools" to appear again. Do you know anything about that?

You don't need to close/restart GMax. Instead, Open MAXScript/Run Script and choose FSToolsMenu.ms then "Open." You may need to do it more than once before it loads the menus...
 
Back
Top