• 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.

FSX Change xml code in a MDL file

Messages
371
Country
france
In the past, I have succeeded to change a value in an existing mdl file with a hexadecimal editor.
It was in the A321_interior.mdl, where the ND rotary Knob, link to a L:var had 4 positions, while the knob has 5 positions in the 2D cockpit.
I have found where was the value to change and it worked fine.

So today, I would like to change some code about the throttles. I write a FMS for Project Airbus, and I would like to create the real function of the A/THR on an Airbus : In fact, when a Airbus is under A/THR, the throttles don't move (thy are on the climb position).

IN the MDL file, I see this code about the left throttle:

Code:
(L:EmergencyThrottleInUse, bool) 1 !=
                    if{ (A:GENERAL ENG THROTTLE LEVER POSITION:1, part) s0 0 >= if{ l0 -50 * 50 + }  els{ l0 (A:THROTTLE LOWER LIMIT, part) / 1 + 50 * } d (>L:Engine1ThrottlePosition, percent) } els{ (L:Engine1ThrottlePosition, percent) }

and this code for the right throttle :

Code:
(A:GENERAL ENG THROTTLE LEVER POSITION:2, part) s0 0 >= if{ l0 -50 * 50 + } els{ l0 (A:THROTTLE LOWER LIMIT, part) / 1 + 50 * }

In the first throttle code, you see 2 L:var which allows to stop the animation of the throttle.

I have try to use these L:vars and that works like I want, but only for the left throttle (logical).
When I set to 1 (>L:EmergencyThrottleInUse, bool) , the animation of the throttle is stopped, and I can set this position like I want, with the (>L:Engine1ThrottlePosition, percent). That's not affect the A/THR operation, only the animation of the throttle is concerned.
That ecxaltly that I want !! But the mdl file hasn't these L:Var for the second throttle.

So I have tried to change with my hexadecimal editor, the code of the second Thottle in the mdl file by this code :

Code:
(L:EmergencyThrottleInUse, bool) 1 !=
                    if{ (A:GENERAL ENG THROTTLE LEVER POSITION:2, part) s0 0 >= if{ l0 -50 * 50 + }  els{ l0 (A:THROTTLE LOWER LIMIT, part) / 1 + 50 * } d (>L:Engine2ThrottlePosition, percent) } els{ (L:Engine2ThrottlePosition, percent) }
This is the same code of the left throttle, but with a new L:var off course
But that doesn't work. The 2 throttles disappear totally !!!:eek:

I think that the problem is because the file hasn't the same numbers of bytes, or maybe an offset table for the sections in the file.

Have you an idea to solve this porblem ?

Is there a tool to edit the mdl file ?

Thank you very much.

Francois
 
Yes, it is because you are not maintaining the same number of bytes. Your change from 4 to 5 didn't have that problem.

I'm not aware of an MDL editor, sorry. The best I know is to import the model into ModelConverterX, export as a 3DS file, and import into GMAX/Max. Then it's a long process to reweld all vertices, resmooth the plane, and reanimate it.
 
Don't forget the necessary remapping of all parts.

Then again...revising the A321 VC might be worth it, since it has a few bugs hindering proper operation.
Also, position adjustment for the A318, 319 and 320 would then be possible.
 
Hi,

Luckily, you don't have to remap the parts - you only have to open each material and press the little blue and white cube to get it all back. :)
 
Oh, okay.

It's been a while since I've tried exporting .3DS files from MCX...
 
Thank you much for your response.

But I don't know how works 3D studio max or Gmax. I have tried Gmax I must have the brain of a red fish.

I quit because I really do not understand nothing to this software.

Thank you very much for your responses !

@ heretic :

I have adapted the A321 Vc to the A318/A319/A320 and A321 of ^roject airbus, and I have re-working all the panel with new gauges (vnav , tcas, SFCC, autolanding ....)

You can found ity on AVSIM with my name as filter : Francois Dore. The serie calls A318 FD special version V3 , A319 FD special Version V3 .....

And now, I re-work totally the PFD, and I create a FMC-like, but I need to change this value for the throttle for a realistic operation of the A/THR.

But as I do u know anything about design and 3D software, I'll drop this feature
 
I have adapted the A321 Vc to the A318/A319/A320 and A321 of ^roject airbus

Did you also change the position of the cockpit?


Even if you assign the VC model of the A321 to an A318, it would still be positioned at the same location as on the A321. This makes pulling into a gate or precise turns quite difficult.
 
