Add colored margin in Inspector for arrays and dictionaries
Closes https://github.com/godotengine/godot-proposals/issues/2018. Closes https://github.com/godotengine/godot-proposals/issues/6987.
This PR aims to enhance readability of nested data by adding a colored border for arrays and dictionaries as it was done for Resources in #45907.


I've updated a bit this PR to have better readability for dictionaries especially or the Panel around the element to add. Here is how it nows looks like with multiple nested data (Resources, Arrays and Dictionaries) :
Implementation seems pretty straightforward, but some adjustments are required. I'll give it a functional test afterwards, but it's probably good for inclusion into 4.1.
Thanks for the contribution!
I am not 100% against the idea, but I kind of find useful that only sub-resources are highlighted. It is kind of making clear which parts of the properties might be things that are not part of the current scene. Thus adding highlighting to dictionaries is a bit confusing to me, and adds a lot of noise.
I'd think I'd rather have bit more feedback on that solution before merging it, and that it might require a dedicated proposal to be sure it has enough baking.
But that being said, I don't have a better solution for now to solve the readability issue, so it might be an acceptable solution for now.
So I've updated this PR according to https://github.com/godotengine/godot-proposals/issues/6987#issuecomment-1940142900 . I think the implementation is not really good yet but I wanted some feedback on visual aspects I've created two editor settings :
- an enum indicating which EditorProperty should be colored (Containers & Resources, All Resources, External Resources)
- a boolean indicating wether to add a border or not to all containers and resources even when they are not colored.
I feel like the boolean setting could be removed and always set to true but maybe some people might like it without it so I decided to keep the posibility to change for now. Here are in the order :
- Containers & Resources
- Containers & Resources (with borders)
- All Resources
- All Resources (with borders)
- External Resources
- External Resources (with borders)
| Without Border | With Borders | |
|---|---|---|
| Containers & Resources | ||
| All Resources | ||
| External Resources |
You could format those previews in your reply using tables https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables
I like the nested_color_mode I'll fill the doc once we are fixed on an implementation
For the other parameter I'm in favor of making it go away. I kept it as it acts as it used to before this PR this is like a legacy mode (ie. the space was already present before this PR). I could make it true except for the all resources and rename this mode Legacy?
I finally came back to this hopefully for the last time I reduced the size when there is no border (see comparison below). I also changed the name of the setting and added description for both settings. I'm not sure of how to integrate inside the other setting.
Changing color mode to Resources has no effect on built-in resources. EDIT: Though looking at the code, it does not make sense 🤔
Changing color mode to Resources has no effect on built-in resources. EDIT: Though looking at the code, it does not make sense 🤔
I inverted Resource and External Resource in the list because realized it made more sense in this order thought I had done the same inversion in the enum but in fact did not :( Fixed it.
External Resources coloring does not work if the external resource is inside internal resource (e.g. AtlasTexture with texture). Nor sure if intended 🤔
External Resources coloring does not work if the external resource is inside internal resource (e.g. AtlasTexture with texture). Nor sure if intended 🤔
This is not the expected behavior. I'll try to investigate
First resource is internal two following are external. I couldn't reproduce what you described but discover the color wouldn't disappear when closing the editors which I fixed.
The last update added a merge commit, could you rebase on master to remove it?
Thanks!