mapeditor / tiled

Flexible level editor
https://www.mapeditor.org/
Other
11.26k stars 1.76k forks source link

Ability to add dividers between custom properties #4029

Closed joereynolds closed 3 months ago

joereynolds commented 3 months ago

As my game grows and I rely more on more on Tiled, I find that navigating certain parts of the custom properties becomes a bit difficult as that list grows.

One possibly-simple feature to add would be dividers at a specified point in the custom properties list.

Consider this:

image

When we right-click on an item (as highlighted above), I'm proposing we add a "Add divider above selected item" or "Add divider below selected item" context menu item.

Ideally, in this dialogue, we are also able to name the divider. If a name is given, it is displayed in-line with the divider:

image

One further improvement (possibly post-release) is to allow the divider to collapse all items in the properties until the next divider. Basically, collapsing all children.

Doing so will add a small gray line (similar to <hr>s in HTML)

Thank you! :)

joereynolds commented 3 months ago

I started diving into this for a few hours in the early hours of this morning and am making ok progress.

However, I may have opened a can of works based around sorting.

I believe that before doing this, we'd want the option to "drag" each custom property to its desired position (if we don't like the default).

Currently as far as I'm aware, the sort order is based on "string" and is not customiseable in any way. This means that when we add my proposed separators above, they'll be in that position forever and any properties added after the fact will be sorted alphabetically and won't respect the separator.

Happy to hear some veterans thoughts on this. It's only a "small" feature but looks like it might require a fair amount of work underneath before it can be accommodated

dogboydog commented 3 months ago

I would recommend defining classes that can be used as properties. That way you can collapse a class property in the editor to hide all its nested properties.

https://doc.mapeditor.org/en/stable/manual/custom-properties/

joereynolds commented 3 months ago

Interesting, I'll check them out and close if they suit, cheers!

joereynolds commented 3 months ago

Damn, this is exactly what I want and more. Thanks!

The answer is always RTFM :D