Man, this is ingenious. If you can change/modify basic animations of L:vars in a MDL to fix knobs, then keep in that area, as redoing the entire model for a knob would take ages to do, like weeks or months, and you would need all of those strings of custom code, etc, etc, etc, etc, etc.

See if you can get your hex code to work. That would be your best route.

Its too bad that the team that made your plane cannot offer to tune it. They might be terribly busy, but then again, they might be able to squeeze in the fixes over a weekend and at least get you a copy.

There are so many details on these planes, it can be daunting to make just a few changes, as you need to issue fixes to all the different channels, vendors, customers. Update files, redone CD's, etc, etc, etc. But maybe they would do one for you. Just show them exactly what needs to be done and be extremely polite and just maybe....



Bill
 
Bill, understand that any changes to a .mdl file via a hexeditor may only be on a 1:1 basis. You can't add more "stuff" nor may you remove "stuff..."

The most you can do is change an A for a B or a 3 for a 2 or some such... ;)
 
Did you also change the position of the cockpit?


Even if you assign the VC model of the A321 to an A318, it would still be positioned at the same location as on the A321. This makes pulling into a gate or precise turns quite difficult.

All works perfectly. I have just change the position of the VC_light in the aircraft.cfg (and also a the position of a VC day light that I have added, to bright the instrument when you use the soft called "shade", that darker the VC when use facing the sun.
Jetways come to the right place and all work.



Man, this is ingenious. If you can change/modify basic animations of L:vars in a MDL to fix knobs, then keep in that area, as redoing the entire model for a knob would take ages to do, like weeks or months, and you would need all of those strings of custom code, etc, etc, etc, etc, etc.

See if you can get your hex code to work. That would be your best route.

Its too bad that the team that made your plane cannot offer to tune it. They might be terribly busy, but then again, they might be able to squeeze in the fixes over a weekend and at least get you a copy.

There are so many details on these planes, it can be daunting to make just a few changes, as you need to issue fixes to all the different channels, vendors, customers. Update files, redone CD's, etc, etc, etc. But maybe they would do one for you. Just show them exactly what needs to be done and be extremely polite and just maybe....



Bill

I can not blame the team members because it is the FSX A321 VC that I used.
The Project Airbus A32x family are not provided with VC.


Bill, understand that any changes to a .mdl file via a hexeditor may only be on a 1:1 basis. You can't add more "stuff" nor may you remove "stuff..."

The most you can do is change an A for a B or a 3 for a 2 or some such... ;)

That is correct. This is why my first change worked, because I just replaced a 4 by 5. No change of bytes number.


But, I have tried the Tgibson solution and He is right, actually, I can export the VC with modelconverterx on a .3 DS file, and open it with GMAX, but I do not understand GMAX and I do not know how to change the xml code of the animation in GMAX.


If anyone knows how summit, I am ready to provide my mdl file of the VC and the xml code to change on the second throttle lever.

Project Airbus was assigned to me,the mission to make the gauges of their future A330, for which they create their own VC and here they can write the right code to create this real throttle operation.

But Before, I wish I had tried on the A320, to be sure it works the way I want.

Please, if sommeone know how to operate this change in the mdl code, tell me.
This code would allow the throttles do not move alone under A/THR, but they will move with the hand, even with A/THR, like a real Airbus.

I don't know why microsoft has write the right code only for the first throttle lever and not for the second throttle lever.

Thank you for your interest.

Francois


Francois
 
Last edited:
Francois, the problem is that you would need to re-create and/or edit some of the XML script in the modeldef.xml file, then redo all of the Animation assignments, as well as use the Attachpoint Tool to reassign all of the mouse controls.

The model's XML scripts are in the modeldef.xml file. When exporting from Max or GMax, the export module parses the modeldef.xml file and creates an nnn.xanim file for the animations, and an nnn.x file for the mesh.

When the compiler is run, it merges the nnn.x and nnn.xanim files to create the final nnn.mdl file.

GMax does all of this automatically then deletes the intermediate nnn.x and nnn.xanim files. Those of us who use Max have to run the compiler manually.
 
And the modeldef entries are not recreated when you export as a 3DS file, unfortunately. So you have to create them and add them to the default XML file.

If you have never used GMAX before this will be a huge undertaking, and since this is the MS VC you won't be able to release it publicly anyway.
 
Thanks for your explanations. I havn't all understand, but I see a little the way.
Tgibson, The modification of the MS VC is not for public distribution, but for try if that I want can work.

So we forget this solution.

