MDLCommander v1.03

This program is an interface between the gmax export plugin FSModelExp.dle and MakeMDL.exe. It's purpose is to save and allow modification of makemdl parameters for any model created and exported with gmax as well as intercepting the exported x-files to make exports easier in final stages of developement and to be able to offer models in a way i do for my MoriartyDock Hangar model. It is a batch program, that is it doesn't popup with a dialog.

Content

Version Info
Legal & Licence
Installation
Function
Parameterfile for MDLCommander
Logfile
Parameters for MDLCommander
Parameters for MakeMDL
Tutorial
Advantage of Having x-files
Missing Parameters
Gimme Feedback
Known and Potential Problems

Version Info

Version 1.03 - 07/02/2002

Version 1.02

Legal & Licence

This is freeware and provided as is. I guarantee for absolutely nothing. Use as is at own risk. It may not be used for commercial purposes. It may not be republished to any site or in any package without prior written permission by Doc Moriarty. Exclusive Copyright Doc Moriarty 2002 - all rights reserved.

Installation

Without using Middleman by Chris File :

Use windows explorer and navigate to your gmax plugins folder. Rename the original makemdl.exe to mkmdl.exe. Then copy MDLCommander.exe to the plugins folder and rename it to makemdl.exe, so that mdlcommander gets called instead of the original makemdl.

Export pipeline will be: gmax -> fsmodelexp -> mdlcommander -> makemdl

With using Middleman by Chris File :

