Godot-proposals: Add a link/unlink option for subproperties like "scale"

Created on 10 Oct 2019  Â·  8Comments  Â·  Source: godotengine/godot-proposals

Describe the project you are working on:
2D action game, card game

Describe the problem or limitation you are having in your project:
Throughout the day I change properties like scale in the editor many, many times. Which already can be quite annoying because of https://github.com/godotengine/godot/issues/28618.
In 95% of the cases I want to change properties like scale proportionally. So I have to first set the x, then the y value, _both to the same value_. Because the editor does not offer to link those properties, all those operations have to be done twice ... every ... single ... time.

Describe how this feature / enhancement will help you overcome this problem or limitation:
A small clickable link/unlink icon next to values that would often be set proportionally.
A small mouseover text explaining what it does, for those unsure about the meaning of the icon, similar to mouseover on properties.
I would expect scale to be linked by default, others may be unlinked by default.

Show a mock up screenshots/video or a flow diagram explaining how your proposal will work:
linked_properties

Describe implementation detail for your proposal (in code), if possible:
I'm C++ illiterate.

If this enhancement will not be used often, can it be worked around with a few lines of script?:
It's so common everywhere else, people are used to that level of comfort. I expect it to be used a lot.

Is there a reason why this should be core and not an add-on in the asset library?:
Noone will/would/should download addons for such small UI quality of life improvements.

editor

Most helpful comment

@nathanfranke
I would think this would be really needed for the scale property first and foremost (and probably just in editor), not necessarily any Vectors data types.
As for behavior, what I imagined was when the scale is linked, whatever value the user changes, gets immediately copied to the other value. So if the user changes x 1 to x 0.5, y would immediately become 0.5 too. In case of 3D scale it would behave exactly the same, only this time instead of one, two other values would immediately change. So if the user changes x 1 to x 0.5, both z and y would jump to 0.5.

As for symbol placement, having where you proposed surely would be good as well. Having it close to the values might help to illustrate was it does intuitively. Otherwise moving the link symbol next to the property text might be a possibility too:
linked_scale2

All 8 comments

This sounds like something one would have to program into the EditorProperty type that renders any Vector2/Vector3 value. Contained in /editor/editor_properties.h. I would add a ToolButton in between the label and the editable field on the top row and give it a tooltip. Then you just track a bool in the EditorProperty, write a public method to set it, bind that method to the ClassDB and connect to the ToolButton's "pressed" signal to set its value.

There are cases where linking values doesn't make sense (e.g. default gravity), so it should probably be defined in a property hint somehow. Likewise, position properties generally have no need to expose a "linked" option.

For the specific case of scale, can you shift+click+drag in the corner of the gizmo?

out

That gif isn't showing my cursor, but I'm clicking in a corner between the red and green gizmo bits. The same thing works in 3D.

@rcorre Yes, shift+LMB+drag when scale tool is selected (kinda) works to uniformly scale, though I think it behaves very unpredictably.

Anyway, this proposal is not about eyeballing with the scale tool, it's about putting in a precise numerical value in the inspector, and not having to do it twice or trice all the time.

If we had this feature, and you linked the subproperties in beforehand, I would assume you could select the scale tool, and LMB drag without shift just either one of the axis and you would get uniform scale. Or maybe not and we want the scale tool to act independently from the inspector link feature. ¯_(ツ)_/¯

Another option, (maybe easier to implement?) could be to make the inspector scale behave more like the viewport scale tool: When entering a new value in the inspector and simultaneously holding shift, the same value is applied to all axis.

Another option, (maybe easier to implement?) could be to make the inspector scale behave more like the viewport scale tool: When entering a new value in the inspector and simultaneously holding shift, the same value is applied to all axis.

I remember this being available back in the Godot 1.x days, but I think it was removed because it was too easy to accidentally do it when using an AZERTY keyboard layout (where entering numbers without a numpad requires holding Shift).

We could probably reimplement this, but using the Ctrl modifier instead.

A few questions:

  1. Would a side button be better? The link button in the middle of x and y puts too much noise in that area.
    Here is my mockup:
    image

  2. Should this be made to work with other types, such as Vector3? What about odd types, that still have a similar format, such as Rect2?

  3. How exactly should the linking behave? Should it always snap both values to be the same, or attempt to maintain aspect ratio?

@nathanfranke
I would think this would be really needed for the scale property first and foremost (and probably just in editor), not necessarily any Vectors data types.
As for behavior, what I imagined was when the scale is linked, whatever value the user changes, gets immediately copied to the other value. So if the user changes x 1 to x 0.5, y would immediately become 0.5 too. In case of 3D scale it would behave exactly the same, only this time instead of one, two other values would immediately change. So if the user changes x 1 to x 0.5, both z and y would jump to 0.5.

As for symbol placement, having where you proposed surely would be good as well. Having it close to the values might help to illustrate was it does intuitively. Otherwise moving the link symbol next to the property text might be a possibility too:
linked_scale2

I originally also wanted it closer to the name, but the inspector isn't really designed to place things next to the name.

Was this page helpful?
0 / 5 - 0 ratings