tiled
tiled copied to clipboard
RepeatX, RepeatY and Custom Classes Member properties do not export to Lua file
Issue 1
The new RepeatX and RepeatY properties for image layers do not export to Lua files. The value is always set to "false" even when they are set to true in Tiled.
Steps
- Create a new map.
- Add an Image Layer to the map layers.
- Check either of the Repeat X or Repeat Y check boxes in the image layer properties list.
- Save and export the map as a Lua file.
Issue 2
The members for new Custom Class properties do not export to Lua files. The property value is exported as an empty Lua table.
Steps
- Select View > Property Types Editor.
- Click "Add Class".
- Click "Add Member", give the member a name and a default value.
- For any layer or map, click the + for Custom Properties.
- Add a new property type for the new class.
- Save and export the map as a Lua file.
Example
When exported to a Lua file, these properties will look as follows:
...
repeatx = false,
repeaty = false,
properties = {
["myprop"] = {}
}
Issue 1 is a duplicate of #3307, as the underlying problem was that Tiled wasn't copying these properties into the copy of the map that gets passed to the various exporters. It'll be fixed in 1.8.3.
I also had a look at Issue 2 in one of the nightly builds, and that looks fixed too:
properties = {
["myprop"] = {
["int prop"] = 3
}
},
Looks like this one was fixed in 1.8.2.
Issue 1 is a duplicate of #3307
That is correct.
I also had a look at Issue 2 in one of the nightly builds, and that looks fixed too:
No, actually the issue is here, that @dennisfortin didn't set any of the members of that class, and the default values are not written out.
For those that actually need the full classes written out, the plan was to make an export option for this, or to make it part of the "Resolve types and properties" export option. If there's nothing against the latter I can look into doing that as part of Tiled 1.8.3.
No, actually the issue is here, that @dennisfortin didn't set any of the members of that class, and the default values are not written out.
Ah, good catch. In the screenshot, since the properties were black, I thought they were manually set. Do classes members not have a visual distinction between set and unset/default values?
Do classes members not have a visual distinction between set and unset/default values?
They do, but it's not graying out, instead the set members have their name displayed in bold.
They do, but it's not graying out, instead the set members have their name displayed in bold.
Ah. I think that's too subtle, I didn't notice it ): Bold tends to be harder to notice in dark themes. Is there a reason it's done differently for class members? It's not possible for a class member to be unset in both ways at once or to be set in one way but not in another, so I don't think the two different visualisations are necessary. Edit: Well, I guess it's possible for a member to have its value set to something other than the class default as part of an Object Type, so there is that. Bah.
Hello, seems that in the latest version of Tiled (1.10.2) the above issue is still there. When you export your map to a lua file it does not export Class properties.
Are you using the "resolve object types and properties" export setting?
If your class is used as a custom property type, rather than as a class directly on some entity (Object, Tile, Layer, etc), those properties are currently not resolved even if that export setting is used, and this applies to all export types, not just Lua (see #3411).
Edit: Just noticed this issue is still open. This means it has not been addressed yet. So, no wonder that it's still happening.
This property gets exported just fine in Tiled 1.9.2
I turned on:
And the issue still persists.
@Immow Could it be that you're running in to the fact that, for compatibility reasons, class
was renamed back to type
for objects? In that case, in your project (creating one if you haven't done so), you should set the "Compatibility version" to 1.9 to get the object's class written out as "class". Or... read in the object's class from the type
property, of course.
I made the unfortunate mistake of renaming this property in Tiled 1.9, and it kept tripping people up for months. That's why I renamed it back in Tiled 1.10.