• 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 Modeldef Editing

tgibson

Resource contributor
Messages
11,338
Country
us-california
Hi,

I am working on getting some modeldef.xml entries working properly, and am wondering if there is a way to refresh (i.e. force) the reading of the SDK modeldef file when I've made changes to it and apply it to the currently loaded aircraft? I don't like editing the one in MCX since it's not the "real" one and my changes will not be reflected in the modeldef.xml file in the SDK folder.

Also, it appears that when you load a plane after editing the modeldef file, the aircraft loses those edited definitions and the part gets assigned a custom_vis_XXXX visibility instead of the new one from the SDK modeldef file. This is annoying since each time I edit the modeldef file and load a plane I have to change those assignments back from the custom_vis to the correct modeldef assignments. It would be nice that if there is a definition existing in the modeldef file MCX would use that one instead of creating one of its own.

And even if I edit the MCX modeldef file (and then go out of Edit Mode and close the Editor), the changes are not reflected in the plane that I Export. The only way I've found to change definitions are:

1. Import the plane into MCX.
2. Change the definition you want to edit to something not used on this plane. I use fly_wheel since it's easy to find. In my case I changed the c_wheel definition to fly_wheel (there is only one c_wheel in this plane)
3. Export the plane.
4. Edit the SDK modeldef.xml file and save it. In this case it appears that the c_wheel definition in the FSX SP2 SDK is incorrect, and had to be edited to operate properly.
5. Import the plane again.
6. Search for fly, and change that definition back to c_wheel. The edited definition is now loaded.
7. Export the plane again, and the new definition now allows the wheel to turn to the right (it didn't before).

Thanks,
 
Last edited:

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,883
Country
netherlands
Hi Tom,

When importing a plane the definitions are read from the MDL file, so any changes you make in the modeldef.xml file are not in the MDL. That's why you get the custom definitions, MCX can't find the matching definition in the modeldef.xml anymore. So if you have changed the modeldef.xml outside of MCX you need to assign the animations again to use the new ones on export.

What should work (but I'll have to double check that) is to edit the modeldef.xml from inside MCX. In that case if you export the MDL file again it should use the modified definition. You will also have to make sure you have the modified modeldef.xml back to your disk (at the location where MCX reads it from), so that next time it still has your changes.
 

tgibson

Resource contributor
Messages
11,338
Country
us-california
OK, I understand that when you Import a plane the process is to look for matching animations in the modeldef file and assign that name. That means I cannot edit the modeldef file *before* importing an FSX aircraft. But if there could be a button in the Modeldef Editor labeled "Refresh definitions from SDK modeldef file" and when pressed MCX updated all existing definitions for this plane using the SDK modeldef entries instead of the ones in the MDL file, then I would not have to go through such a long process for each modeldef edit. Is something like that possible?

One more thing about this situation. When the modeldef file was edited before I Imported an aircraft and this resulted in a custom_anim or custom_vis definition in MCX, when I opened the drop down box of the animations in the Hierarchy Editor (or visibilities, I've forgotten which) the list only included the definitions currently in the plane, and none from the SDK modeldef. Just thought you'd want to know.

Thanks,
 
Messages
176
Country
unitedkingdom
What may make things easier is if it were possible to copy and paste custom definitions into the Modeldef Editor.
No idea how easy that would be to implement.

Arno, thanks for all the recent improvements in MCX. I need to have another crack at a couple of conversions.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,883
Country
netherlands
Hi Tom,

I understand what you are saying. But reading the modeldef.xml again from disk would flush all custom animations that came from the model. So for something like that to work, you would actually want to merge the two sets. That's something that would require more logic than MCX has at the moment I'm afraid. But I'll check.

I'll try to see what happens with the dropdown box in the hierarchy editor. Does this happen when you edit the modeldef.xml while MCX is open and then reload the aircraft?

Essex,

What do you mean with copy and paste definitions into the modeldef editor? Since I added the edit mode you should be able to copy paste things in there. But maybe I don't understand the request correctly.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,883
Country
netherlands
Hi Tom,

I had a try here, but I have no problems when editing the modeldef.xml in the editor within MCX. This is what I did:

  1. Load a model
  2. Bring up the modeldef.xml editor
  3. Change some definition content
  4. Save the model to MDL (it contains the modified definition now)
  5. Save the modeldef.xml to disk
  6. Import the model just exported, all definitions and names are OK
I found one confusing thing though, that the "Show only used" checkbox did also affect saving. So if you saved, while only the used definitions were shown, only those definitions were saved. I have improved that now by adding a separate checkbox to indicate which definitions should be saved.

Would this workflow suit you as well? Or do I still miss a point?
 

tgibson

Resource contributor
Messages
11,338
Country
us-california
Hi Arno,

I understand, it would have been nice but I'm used to the workaround now. Thanks for the new checkbox.

It turns out I think my initial findings are related to your comments above, where MCX was only saving a modeldef file with the definitions used in the plane. It had nothing to do with custom_anim, etc.

I don't have the unreleased development version with the new checkbox yet, but with the last version before that, this can generate the truncated list.

1. Load an FSX model into MCX.
2. Click the Show Modeldef button to open the Modeldef Editor.
3. Click the Edit Mode button and make a small change to one definition (I changed 1== to 0 ==). Click on the Edit Mode button again. Close the Modeldef Editor.
4. Open the Hierarchy Editor and choose a node/part with an animation section.
5. Click on the animation name to get the drop down box.

The drop down box now contains only the definitions found in the model, not all of the ones from the SDK modeldef file.

Hope this helps,
 
Last edited:
Messages
176
Country
unitedkingdom
What do you mean with copy and paste definitions into the modeldef editor? Since I added the edit mode you should be able to copy paste things in there.

I've just installed yesterdays MCX
Run as admin
Import a MDL
Edit mode in the modeldef editor
I can right click and paste into the search box, but not into the main body of the modeldef. No right click options at all.
(windows 10-64)
 

tgibson

Resource contributor
Messages
11,338
Country
us-california
I can confirm that you cannot copy and paste that way since no right click options appear. You can copy and paste if you use Ctrl-C to copy and then Ctrl-V to paste, as long as it creates valid XML code. If you make a random copy/paste I get an MCX crash. "The 'Code' start tag on line 29 position 10 does not match the end tag of 'Parameter'. Line 29, position 18."

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Xml.XmlException: The 'Code' start tag on line 29 position 10 does not match the end tag of 'Parameter'. Line 29, position 17.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag)
at System.Xml.XmlTextReaderImpl.ParseEndElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.LoadXml(String xml)
at ASToFra.FSUtils.ModelDef..ctor(String content)
at ASToFra.ModelConverterX.ModelDefEditor.XmlEditorDocumentChanged(Object sender, DocumentEventArgs e)
at DigitalRune.Windows.TextEditor.TextEditorControl.OnDocumentChanged(DocumentEventArgs documentEventArgs)
at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
at DigitalRune.Windows.TextEditor.Document.DefaultDocument.OnDocumentChanged(DocumentEventArgs e)
at DigitalRune.Windows.TextEditor.TextArea.InsertString(String str)
at DigitalRune.Windows.TextEditor.TextAreaClipboardHandler.Paste()
at DigitalRune.Windows.TextEditor.TextArea.ProcessDialogKey(Keys keyData)
at System.Windows.Forms.Control.PreProcessMessage(Message& msg)
at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)
at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)

