Is it passable to add colour to Enum

Hi is it posable to add colouring to enum when selected or can it be added in the next version. I like have the colours as use box2d and decided to set my body types the the green pink and purple so I know what type of physics it is when editing.

else ill have to make them a class again many thanks.

The “color” property of Classes is displayed when Objects have that class, and isn’t really relevant outside of that (unless you choose to treat it as essentially a custom property in your game). Since it’s not possible for Enums to serve as Object classes, it doesn’t make a lot of sense to tie a colour property to them in Tiled, as there’s nowhere for it to be displayed.

If you’re looking to colourise objects to see their BodyType in Tiled, you’d have to use classes, not Enums. Even if Enums did have colours, since Enums can only be used as custom properties and not Objects’ classes, they would still never colour Objects in Tiled, they’d at best maybe colour their one property line in the Properties View.

That said, if displaying a colour associated with an Enum’s current value in the Properties Panel is possible, I’d like that feature :D

Thanks for reply, yes it would be awesome feature to have. but it shows what type it is when I click on object anyway, I cant have everything

The problem with choosing object color based on enum value is also that an object can have multiple enums used in its custom properties. It means to determine object color, it has to search through all those custom properties and do arbitrary logic like first enum wins and then this would have to take precedence over the other ways to color objects (through object class or through object layer color).

So, if you don’t want to modify Tiled yourself, an alternative to using classes can be to use different object layers for the different body types, since you can also color objects by the color property of object layers.

Long term, I’d like to enable customizable object rendering through the scripting API. It might be a good idea to also allow the script to override the object color this way. See Enable scripting the appearance of objects · Issue #2134 · mapeditor/tiled · GitHub.

1 Like