But I want to know if this feature is possible, in order to ask to at the project airbus creator of the A330 VC to make this change.

I have open the modeldef.xml and I have found the code for the 2 throttles:

HTML:
<PartInfo>
        <Name>lever_throttle0</Name>
        <Copy>lever_throttle</Copy>
        <AnimLength>100</AnimLength>
        <Animation>
            <Parameter>
                <Code>
                    (L:EmergencyThrottleInUse, bool) 1 !=
                    if{ (A:GENERAL ENG THROTTLE LEVER POSITION:1, part) s0 0 &gt;=
                    if{ l0 -50 * 50 + }
                    els{ l0 (A:THROTTLE LOWER LIMIT, part) / 1 + 50 * }
                    d (&gt;L:Engine1ThrottlePosition, percent)
                    }
                    els{ (L:Engine1ThrottlePosition, percent) }
                </Code>
            </Parameter>
        </Animation>
        <MouseRect>
            <TooltipID>TOOLTIPTEXT_THROTTLE_ENG1_THROTTLE_PERCENT</TooltipID>
            <CallbackDragging>
                <Variable>GENERAL ENG THROTTLE LEVER POSITION:1</Variable>
                <EventID>THROTTLE1_SET</EventID>
            </CallbackDragging>
        </MouseRect>
    </PartInfo>

    <PartInfo>
        <Name>lever_throttle1</Name>
        <Copy>lever_throttle</Copy>
        <AnimLength>100</AnimLength>
        <Animation>
            <Parameter>
                <Code>
                    (A:GENERAL ENG THROTTLE LEVER POSITION:2, part) s0 0 &gt;= if{ l0 -50 * 50 + } els{ l0 (A:THROTTLE LOWER LIMIT, part) / 1 + 50 * }
                </Code>
            </Parameter>
        </Animation>
        <MouseRect>
            <TooltipID>TOOLTIPTEXT_THROTTLE_ENG2_THROTTLE_PERCENT</TooltipID>
            <CallbackDragging>
                <Variable>GENERAL ENG THROTTLE LEVER POSITION:2</Variable>
                <EventID>THROTTLE2_SET</EventID>
            </CallbackDragging>
        </MouseRect>
    </PartInfo>



As you can see, the code for the throttle 0 is different of the code for the throttle 1. There is a 2 L:Vars [ (L:EmergencyThrottleInUse, bool) (L:Engine1ThrottlePosition, percent) ] in the throttle 0 code and not in the throttle code 1.

I have tested these L:vars in my gauge, and they do the things that I want.
If you set 1 (>L:EmergencyThrottleInUse, bool) , the animation of the throttle is stopped, even with A/THR, but the A/THR works normally, and you can set the postion of the animation of the throttle with a value 0 to 100 at (>L:Engine1ThrottlePosition, percent).
With this discovery, I can achieve the real A/THR of an airbus, because, on airbus, there isn't mechanical link between throttle and engines. So, to engage the A/THR, you place your throttles on the Climb detent, and A/THR become active and thottles do not move. But you can move it with your hand. (e.g, do disarm A/THR, you can set the throttles to idle position or flex or toga position).
With this to L:Vars, I do this function on the throttle one, but I cannot do the same thing on the throttle 2, because there isn't the same code.

If I have understood what you said, this is the Modeldef.xml file that is used when Gmax compile the .mdl file. So if the modeldef.xml file code is modified, that should be work.

so, if I ask the the creator of the A330 VC to replace in his modeldef.xml the original code that I have quoted above by this one :
Only the code between the <code> </code> change and there is new L:var

