godot icon indicating copy to clipboard operation
godot copied to clipboard

Add COMPACT display setting for Vectors in Inspector

Open npinsker opened this issue 1 year ago • 13 comments
trafficstars

Make the horizontal Vector display (controlled by interface/inspector/horizontal_vector2_editing) take up 1 line instead of 2.

Current (vertical) Vector display: image

Current (horizontal) Vector display: image

New ("compact") Vector display: image

I can't really see much benefit to the current behavior; it seems like the intent is presumably to use more horizontal space in exchange for less vertical space...

npinsker avatar Sep 06 '24 15:09 npinsker

Can you add a bit of margin between x and y?

jcostello avatar Sep 06 '24 16:09 jcostello

This makes all vectors display in single line:

extends Node
@export var v2: Vector2
@export var v3: Vector3
@export var v4: Vector4

godot windows editor x86_64_TOlL4NOe6m (unfortunately couldn't shrink the width more :disappointed:)

And it makes Vector3/Vector4 single-line even with interface/inspector/horizontal_vector2_editing disabled: godot windows editor x86_64_hN7R8Yg6Mq

Needs to be this wide to show a single digit per Vector4 component (with interface/theme/spacing_preset set to Compact): godot windows editor x86_64_na72WOJLQr

I can't really see much benefit to the current behavior; it seems like the intent is presumably to use more horizontal space in exchange for less vertical space...

Note there's a vertical scrollbar available in the inspector, meaning even on small screens the vertical space is virtually infinite. Horizontal space is bigger problem as horizontal scrolling is not supported in the inspector.


Nothing against allowing to customize it like that but I'd say the current layout should be obtainable as well.

kleonc avatar Sep 06 '24 17:09 kleonc

Thanks for the comments. I changed the bool setting to an enum so the user can choose from any of the existing three options:

image

Ideally the spin slider component would show the value rather than the label at low width, but it seems complicated and I don't want to touch it in this commit.

it makes Vector3/Vector4 single-line even with interface/inspector/horizontal_vector2_editing disabled

I wasn't able to reproduce it -- note that Vector3 and Vector4 are controlled by the 'Vector Types' editor setting.

Passing on adding margin for the compact setting, because it's not a problem for the default theme, and I want to save the space.

npinsker avatar Sep 06 '24 18:09 npinsker

I like this a lot as an option, but it requires the Inspector to be decently expanded to be used meaningfully, and the editor itself struggles a bunch with horizontal space as is.

Mickeon avatar Sep 06 '24 20:09 Mickeon

Yeah, it requires a bit more expansion if you have a Vector4 -- but given how uncommon it is, and also because you can compactify Vector2 independently from Vector3 and Vector4 -- I'm hopeful it wouldn't be a big issue.

(Besides, the biggest culprit here by far is the label, taking up gobs of space it doesn't really need...)

npinsker avatar Sep 06 '24 20:09 npinsker

yes, I agree with @npinsker, it is an option and may look odd for some cases, but it is required until the inspector collapsing and expanding is improved see the proposal https://github.com/godotengine/godot-proposals/issues/7814

@npinsker, is it not possible for items with more than 2 fields, it will expand to full line. I mean for Vector2 it will show besides and then for Vector3/ Vector4 it will show in full line. or better will be you can detect based on width of the dock window you can determine where to display Vector3 and Vector4

tokengamedev avatar Sep 09 '24 07:09 tokengamedev

Vector2 and Vector3/4 are controlled by different flags, so the user can choose what to do for each independently

npinsker avatar Sep 09 '24 07:09 npinsker

For Vector4, #80893 provides an alternative layout. Maybe it's worth it to provide option for every vector type separately? It's weird to have vector_types_display_style, and a separate option for Vector2. Also the compact mode for Vector4 is unusable, unless your inspector is super wide.

KoBeWi avatar Oct 03 '24 19:10 KoBeWi

the compact mode for Vector4 is unusable

I agree, though it's an opt-in option so doesn't make things any worse (and FWIW it's fine in my theme). Also in my experience Vector4 fields are vanishingly rare compared to Vector3.

My personal preference would be how Unity does it (Vector2 and Vector3 are COMPACT and Vector4 is HORIZONTAL) -- happy to provide an option for each independently, but I'm not familiar with the codebase and was a bit wary of adding a setting for such niche / fine-grained control. Could be better for a future commit?

npinsker avatar Oct 03 '24 19:10 npinsker

Your PR already renames the existing settings, adding a new one wouldn't be much different.

KoBeWi avatar Oct 03 '24 19:10 KoBeWi

SG, will do in a follow-up commit

npinsker avatar Oct 03 '24 20:10 npinsker

For what it's worth, and not necessarily in the scope of this PR, but on this topic, it'd be great that there was some automatic layout logic so the wrapping happens or not according to the available width. Also, the distribution of width between the left column (property names) and the right one would benefit a lot from a more clever logic than we currently have.

RandomShaper avatar Oct 04 '24 07:10 RandomShaper

That's def out of scope for this

Zireael07 avatar Oct 04 '24 07:10 Zireael07

For what it's worth, and not necessarily in the scope of this PR, but on this topic, it'd be great that there was some automatic layout logic so the wrapping happens or not according to the available width. Also, the distribution of width between the left column (property names) and the right one would benefit a lot from a more clever logic than we currently have.

That's def out of scope for this

I'm not so sure about the "def" part.

In my mind, introducing a compact mode that would break on small displays is rather counter-intuitive, UX-wise.

I mean, maybe it's out of scope of this specific PR, but I wouldn't merge such PR without merging first an automatic layout logic from another PR.

adamscott avatar Feb 13 '25 15:02 adamscott