To be accurate I get a ModelDef Editor crash - I can click Continue, close the editor, restart it, and all seems fine.

Hope this helps,
 

tgibson

Resource contributor
Messages
11,338
Country
us-california
The process I list above (making an edit to the MCX modeldef file) also eliminates any effect when in the Modeldef Editor you uncheck the Only Show Used box. Apparently once you make an edit to the MCX modeldef file the SDK modeldef.xml file is ignored after that throughout MCX.

I assume this has to do with your statement that combining the MCX and SDK modeldef files is beyond its capabilities at this time.

Hope this helps,
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,883
Country
netherlands
I'll check if I can add support for right-click copy/paste as well. I never use the mouse for that myself, but always the keyboard shortcuts. That's probably why I didn't notice.

Let me check if I can do something about the crash when pasting incorrect XML content.
 

tgibson

Resource contributor
Messages
11,338
Country
us-california
Perhaps when you click the Edit Mode button in the Modeldef Editor a warning box could appear to say something like: "If this file is edited, definitions from the SDK modeldef file will no longer be displayed during this aircraft edit session. Export the Object after the modeldef edit and then Import it again to get back all definitions."
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,883
Country
netherlands
I don't like such warnings :). I guess this is related to the show used checkbox as well. Better solve that problem.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,883
Country
netherlands
No problem. The best workaround for now is to uncheck show only used when you start to edit. That will prevent the issue.
 
Top