Skip to content

CLI has no access to project information like custom types. #3797

@howprice

Description

@howprice

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

property-export-bug.zip

Steps to reproduce the behavior:

Create a project with a custom class and object using default properties:

  1. Open Tiled
  2. New Project
  3. Open the Custom Types Editor. Add Class "Enemy".
  4. Add string Member "Name" Value "DefaultEnemyName"
  5. Close Custom Types Editor
  6. New Map (use defaults)
  7. New Object Layer
  8. Insert Rectangle. Name: "Enemy1" Class: "Enemy". Important: Do not modify the Name property - leave as default.
  9. Save Map as map.tmx

Export from the Tiled GUI:

  1. Edit > Preferences... > General > Export Options > Check only "Resolve object types and properties"
  2. File > Export As... Save as type: Tiled map files File name: map_export_gui.tmx

Export from the Windows command line:

  1. Open Windows command line
  2. CD to project directory
  3. "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

property-export-bug.zip

Specifications:

  • OS: Windows 10
  • Tiled Version: 1.10.1

Metadata

Metadata

Assignees

Labels

bugBroken behavior.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions