-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
Spin slider: More flexibility for manual float input regardless of range parameters #3524
Comments
Going to agree with the first proposal. There's an uncountable number of sliders which are restricting me right now, off the top of my head:
|
Shouldn't we consider finding a way to have several hints ? Since the inspector is going to be more flexible that might be needed. But that might be too much I don't know... |
I think this is really needed. I also prefer solution 1. |
I have recently had to adjust the slider hints for the physics hinge_constraint, which sets a practical range of [-200,200] but allows user entry outside the range with hints or_lesser, or_greater.(godotengine/godot#19246) I prefer the proposal idea of adding the hint or_finer, which is consistent with the other hints I have used. |
See godotengine/godot#18251 and godotengine/godot#25470 for some more context and discussion on what should be implemented ideally. godotengine/godot#30776 made the default float step configurable, but it doesn't solve the need to decouple spin/slider step from the decimal points that can be input and visualized in the inspector. |
Should we remove the hardcoded float step from most properties and only include it where it's absolutely required to not break things? This issue popped up again today on the Godot Q&A: https://godotengine.org/qa/70018/why-does-the-inspector-ui-truncate-numbers-to-decimal-places This way, the Default Float Step setting would be much more useful, and we'd spend less time reasoning about the float step for every property. |
Transferred this from the main Godot repo, so the OP doesn't follow the usual template (but is still fairly close in spirit). AFAIK this is still relevant, but could warrant more discussion. |
We discussed this in a proposal review meeting, and agree that adding a way to manually input more precise numbers while still being able to use a low-precision slider step would be useful. Our current consensus would be to experiment with something like this:
|
I think this hint is redundant: If it's absolutely necessary to force a precision, we have to do snapping in the property setter too. But when the setter snaps value, the slider won't need to do anything special anymore. Since manual input allows arbitrary value, I think the slider / spinbox can also produce arbitrary value by default, and snap only when asked to (e.g. when holding CTRL). Float steps used in the engine are all specified in Currently, dragging the slider box is the same as dragging the slider handle. I think it'll be handy if we only snap the delta produced by dragging the slider box itself. For example, if the slider decides to use 0.1 as its step and its current value is 0.123, dragging the slider handle produces values like 0.2, 0.3, and 0.0, while dragging the slider box can produce values like 0.223, 0.323, and 0.023. |
I've been working on implementing some form of this at https://github.com/MrEgggga/godot/tree/permissive-range, although it's together with something akin to godotengine/godot#88354. Some questions that have come up in my implementation:
Also: While I don't think my current implementation would be of any use for this proposal as it's bundled with some other changes, I would be willing to implement whatever consensus is reached, if any. |
I'd say this is a good enough solution as a first step (7 decimals should work fine, even). |
Context
We have many issues relative to the inspector spin slider, which often constraints the values which can be selected both via the slider/spinbox and via manual input (typing the value).
The range and step of the slider/spinbox are defined via
PROPERTY_HINT_RANGE
(linear) andPROPERTY_HINT_EXP_RANGE
(exponential), which take the following hint parameter:"min,max,step"
e.g."0.01,100,0.01"
.This works fine and usually the ranges specified cover the majority of use cases, or, more importantly, prevent the input of some invalid values (e.g. some properties can't take negative values, or 0, or too high values would crash the editor and/or the game).
The issue
But in a non-negligible percentage of use cases, users still need to be able to set values which are:
In the master branch (with dfd133169), @reduz recently added support two hinting options
or_greater
andor_lesser
which solve the points 1) and 2) above when defined manually, e.g."0.01,100,0.01,or_greater"
would allow manual input from 0.01 included to MAX_FLOAT, but the slider itself would only go up to 100.The remaining problems are, IMO:
or_finer
oror_more_decimals
would be needed.The proposal
Instead of using the same limitations for the slider/spinbox and for manual input, I propose to decouple the two and allow free input by default in the input box (so the
or_greater
andor_lesser
options could be removed, and the third option for more precision would not be necessary).This means that by default, a
PROPERTY_HINT_RANGE
with"0.01,100,0.01"
would:-3.08
,142
and0.0005
manually (it would stop rounding your input to whatever it deems appropriate)-3.08
, the slider would be at its min position, and if you click it to slide the value, it would jump to0.01
(the actual slider min) and then go up in increments of 0.01.Then we could add options to restrict values for the properties where negative values don't make sense, where 0 must be excluded, or where the range's min or max should be enforced, e.g.:
no_negative
,no_zero
,use_min
,use_max
.It's still a similar system to the existing one, but I think that "free input by default" would be better than "restricted by default".
Other proposal
Another solution could be to fully decouple the hint range used by the slider/spinbox (which should be the "common usage" value) and the enforced range of the manual input, by allowing to customize both.
For example, one could set a slider/spinbox range to
"0.01,100,0.01"
, and a manual input range to"0.0001,inf,0.0001"
, meaning that you could manually input values from 0.0001 to MAX_FLOAT with a precision of 4 decimal digits.It could be specified maybe as two arguments:
PROPERTY_HINT_RANGE, "0.01,100,0.01", "0.0001,inf,0.0001"
.WDYT? Even as I write this wall of text I'm thinking that my two proposals might not be so much better than the current state, and that it might be simpler and good enough to implement an
or_fine
oror_more_decimals
option, but I'd be interested in more opinions.The text was updated successfully, but these errors were encountered: