Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add colored margin in Inspector for arrays and dictionaries #75482

Conversation

ajreckof
Copy link
Member

@ajreckof ajreckof commented Mar 30, 2023

Closes godotengine/godot-proposals#2018.
Closes godotengine/godot-proposals#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 ajreckof force-pushed the color-hint-for-arrays-and-dictionnaries branch from d432cfb to 8188ea4 Compare March 30, 2023 04:05
@YuriSizov YuriSizov added this to the 4.x milestone Mar 30, 2023
@fire fire changed the title add colored margin for Arrays and dictionaries Add colored margin for Arrays and dictionaries Mar 31, 2023
@ajreckof ajreckof mentioned this pull request Apr 15, 2023
8 tasks
@ajreckof ajreckof marked this pull request as draft April 16, 2023 00:07
@ajreckof ajreckof force-pushed the color-hint-for-arrays-and-dictionnaries branch from 8188ea4 to ffea158 Compare April 16, 2023 01:20
@ajreckof ajreckof marked this pull request as ready for review April 16, 2023 01:25
@YuriSizov YuriSizov requested review from a team and YuriSizov April 17, 2023 14:59
@YuriSizov YuriSizov changed the title Add colored margin for Arrays and dictionaries Add colored margin in Inspector for arrays and dictionaries May 29, 2023
@YuriSizov
Copy link
Contributor

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 YuriSizov modified the milestones: 4.x, 4.1 May 29, 2023
@groud
Copy link
Member

groud commented May 30, 2023

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.

@ajreckof ajreckof force-pushed the color-hint-for-arrays-and-dictionnaries branch 2 times, most recently from 6c8b8e0 to 8b03965 Compare May 31, 2023 01:33
@ajreckof ajreckof force-pushed the color-hint-for-arrays-and-dictionnaries branch 2 times, most recently from 0ecc9ac to 557bb1f Compare June 2, 2023 23:17
@akien-mga akien-mga modified the milestones: 4.1, 4.2 Jun 13, 2023
@AThousandShips AThousandShips modified the milestones: 4.2, 4.3 Oct 26, 2023
@ajreckof ajreckof force-pushed the color-hint-for-arrays-and-dictionnaries branch from 557bb1f to 2ef1863 Compare February 19, 2024 04:26
@ajreckof ajreckof force-pushed the color-hint-for-arrays-and-dictionnaries branch 2 times, most recently from 7d4763e to d395b38 Compare February 21, 2024 15:56
@ajreckof ajreckof requested a review from a team as a code owner February 21, 2024 15:56
@Mickeon
Copy link
Contributor

Mickeon commented Feb 21, 2024

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

Copy link
Contributor

@Mickeon Mickeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about the name. This is (almost) the only thing in the entire engine called "coloration". I think the setting could actually be more obvious and be called nested_color_mode.

The extra delimitate_all_container_and_resources is definitely iffy, especially since it does nothing for one of the above setting's values. Not to mention the huge name.

My opinion is that, as is, there's little reason to want this disabled as it causes this void where some delimiters should be. Not exactly pleasing.
image
If that is addressed, it could be part of the original setting, maybe?

@@ -659,6 +659,8 @@
<member name="interface/inspector/auto_unfold_foreign_scenes" type="bool" setter="" getter="">
If [code]true[/code], automatically expands property groups in the Inspector dock when opening a scene that hasn't been opened previously. If [code]false[/code], all groups remain collapsed by default.
</member>
<member name="interface/inspector/coloration_mode" type="int" setter="" getter="">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you could roughly fill in this it would be nice (I could help later if the feature is liked). As I like to say, no one knows the thing best than the one that created it in the first place.

@ajreckof
Copy link
Member Author

ajreckof commented Feb 21, 2024

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 ajreckof force-pushed the color-hint-for-arrays-and-dictionnaries branch 2 times, most recently from c55ac5a to 4ad9c48 Compare April 25, 2024 23:15
@ajreckof
Copy link
Member Author

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 ajreckof requested a review from Mickeon April 25, 2024 23:21
@ajreckof ajreckof force-pushed the color-hint-for-arrays-and-dictionnaries branch from 4ad9c48 to 91af2c2 Compare April 26, 2024 00:01
editor/editor_inspector.h Outdated Show resolved Hide resolved
editor/editor_inspector.h Outdated Show resolved Hide resolved
editor/editor_inspector.cpp Outdated Show resolved Hide resolved
editor/editor_inspector.cpp Outdated Show resolved Hide resolved
doc/classes/EditorSettings.xml Outdated Show resolved Hide resolved
doc/classes/EditorSettings.xml Outdated Show resolved Hide resolved
doc/classes/EditorSettings.xml Outdated Show resolved Hide resolved
editor/editor_properties.cpp Outdated Show resolved Hide resolved
editor/editor_settings.cpp Outdated Show resolved Hide resolved
editor/editor_inspector.cpp Outdated Show resolved Hide resolved
@KoBeWi
Copy link
Member

KoBeWi commented Apr 29, 2024

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

editor/editor_inspector.cpp Outdated Show resolved Hide resolved
editor/editor_inspector.cpp Outdated Show resolved Hide resolved
@ajreckof ajreckof force-pushed the color-hint-for-arrays-and-dictionnaries branch from e89e41d to b2feff5 Compare April 29, 2024 13:42
@ajreckof
Copy link
Member Author

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.

@KoBeWi
Copy link
Member

KoBeWi commented May 2, 2024

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

@ajreckof
Copy link
Member Author

ajreckof commented May 2, 2024

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 ajreckof force-pushed the color-hint-for-arrays-and-dictionnaries branch from b2feff5 to f866e88 Compare May 3, 2024 03:48
@ajreckof
Copy link
Member Author

ajreckof commented May 3, 2024

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.

@akien-mga
Copy link
Member

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

Apply suggestions from code review

Co-Authored-By: A Thousand Ships <[email protected]>
Co-Authored-By: Tomek <[email protected]>
@ajreckof ajreckof force-pushed the color-hint-for-arrays-and-dictionnaries branch from f866e88 to cba9606 Compare May 3, 2024 08:56
@akien-mga akien-mga merged commit d898f37 into godotengine:master May 3, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants