The python2 trackplacer included both the handling of the file format, and the
GUI application. This trackplacer3 is a library for the file format, without
the GUI.
The new tmx_trackplacer is a command-line tool for exporting the data to
Tiled's .tmx format, and re-importing it back to .cfg files, so that the GUI of
Tiled can be used to avoid reimplementing the GUI of Trackplacer in Python 3.
The implementation uses Tiled's Object Layers (not Tile Layers). This allows
additional journey markers to be added with the "Insert Tile" tool, and
additional journeys to be added as new layers.
It can also read in a .cfg and then re-export it to a new .cfg file, to see if
the data is preserved. The format is chosen by the output filename.
The old trackplacer2 isn't removed in this commit - before removing it, I think
trackplacer3 needs some way to preview the animation.
----- Comments on the mainline campaigns: -----
AToTB, DM, LoW, NR and THoT will work with this. But:
Northern Rebirth's bigmap.cfg has a track RECOVERY whose STAGE1 starts with
an OLD_REST - that isn't handled by trackplacer, it must have been hand-edited.
That OLD_REST will be lost when read by either trackplacer2 or trackplacer3,
similarly the OLD_BATTLE of LoW's SAURIANS track will be lost.
Delfador's Memoirs SEARCH_STAGE1 is omitted from all subsequent parts of
SEARCH. Also in DM, SEARCH_STAGE3 has a point which is then moved in STAGE4
onwards - I guess a hand edit. Both of this will be overwritten if the file
is edited with either this tool or with the python2 trackplacer.
SotA's journey_chapter*.cfg files and WoV's bigmap.cfg file have some of the
trackplacer comments removed, they won't be handled by this tool, at least not
until better error handling is added.
This fixes situation when wmllint tried to add description=_"fireball"
to the following WML code:
[filter]
[filter_wml]
[not]
[attack]
name=fireball
[/attack]
[/not]
[/filter_wml]
[/filter]
Tags within [filter_wml] don't need to have all mandatory arguments
(like "description"), because:
1) they are temporary constructs and this description is never used,
2) such WML code expects that results will be filtered ONLY by name.
Adding description will remove results that have the same attack name
but different description.
The first bug happened when there were two or more square braces in a file name: only one expansion was performed, instead of all of them being applied at once.
The second bug happened when a square brace range had leading zeros: these were just removed, resulting in false positives.
The main reason for moving this to a separate function was to make the
per-event variables local to that function.
(cherry picked from commit 7e69da7f68b10bdf231ebb785b3c73109dc378a8)
This just moves the existing code, and adds a todo for handling in a later commit.
(cherry picked from commit a3cf683348168619a299c9907fce1d1b4ee9f245)
The problem is that when parsing #textdomain directives, the parser
expects the directive to be at the start of the line. So if the directive
is preceded by spaces or tabs then it is treated as an attribute.
The solution is to strip all spaces and tabs on the left side of the
parsed line string when checking for #textdomain directive.
Closes#3951
The problem is that if we have a "#define" directive followed with an
empty line ending with a newline character then the parser presumes the
value is the newline character instead of the actual value (which is
located on a subsequent line).
The solution is that when parsing an empty line, if "self.in_string" is
False and "self.temp_key_nodes" is not None then we ignore the line
instead of parsing it with the "parse_outside_strings" function.
Closes#3947
When parsing binary data in the wmlparser3 script, a temporary file is
created and opened. The problem is that the temporary file is never
closed and in subsequent functions it is reopened.
The solution is first, create a list of temporary file paths to delete at
program’s exit. In the atexit’s registered cleaning function, all the
files in this list are deleted.
Then in the function that creates the temporary file, we simply close
the file after the binary data has been written in it.
Closes#3927
In the wml parser, when a node creation spans multiple lines, the code
doesn’t take in account that one of those line can contain a
#textdomain directive.
In the method “parse_outside_strings” (line 501), the code that
processes the #textdomain directive is inside an if block that is true
only if the node creation doesn’t span across multiple lines
(self.temp_key_nodes is null).
The solution implemented is that in the method “parse_outside_strings”
(line 501), the code that check if a line starts with #textdomain is
moved from inside the block that is true only if the node creation
doesn’t span across multiple lines and put in the method scope after
the first if block that checks if the line is empty.
The wml parser, when parsing the outside of a string that is
translatable, only assumed “spaces” characters could precede it. If
there are “tabs” characters the code parses the “_” character as an
attribute value.
The solution is to add a stripping code for “tabs” characters.
Code style updated based on recommendations from ProditorMagnus.
In global_sanity_check(), variables "unit_id" and "base_unit" can be
used before assignment. This happens, for example, in this WML file:
https://github.com/Dugy/Legend_of_the_Invincibles/blob/master/utils/amla.cfg#L65
... where there is a [/unit_type] tag without the matching [unit_type].
(these variables are normally initialized when [unit_type] is found)