Custom color for any object


#1

I have in my map an object layer called “playerstarts”. Each playerstart has a custom value called “team” which can be 1(red) or 2(blue). Every object is the same color however. It would be great for any with team 1 to be red in color, etc.

Currently I can make new layers to make things have different colors but it would really be great if each object could have its own color assigned to it. This would make managing my objects much easier.

Hope to see this in a future update :slight_smile:


(Thorbjørn Lindeijer) #2

Note that in addition to per-layer color, you can also set a color for each object type in the Preferences, maybe that helps?

In any case I don’t think adding a per-object color override is a bad idea.


#3

Thanks bjorn, that helps for now, my map looks better already :joy:

Per-object color override would be awesome since…
A) custom colors per object would be saved in each individual map.
B) Over time preferences>object types would eventually become a large unmanageable mess :scream:


(Thorbjørn Lindeijer) #4

Right, I didn’t save the colors in the map because that way you’d have to set up the colors manually all the time, whereas having them in the preferences you set it up only once and you can even change your mind about the colors easily later. There’s the option to export the color definitions to XML to share it with others.

My assumption here is that you will actually have only a limited amount of different object types of course. I think of types like “exit”, “spawn area”, “teleporter”, “npc”, “checkpoint”, etc. Even in your example you only mentioned two colors.

So while I don’t think individual colors would be a bad feature, I haven’t rushed to add it because I thought the other coloring mechanisms were more appropriate in most cases.


#5

I can see that changing each objects color might be a bit time consuming.

I mentioned 2 colors in my example but I have many different object types that will eventually be added to my maps.

Anyway, for now changing the settings in prefs will suffice :slightly_smiling:


#6

Hi again Bjorn :slight_smile:
So it would really be good if you could have object type colors saved in a map file. I find when I export (to lua) that object types are not exported. so I have to have separate tables with corresponding colors in my source code.

Also, when I give maps to other team members… if their Tiled is not configured exactly as mine… the object colors we have decided on are not present.

So I personally think it would be great to be able to save those somehow in the map and have them exported as well :slight_smile:


(Thorbjørn Lindeijer) #7

Nice to hear from you again after all this time. :wink:

The main thing that should help right now is to change the location of your objecttypes.xml file to be inside of your repository, so that all your team members can choose to use that one and you guys will stay in sync. You can do this via the “File” menu in the object types editor.

For exporting, I think there could be an option to embed these object types as discussed at issue https://github.com/bjorn/tiled/issues/1313.


(Thorbjørn Lindeijer) #8

Regarding this, in general, I think it should be solved by introducing a “project” file that covers all such relevant configuration. It would give a clear separation between settings that are user-specific and those that are project-specific like the object types.

I’d rather not solve the issue by moving all “project” settings into the map file.


#9

I was going to ask where the heck that file was but I finally found objecttypes.xml in some obscure windows folder :smiley:

I can work around this all but really my list of object types now exceeds one hundred and only about a 1/4 of them are related to my current project.

Even being able to save them as different names and having a list where you could select which one to use would be pretty good :wink:


(Thorbjørn Lindeijer) #10

So, you can already save that file in a different place and switch between files when you switch projects. It’s just not as convenient as it could be. Like I said before, I think having a Tiled project file would resolve this. Since recently the idea has a proper issue on GitHub:

https://github.com/bjorn/tiled/issues/1665