HTML:
<PartInfo>
        <Name>lever_throttle0</Name>
        <Copy>lever_throttle</Copy>
        <AnimLength>100</AnimLength>
        <Animation>
            <Parameter>
                <Code>
                    (L:EmergencyThrottleInUse, bool) 1 !=
                    if{ (A:GENERAL ENG THROTTLE LEVER POSITION:1, part) s0 0 &gt;=
                    if{ l0 -50 * 50 + }
                    els{ l0 (A:THROTTLE LOWER LIMIT, part) / 1 + 50 * }
                    d (&gt;L:Engine1ThrottlePosition, percent)
                    }
                    els{ (L:Engine1ThrottlePosition, percent) }
                </Code>
            </Parameter>
        </Animation>
        <MouseRect>
            <TooltipID>TOOLTIPTEXT_THROTTLE_ENG1_THROTTLE_PERCENT</TooltipID>
            <CallbackDragging>
                <Variable>GENERAL ENG THROTTLE LEVER POSITION:1</Variable>
                <EventID>THROTTLE1_SET</EventID>
            </CallbackDragging>
        </MouseRect>
    </PartInfo>

    <PartInfo>
        <Name>lever_throttle1</Name>
        <Copy>lever_throttle</Copy>
        <AnimLength>100</AnimLength>
        <Animation>
            <Parameter>
                <Code>
                    (L:EmergencyThrottleInUse, bool) 1 !=
                    if{ (A:GENERAL ENG THROTTLE LEVER POSITION:2, part) s0 0 &gt;=
                    if{ l0 -50 * 50 + }
                    els{ l0 (A:THROTTLE LOWER LIMIT, part) / 1 + 50 * }
                    d (&gt;L:Engine2ThrottlePosition, percent)
                    }
                    els{ (L:Engine2ThrottlePosition, percent) }                </Code>
            </Parameter>
        </Animation>
        <MouseRect>
            <TooltipID>TOOLTIPTEXT_THROTTLE_ENG2_THROTTLE_PERCENT</TooltipID>
            <CallbackDragging>
                <Variable>GENERAL ENG THROTTLE LEVER POSITION:2</Variable>
                <EventID>THROTTLE2_SET</EventID>
            </CallbackDragging>
        </MouseRect>
    </PartInfo>

Like this, I have the L:var to disable the aniamtion of the 2 throttles : (L:EmergencyThrottleInUse, bool)

And I have a L:Var by engines, to control with my code their animation :
- (L:Engine1ThrottlePosition, percent)
- (L:Engine2ThrottlePosition, percent)

I repeat, only the animation is affected; the engines continues to work under A/THR.

Excuse me for ny bad english, but this is very important to me , because, without this solution, I could never reproduce the true operation of Airbus A/THR.

I have created the sounds of the detents (Climb, FLEX-MCT and Toga, and reverse) like you can see in this video that i have made about my FMS gauge :

http://youtu.be/GgpTK8-1TjY

, but, at this time, the FSX A/THR function prevents me to make a 100% realistic operation
 
Last edited:
Like this, I have the L:var to disable the aniamtion of the 2 throttles : (L:EmergencyThrottleInUse, bool)

And I have a L:Var by engines, to control with my code their animation :
- (L:Engine1ThrottlePosition, percent)
- (L:Engine2ThrottlePosition, percent)

I repeat, only the animation is affected; the engines continues to work under A/THR.

This will work ok BUT, you should take into account that even the throttles won't move (the animation part),engines will change power if you drag the throttle handles with your mouse, giving a rather weird effect. This will happen because you are keeping the Mouse Callback code original:

Code:
<CallbackDragging>
      <Variable>GENERAL ENG THROTTLE LEVER POSITION:1</Variable>
      <EventID>THROTTLE1_SET</EventID>
</CallbackDragging>

Fine if this don't bother you, otherwise you have two choices:

-Modify the <CallBack...> code considering the status of (L:EmergencyThrottleInUse, bool)
-Capture the THROTTLEn_SET event in a gauge, consider the status of (L:EmergencyThrottleInUse, bool) and act accordingly

Tom
 
thank you for this precision, tom, which is very important !

So, you confirm that if the guy modify its modeldef.xml like that, and when he will compile in gmax, the new l:var for the second throttle will be and the (L:EmergencyThrottleInUse, bool) will be active for the 2 throttles ?

If yes, this is a great news !
 
Hi,

I comeback in my thread, because I have completed 30% of the panel and the new FMS gauge, but this throttles default code begin to make a real problem to have a realistic gauge.

My personal opinion is that there is no problem of copyright, because Microsoft gives multiple examples in its SDK, to modify the code of componets of FSX or existing gauges.
And I consider that it is a really huge stupidity or forgetfulness to have write different code for the 2 levers !
And the use is for a freeware aircraft.

What is your opinion about that ?

So I have asked to the member of Project Airbus who create the future A330 VC to modify the A321 defaut VC code.
But he is very busy with the creation of the A330 VC and cannot work for my demand, because He has explained to me that when we export a MDL file in 3ds format with modelconverterx, all the animation code is lost, and it requires a lot of work to re-create the links for the animation.

I am very disapointed to havn't a real throttle animation.

So, If a specialist of GMAX wants to team up with me for this project and accept to do the job to change the part of the code of the A321 VC, this will be fantastic.

Excuse me for my bad english.

Francois Dore
 
Back
Top