Use windows explorer and navigate to your gmax plugins folder. Leave Middleman there as 'makemdl.exe'. Rename 'makem.exe' which is the original Microsoft makemdl.exe to mkmdl.exe. Copy mdlcommander.exe there and name mdlcommander.exe to makem.exe. So mdlcommander will now sit between middleman and original makemdl. (Note: didn't test it prior to writing this but this should work well). When using middlemen then i recommend setting options via middleman, not via the .par - files for mdlcommander (see below) except for options unique to mdlcommander.

Export pipeline will be: gmax -> fsmodelexp -> middleman -> mdlcommander -> makemdl

Function

It's called instead of original makemdl and intercepts the parameters for makemdl.exe. It looks for a file in the same directory as your exported .mdl or .bgl file named yourexportfile.par. ("yourexportfile" = name of your exported .mdl or .bgl file). In this file which can be edited by any texteditor like NOTEPAD, you can place any parameter you want for makemdl.exe. These parameters are appended to the parameters provided by FSModelExp and then makemdl is called.
That way you can always save and use the same modelspecific parameters for a certain model. They will automatically be used for every export of this model once placed in the .par file.

NOTE: usually makemdl is called with the -b (batch) parameter. The disadvantage when exporting an aircraft is, that you can't alter the makemdl options. So mdlcommander removes this parameter which causes makemdl to pop up. If you want it back in, put it in the yourexportfile.par file. Then exporting will be as seemless as it was before but still with extra parameters read from the .par file.

Parameterfile

You can write a parameterfile for every exported model. It's name is always the name of the exported model and the extension .par and it's expected in the same directory where the exported model resides. Lines beginning with ';' or '#' are treated as comment lines. Empty lines are ignored. Additional parameters for makemdl can be written in one or more lines. If you use one line per parameter, it's easy to comment or uncomment single parameters for tests if necessary. I usually comment the parameterfiles since i tend to forget the meaning of parameters over time :), even if i write the programs myself.
The parameterfile may contain makemdl parameters as well as mdlcommander parameters.
If you prefer using a dialog for that parameter stuff, i urgently recommend using Middleman as mentioned above in the installation section. MDLCommander doesn't rely on having a parameter file, this is optional to make life easier and Middleman now offers access to MDLCommander parameters too.

NOTE: Don't use filenames with blanks !!!

Example Parameterfile:

# these are parameters for exporting my aircraft
# -b shut up (batch)
# -keep keeps all intermediate files .asm and such
# -i ignore warnings
# -i8- do not ignore bad triggers (might be important for stock anims)
# -in- do not ignore bad normals
# -viewlog view logs in case of error (only if -b deactivated)
-b
-i
-in-
-i8-
-keep
-viewlog
+savexfile

I usually switch off all the ignore-flags except warnings (-i, -in- -i8) since the -b option switches everything to ignore which causes makemdl to run through smoothly and you will never know that you might have a bug in your object names (expecting them to animate but used wrong misspelled name etc.).

Example using +autointerior (see below for description of own parameters):

# these are parameters for exporting my aircraft with automatically
# creating the interior model file for MakeMDL
# -b shut up (batch)
# -keep keeps all intermediate files .asm and such
# -i ignore warnings
# -i8- do not ignore bad triggers (might be important for stock anims)
# -in- do not ignore bad normals
# -viewlog view logs in case of error (only if -b deactivated)

-b
-i
-in-
-i8-
-keep
-viewlog
+savexfile
+autointerior

Logfile mdlcommander.log

MDLcommander writes a logfile to the current work directory everytime it is called. The current work directory usually is the directory to which the model is exported. It contains information about original and modified parameters for makemdl as well as the returncode. It's overwritten everytime you export a model to that directory. You can use it for problem detection. If you have problems with MDLCommander, then send me at least this logfile so that i can determine what might have gone wrong.

Parameters for MDLCommander

MDLCommander knows a couple own parameters. In contrary to MakeMDL - Parameters they use the switch character '+' instead of '-' for easier recognition.
Parameter
Info
+savexfile
The modelfile is intercepted and saved as modelname.x in the output directory - There you got your .x-file ! I recommend use this option always for a couple reasons:
I can pass then mymodel.x to makemdl which will drive it into automatically adding any .x - LOD or _interior.x files to the LOD tab. Also you have something to look into if stuff doesn't get exported as you want it, perhaps gives you an idea whats wrong.
+autointerior
The modelfile is intercepted and saved as modelname_interior.x in the output directory. Don't use with -b switch since MDLCommander can't pass the interior file name as parameter to MakeMDL. Instead when MakeMDL pops up you have to go to the LOD - tab and add the ..._interior.x file there to the LOD-names with the add button.
Autointerior just makes it easier to model, since you can use one model as exterior AND interior model without having to manually copy any files before continuing with MakeMDL. Thats done by MDLCommander.
Note: don't set this for scenery objects - nothing bad will happen, just doesn't make much sense !
Also: If the exported models name ends with ..._interior then this flag is ignored since mdlcommander assumes this already IS the interior model.
+batch
This flag is meant for programs like middleman which might want to re-enable the batch mode of makemdl from the commandline, since mdlcommander removes the -b flag from commandline automatically to interrupt makemdl. If +batch is set, then mdlcommander passes a -b flag to makemdl and things run through smoothly. May also be placed in par files but doesn't really make sense, can use -b there as well.
+nocompile
Instead of calling makemdl at the end it just returns to gmax without compiling. This is the option you need in final stages of developement or if you just want to get the .x - file without compiling.

Parameters for MakeMDL

There are more parameters than outlined in the MakeMDL SDK documentation. Write parameters with leading minus ('-') signs and lowercase letters. The "Tested" column just says, that i have tested that, it doesn't mean that it doesn't work if you use it.
Parameter
Tested
Info
-out:output_file
yes
Define name of output file. Avoid blanks in filenames
Default same as input with .mdl or .bgl extension.
Usually not needed.
-latlon:<lla>
yes
Define latitude and longitude for scenery in the default notation, that is an asterisk after degrees followed by decimal - minutes.
Example -latlon:"N35*37.56 E5*33.47"
Note: write coordinates exactly as shown using the quotes around the coordinates and a blank before the 'E' or 'W'. The quotation marks are needed because of this blank.
-b / -batch
yes
Generate and exit. This switch also enables all ignore errors and ignore warning switches unless they are set as additional switches (see below). When set, you usually can't enter options in makemdl when exporting an aircraft.
-bgl
yes
Model is scenery
-mdl
yes
Model is aircraft
-cf
yes
Generate CFS2 aircraft
-fs8
yes
Generate FS8 (=FS 2002) aircraft, this is the default.
-crash-
yes
Disable generation of crash tree
-vis-
yes
Disable the parts_visible tests
-nightmap
yes
Assume a night texture exists (texture name ending with "_LM")
-reflectmap
yes
Assume a reflection map exists (texture name ending with "_T")
-lightmap
yes
Assume a light map exists (texture name ending with "_L")
-damagemap
yes
Assume a damage map exists (texture name ending with "_D")
-nightmap-
yes
Assume NO night texture exists
-reflectmap-
yes
Assume NO reflect map exists
-damagemap-
yes
Assume NO damage map exists
-lightmap-
yes
Assume NO light map exists


INOFFICIAL PARAMETERS
-z
no
Negate Z
-r
no
No left to right
-swap
no
Swap bank and heading
-debug
yes
Debug mode: Adds some more of the hidden options to the option tab of makemdl.
-viewlog
yes
view logfiles on error but not if -b (-batch)
-viewbgl
yes
view generated .asm file on successful generation, but actually just shows the header bgl file containing the crash tree, not the "flesh".
-view
yes
view model ? no change, perhaps you need a special viewer
-keep
yes
keep intermediate  files (.azm etc.)
-keeperrorlog
yes
keep error log (wouldn't have guessed that !)
-il
no
ignore libraries
-i8
-i8-
yes ignore bad animaton triggers
do not ignore bad animation triggers
-in
-in-
yes
ignore bad normals
do not ignore bad normals
-i
-i-
yes
ignore warnings
do not ignore warnings
-texpage
no
Texture page hack ?
-softmat
no
Soft image material
-fullmat
no
use full material (default)
-deffallback
no
Use default fallback color
-specularcanopy
no
Specular canopy hack ??
-weld / -w
-weld- / -w-
yes

Weld points
Do not weld points
-dll
no
Writes mdl using an old style within a dll, cfs2 option does this automatically.
-optimize
no
Optimize (Default)
-flat
no
Flatten - make one object from whole mesh, eliminates all animations too
-noanimate
no
No animations
-vistest
no
If visible parts thest then do clip test as well

Tutorial: How to Set Up a Project for Efficient Work with MDLCommander

Pretend you are working on a model named 'MyModel.gmax'. It should be in a folder within your FS 2002 installation like: ....\FS2002\aircraft\model\MyModel.gmax. Assume you just created the model. So until the model isn't anywhere near finished you just need this ONE model to make outside AND inside (VC).
  1. Open NOTEPAD and create in this folder a file named MyModel.par. This step has only to be done for initial parameter setup.
  2. Copy and paste the content of one of the above example parameterfiles in this file and add / modify the parameters as needed using the tables of parameters above.
  3. Set +savexfile and +autointerior parameters, so you always get the original x-file and the copy of it to MyModel_interior.x. NOTE: You don't need +autointerior for scenery objects ! If you need to change parameters at a later stage, just open the file again and change whatever you need.
  4. Export your model from within gmax. No need to copy and make groups from your model at this stage. MDLCommander will always save the x-files. When MakeMDL pops up, go to the LOD Tab, press the ADD-Button, add the MyModel_interior.x file to the LOD files (if its an aircraft).
  5. Press Start button in MakeMDL to compile the model.
At a later stage, when modelling is completely finished, you might want to optimize your aircraft model. Now in gmax save your full model to a new file named MyModel_interior.gmax and MyModel_shadow.gmax. Optimize them as needed, for example remove outer fuselage from the interior (VC) model. Remove lots of details and interior from shadow model, perhaps even rebuild some high poly outside stuff with fewer polys for the shadow model.
  1. Remove the +autointerior switch from the MyModel.par file. Now you got an extra model for that, so auto-copy isn't necessary anymore. Make sure you have the +savexfile option in the MyModel.par file. You now need a par file for all models, for example MyModel.par, MyModel_interior.par and MyModel_shadow.par.
  2. To export interior and shadow model, open one of these models in gmax and export. When MakeMDL pops up, just press exit button or use the +nocompile option in the parameter files or from within Middleman.
  3. Open your regular (outside) model in gmax, export it OR just open MakeMDL and open there a current version of the regular MyModel.x - file. When MakeMDL pops up, go to LOD Tab and add the files MyModel_interior.x and MyModel_shadow.x there. Press the Start button and now you get an optimized model for outside, inside and the shadows and you still didn't have to fiddle around with copying, renaming objects, moving center points and all that crap.

Advantage of Having x-files

You should ask that Fox and Scully.

Actually you can use them to:

Missing Parameters

I'm still missing a way to set orientation and distance for scenery objects as parameters.  If someone knows something i wouldn't mind getting a mail to Doc Moriarty.

Gimme Feedback

Direct inquiries, useful information, suggestions to Doc Moriarty . Don't expect fast answers :)

Known and Potential Problems

I used it now for like 200+ exports of my scenery and aircraft objects. There currently is no known problem.

BUT: