-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Use float division by default in the inspector #6281
Comments
The inspector uses the Expression class, which performs integer division if given two integers for consisency with GDScript. Changing division to perform floating-point division in this case was rejected in the past, so this will require special-casing the editor inspector to turn integers into floats if an expression is detected. |
Closing this proposal because the default behavior is consistent with GDScript. |
That's terrible behavior, though. The inspector is not a programming language and a field in the inspector is not a coding area - if anything, people will see it like a calculator. Often you want to quickly divide a bunch of values to make adjustments in a batch, without having to pay attention to the actual value. If the field is float, then adding The parser that evaluates this should either:
If you really want to allow integer/floor division in float fields, then make the inspector fields accept a Or, if you really won't change this, at least make it so float fields that display as integer like @Calinou Please consider reopening. |
See godotengine/godot#45303 which implements this. |
Describe the project you are working on
A 2D top down hack and slash game
Describe the problem or limitation you are having in your project
Finding the right value for export variables can be tedious when using division (i.e. input
1 / 3
expecting0.333
, but getting0
instead and having to type in1.0 / 3
to get the expected value).Describe the feature / enhancement and how it helps to overcome the problem or limitation
Use float division by default in the inspector to find fractional values quickly.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
When the user selects a value field in the inspector (i.e. an export value field from a script), and types
1 / 3
then hits enter, the expression should be parsed as a float division and return the value0.333
.If this enhancement will not be used often, can it be worked around with a few lines of script?
This could be a toggle option in Godot's editor settings (type:
bool
| path:interface/editor/float_division_in_field_expressions
| display:Use float division in field expressions
).Is there a reason why this should be core and not an add-on in the asset library?
This is about improving the editor usability out of the box.
The text was updated successfully, but these errors were encountered: