Results 1 to 1 of 1

Thread: ModelDB Formatter Patch v056 (3rd party patch for KnightErrants ModelDB Formatter )

  1. #1
    Hexdragon's Avatar Libertus
    Join Date
    Nov 2005
    Location
    South America / Peru / Lima City
    Posts
    81

    Default ModelDB Formatter Patch v056 (3rd party patch for KnightErrants ModelDB Formatter )

    **** ModelDB_Formatter_3rdParty_Patch v0.56 ****
    ========================================

    Download link:
    https://www.twcenter.net/forums/down...o=file&id=4622

    1.-Description:
    ============
    This tool is a third party patch wrapped around KnightErrant's ModelDB Formatter and ModelDB Syntax Checker.

    The patch adds:
    -A graphic user interface
    -A pre-processing stage for formatted modeldb files that require a "cleanse" in order to run syntax checker without making it to crash
    -Two formatter-level options with additional line breaks
    -A loadable custom faction list for the syntax checker

    For brand new ModelDB files, this patched version provides just a slightly extended set of line breaks.
    On the other hand, this version of tool can be used as a re-formatter for already formatted ModelDB files that require a good mopping.

    Just as the previous version of the patch, the current one offers support for ModelDB files whose data lines contain uncommon characters
    like "&" and "-".


    2.-Downloadable Zip Content:
    =======================
    -ModelDB_Formatter_3rdParty_Patch _v056.py >>> This is the module you will execute. It contains both the formatter tool and the GUI.
    -ModelDB_Syntax_Check_3rdParty_Patch_v056.py >>> Syntax checker, adapted to the patched formatter. No longer standalone. Use GUI to launch it.
    -faction_list.txt >>> Here is where you can include your "progressive_elves" custom faction name to be considered by the syntax checker.
    -Readme.txt >>> Read the Readme, always.

    Four .png files with brief descrption and examples of Model DB format also included in the zip file.


    3.- Requirements:
    ================
    -Python 2.7
    This tool has been coded and tested with Python 2.7.18.
    I believe it may work with ealier versions like python 2.6.8 (as previous version did) but cannot confirm at the moment.

    -Notepad++
    Or anything else that allows you to edit xml files.


    4.- Basic Use:
    ============
    4.1- Launch the GUI (ModelDB_Formatter_3rdParty_Patch _v056.py) by either :
    a) Double click, or
    b) Right click + "Edit with IDLE" + "Run" (Idle's menu option) + "Run Module"

    4.2- Select your ModelDB file with:
    a) "Select" button. or
    b) Menu Option: File + Select File

    4.3- Press "Execute" button to start Format / Reformat work
    At first, a report about the number of line breaks found in your file will appear on GUI
    Check the report and press "Execute" button again.

    4.4- With default values in parameters, your new ModelDB file will be written with suffix "F0" "F1" or "F2" depending on the chosen format-level option (see section 5 for details)


    5.-Custom Execution:
    ================
    5.1- Format Levels:
    Level 0: This option removes format from file. No line breaks will remain in output ModelDB file after executing this format level option
    Level 1: This option adds all meaningful line breaks to ModelDB File. Yet, it will omit some line breaks in the first mount entry, which is an irregular entry.
    Level 2: This option adds all meaningful line breaks to ModelDB File, including line breaks for the first (irregular) mount entry that were omitted in level one.

    5.2- Syntax Check:
    -In order to run ModelDB Syntax Checker instead of ModelDB formatter, select the the option "Syntax Check" at the end of the format levels panel.
    Then proceed as indicated in section 4.2 and 4.3.
    -If the file faction_list.txt is not present in folder, syntax checker will only consider M2TW vanilla and kingdoms factions (may trigger false positives for faction count errors as a result)

    Important: Syntax checker is compatible with format level 1 (F1) only.
    Use format level 2 (F2) ) only if you do not plan to run syntax checker on you formatted file

    5.3- Execution Sequence:
    By default, any format level triggers a cumulative sequence of task to be caried on your source ModelDB file
    a) At first, a 10-stage pre-process aimed to remove spurious blank spaces, and duplicated line breaks, as well as to add missing blank spaces, will be run.
    In addition this pre-process will convert unix / lynux style line breaks into windows style line breaks and replace backslash with forward slash characters.
    A custom fix that replaces a "3" plus double space with "0" plus double space has been included.
    b) After pre-process, cames format removal. If user selected format-level 0, the whole process ends here.
    c) After format removal, cames the (re)format process either format-level 1 or format-level 2.

    5.4- Custom Level Zero:
    -By means of parameter named "level_zero" user can partially change the task sequence described in section 5.3
    level_zero = "F" (Full), will execute both file pre-process and format removal.
    level_zero = "D" (Dull), will execute format removal only.
    level_zero = "C" (Cull), will execute file pre-process.
    level_zero = "N" (Null), will omit execution of both file pre-process and format removal.

    -Default value for "level_zero" is "F". This value will be restored any time you select a format-level option either 0, 1 or 2.
    Thus, in order to use other options for this parameter select your format level first; then change "level_zero" and execute.
    Your new ModelDB file will be written with suffix that reference your choice, such as "D0" or "N1"

    -If you are going to format a brand new M2TW vanilla or kingdoms ModelDB file, level_zero = "N" will save you a couple of minutes with a quicker execution.
    On the other hand, if you are handling a war thorn ModelDB file, made for a mod created by a team of russian modders who love to work in linux, it will be better
    to run the format routine with default settings.

    -The option level_zero = "C" can be usefull if user wants to try a double pass of file pre-process task in the source file by running tool with format-level = 0 and
    level_zero = "C", and later running with default options using the output file of the previous step as source file.


    6.-GUI Options:
    ============
    6.1- You can switch GUI font style by either:
    a) Pressing "F" key
    b) Menu Option: Appearance + Switch Font
    6.2- You can switch GUI color by either:
    a) Pressing "C" key
    b) Menu Option: Appearance + Switch Color


    7.- Notes on testing:
    ================
    -This 3rd party patch was born 6 years ago, around the attempt to run KE's syntax checker on ModelDB file for Call of WarHammer Rise of Dark Gods 1.5
    Original discussion here: https://www.twcenter.net/forums/show...1#post14562527
    -Previous version of the patch did the job with the mentioned file. However, when tested with later versions problems arose, hence the update.
    -Current version has been tested with several versions of warhammer related mods and submods such as:
    Cow 1.4, Cow 1.5, Cow 1.6, Cow-RoDG 1.5, Cow-RoDG 1.6, Cow-BOTET 1.5, Cow-BOTET 2.0, Cow-BOTET AC and The Sundering 0.69

    -For tested files format was susceful enought to allow a run of the patched syntax checker included in the tool (files formatted with Level 1 option)
    Upon syntax check run, files in set reported a number of legit string count errors (between 8 and 25)
    -No faction count was reported provided that any custom faction name (skaven etc) was included in faction_list.txt
    Only ModelDB file for The_Sundering reported false positives (12 in total). All related to weird entries that replace mount type "4 none " with "1 0 "

    -All files allowed game load without crash to desktop
    -All files were tested in custom battles (2 or 3 per file)
    -Aside from ocassional crash to desktop in the middle of the battle with CoW 1.6 and RoDG 1.6 ( and a couple of crashes while loading the battle with the same mods),
    test did run smoothly (and same crashes happened with original source files).

    -Test was also carried on M2TW Vanilla and Kingdoms ModelDB files. No issues, aside from the widely known syntax checker conflict with "Americas" ModelDB file caused by the double
    "zero factions" count (and the subsequent lack of textures section) in the unit entries for "saxon_general" and "saxon_king".


    8.- Known Limitations:
    ================
    -While detection of missing double spaces and spurious ones seems to be quite effective, it relies heavily on previous detection of missing single spaces,
    which at the time, relies on the absence of spurious line breaks (because it adds a blank space at the end of every line which ends without one).
    The later is partially warranted by deletion of duplicated line breaks (empty lines). However, if the source file's owner inserts line breaks in the middle of a
    data line, like mesh filepath or texture filepath, its game over for the tool process.


    -If faction count for first mount entry (the irregular one) is 10, 20, 30 or any other multiple of 10, format-level 2 will not apply line breaks.around that faction count.
    Regular entries are not affected by the above.


    9.- Notes copied from the original KE's readme file:
    =======================================
    -If your game loads and shows the logo screen then the modeldb file has been successfully loaded.
    -If your game subsequently crashes after the logo screen then some mod you have made is not
    finding its entries in the vanilla modeldb file. You must comment out references to any new
    unit you may have made in the EDU, EDB, and descr_strat.txt files.


    10.- Terms of Use:
    ============
    This 3rd party patch is distributed without warranty. Make use of it at your own risk.
    I am not responsible for any consequence derived from the use of this patched version of the tool, nor the author of the original version.


    ----


    Have fun
    Hexdragon (George586)
    Last edited by Hexdragon; May 15, 2021 at 05:53 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •