You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One of the problems I've personally run into with the property editor (and object types, by extension) is that the available types for each property (string, int, float, bool, etc) don't always cover all the different types of things I'd like to store into properties. There are plenty of existing issues about adding more types (arrays, object references, etc) but inevitably there will always be one more type to represent in properties (for example: vector or matrix values)
In my projects I tend to have a very generic tiled-to-custom-map-format parser that doesn't know exactly what type each property is supposed to be, so I end up writing a parser for the "string" type that supports putting vectors or other types into string properties (so something like (0, 1) would parse out to a vector). The problem with this is that I also have to support normal string properties, so that involves also writing out a way to escape parenthesis (for example) just in case I need to start an actual string with a (.
I'm proposing adding support for "custom" types that map to any existing type of property but have a different type name. In my mind this would work by having the type attribute on properties be set to the usual string/int/float/etc that Tiled supports and have an additional attribute named customType set to whatever the user specified. This would massively simplify writing custom property types without having to wait for their support in Tiled itself.
Tiled would need to support specifying the customType value somehow (+ support in the object types editor), but this would allow external parsers to be given a hint as to how to parse properties that don't fit into Tiled's normal types.
The text was updated successfully, but these errors were encountered:
Yeah, I totally agree this can be useful as well, in addition to supporting custom compound types (#489), arrays (#1493) and enums (#1211). All these things (apart from arrays, possibly) have in common that we need a place where new property types can be defined. It would be nice if we can add this as part of the support for projects (#1665), which is planned to be the main feature for Tiled 1.4.
Due to the addition of a number of other features and the changes having taken longer than estimated, I'm going to take this out of the roadmap for 1.4. I'd prefer to release Tiled 1.4 soon and will aim to have this in Tiled 1.5 instead.
Edit: As part of the addition of projects, the "object types file" reference moved from the global preferences to a project-specific option at least (change 532e943).
I've just merged some major work towards this feature as part of #3215, which for now only adds support for custom classes (extending the support for custom enums added in #2941), but can be extended to also support defining custom types based on existing types.
One of the problems I've personally run into with the property editor (and object types, by extension) is that the available types for each property (string, int, float, bool, etc) don't always cover all the different types of things I'd like to store into properties. There are plenty of existing issues about adding more types (arrays, object references, etc) but inevitably there will always be one more type to represent in properties (for example: vector or matrix values)
In my projects I tend to have a very generic tiled-to-custom-map-format parser that doesn't know exactly what type each property is supposed to be, so I end up writing a parser for the "string" type that supports putting vectors or other types into string properties (so something like
(0, 1)
would parse out to a vector). The problem with this is that I also have to support normal string properties, so that involves also writing out a way to escape parenthesis (for example) just in case I need to start an actual string with a(
.I'm proposing adding support for "custom" types that map to any existing type of property but have a different type name. In my mind this would work by having the
type
attribute on properties be set to the usual string/int/float/etc that Tiled supports and have an additional attribute namedcustomType
set to whatever the user specified. This would massively simplify writing custom property types without having to wait for their support in Tiled itself.Here's an example of how that might look in XML:
Tiled would need to support specifying the
customType
value somehow (+ support in the object types editor), but this would allow external parsers to be given a hint as to how to parse properties that don't fit into Tiled's normal types.The text was updated successfully, but these errors were encountered: