CLI has no access to project information like custom types. #3797
howprice posted onGitHub
Describe the bug
Due to lack of project information "Resolve object types and properties" export behaviour differs between GUI and command line. When a map is exported from the commmand line with the --resolve-types-and-properties
option, default class property values - from the .tiled-project file - are not available, so are not written into the .tmx file. The properties are present when exported from the GUI with the equivalent option.
This limits the usefulness of the CLI for asset build scripts.
To Reproduce
Please see attached zip for simple repro
Steps to reproduce the behavior:
Create a project with a custom class and object using default properties:
- Open Tiled
- New Project
- Open the Custom Types Editor. Add Class "Enemy".
- Add string Member "Name" Value "DefaultEnemyName"
- Close Custom Types Editor
- New Map (use defaults)
- New Object Layer
- Insert Rectangle. Name: "Enemy1" Class: "Enemy". Important: Do not modify the Name property - leave as default.
- Save Map as map.tmx
Export from the Tiled GUI:
- Edit > Preferences... > General > Export Options > Check only "Resolve object types and properties"
- File > Export As... Save as type: Tiled map files File name: map_export_gui.tmx
Export from the Windows command line:
- Open Windows command line
- CD to project directory
- "C:\Program Files\Tiled\tiled.exe" --export-map tmx --resolve-types-and-properties map.tmx map_export_cmd.tmx
Compare/diff map_export_gui.tmx vs map_export_cmd.tmx
Expected behavior I would expect map_export_gui.tmx to be identical to map_export_cmd.tmx
In the above (and attached) repro case, the GUI-exported file contains the default resolved properties:
<object id="1" name="Enemy1" type="Enemy" x="160" y="64">
<properties>
<property name="Name" value="DefaultEnemyName"/>
</properties>
</object>
Whereas the command line exported file contains the object, but with no properties:
<object id="1" name="Enemy1" type="Enemy" x="160" y="64"/>
Media Please see attached zip for repro
Specifications:
- OS: Windows 10
- Tiled Version: 1.10.1