godot icon indicating copy to clipboard operation
godot copied to clipboard

Add colored margin in Inspector for arrays and dictionaries

Open ajreckof opened this issue 2 years ago • 6 comments

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) :

ajreckof avatar Mar 30 '23 03:03 ajreckof

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.

YuriSizov avatar May 29 '23 17:05 YuriSizov

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.

groud avatar May 30 '23 11:05 groud

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 Capture d’écran 2024-02-19 à 04 25 22 Capture d’écran 2024-02-19 à 04 25 22
All Resources Capture d’écran 2024-02-19 à 04 20 54 Capture d’écran 2024-02-19 à 05 20 17
External Resources Capture d’écran 2024-02-19 à 04 28 51 Capture d’écran 2024-02-19 à 05 19 44

ajreckof avatar Feb 19 '24 04:02 ajreckof

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

Mickeon avatar Feb 21 '24 16:02 Mickeon

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?

ajreckof avatar Feb 21 '24 22:02 ajreckof

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. Capture d’écran 2024-02-19 à 04 20 54Capture d’écran 2024-04-26 à 00 07 59

ajreckof avatar Apr 25 '24 23:04 ajreckof

Changing color mode to Resources has no effect on built-in resources. EDIT: Though looking at the code, it does not make sense 🤔

KoBeWi avatar Apr 29 '24 10:04 KoBeWi

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.

ajreckof avatar Apr 29 '24 13:04 ajreckof

External Resources coloring does not work if the external resource is inside internal resource (e.g. AtlasTexture with texture). Nor sure if intended 🤔

KoBeWi avatar May 02 '24 20:05 KoBeWi

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

ajreckof avatar May 02 '24 23:05 ajreckof

Capture d’écran 2024-05-03 à 05 47 30

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.

ajreckof avatar May 03 '24 03:05 ajreckof

The last update added a merge commit, could you rebase on master to remove it?

akien-mga avatar May 03 '24 08:05 akien-mga

Thanks!

akien-mga avatar May 03 '24 10:05 akien-mga