Godot: Exported int variables only display as sliders if their stepsize is set to something other that 1

Created on 15 Oct 2020  路  8Comments  路  Source: godotengine/godot

Godot version:
3.2.3.stable

OS/device including version:
Windows 10 Pro v.2004 / Inspiron 7373 Core i7-8550U / Intel(R) UHD Graphics 620

Issue description:
Exported int variables don't show up as sliders. If you set the step size to something else that 1, they do. For some reason it works to set the step size to a float under 1 and then it will work as an int slider.
image

Steps to reproduce:
Open attached project to see issue

Minimal reproduction project:
export_int_issue.zip

bug junior job editor usability

Most helpful comment

@Calinou how about always showing a single decimal on floats even if they are whole numbers to indicate they are floats not ints? I know that would not be for this bug, but that might be a good proposal and then we could make ints have sliders consistently.

All 8 comments

Building upon this, why not simply add both options to those type of export'ed vars, like this?

dwdw
It gives both a fine-grained control with the arrows, and more wide-grained control with the slider.

If i look at the documentation it it only says that the range is limited only for the last example it also says it shows a handy slider.

So in my expectations the first one should not show a slider.

The second one is debatable as a setting of 1 for slider is the same as not setting a step, but that might need to be documented.

And for the last case with the float i guess it is cast to a int, do we need to throw an error there or document that a float will be cast to a int in the step in case of a int slider?

Or do we just want uniform functionality for all these cases?

Sliders are currently only displayed for floats, not integers. I think we should change this so integers also have sliders.

However, if we do that, we lose the "immediate" visual hint that some numbers are integers since they don't have an associated slider. I'm not sure if it's always worth losing that visual hint.

in the example project and screenshot above the exports on line 6 and 7 behave like integer sliders. Just tested that myself. In that case var 3 would be the error and var 4 just strange behavior if understand correctly?

But in that case i would say indeed keep sliders for floats only as only those need the ctrll to round / shift to be more precise functionality that the slider provides

@Calinou how about always showing a single decimal on floats even if they are whole numbers to indicate they are floats not ints? I know that would not be for this bug, but that might be a good proposal and then we could make ints have sliders consistently.

What does exactly need to be done here now?

If sliders should not show for integers none of the above should show a slider, am i correct?

Which does not work at this moment because in editor_spin_slider.cpp we first check

get_step() == 1

And if that is not true we check hide_slider, which is default set to false and not set to true for integers. So a slider is shown for all integer values with a step larger than 1

Does that need to be fixed or should i right away implement the changes as suggested?

An another question the example on line 7 should not be possible i think do we need a warning or an error there. Or is the functionality that it implicitly is cast to an integer how we want it?

Hello guys,
where can i find the logic for the export keyword.
I tried looking in godot/modules/gdscript/ path but found nothing.
image

Please Help me to find something about it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Spooner picture Spooner  路  3Comments

blurymind picture blurymind  路  3Comments

testman42 picture testman42  路  3Comments

mefihl picture mefihl  路  3Comments

ndee85 picture ndee85  路  3Comments