Allow @export_range to support numeric types#105878
Allow @export_range to support numeric types#105878lodetrick wants to merge 1 commit intogodotengine:masterfrom
Conversation
a63d69e to
450bf1e
Compare
Calinou
left a comment
There was a problem hiding this comment.
Tested locally, it mostly works as expected.
Testing project: test_pr_105878.zip
However, the various property inspectors in editor_properties.cpp don't fully implement range hints for all types. Most of them such as Vector2 will ignore the minimum/maximum value when dragging or entering a value, even if no or_less/or_greater is used. Some of them also ignore the step snapping, regardless of the input method used.
This should be fixed before this PR can be merged.
Additionally, I noticed that using an invalid type like bool with a range will cause an error, but the error will be reported on the last line containing an @export_range annotation. This means the error is often reported on the wrong line, unless the bool property is the last property with @export_range in the script.
|
I have been thinking about implementing this, but what kept putting me off is the thought that... |
|
I was looking through the code, and the vector (vector, transform, basis, etc) types simply set the My main concern is that by adding yet another two arguments to the setup method would just clutter it up and confuse developers. I think that the best way (without thinking about compatibility) would be to use a struct as input to the setup instead. |
I think that generally we are aware that the |
I'm also concerned as to how
My earlier comment was more talking about the construction of the specific EditorProperties (the |
Yes. It's also true that we could decide on a separation character on the spot, albeit it may get confusing. |
450bf1e to
46f80c8
Compare
46f80c8 to
68b0ea9
Compare
|
Sorry, misclick.
This should be fixed now, although it needed for two more arguments to be added to each EditorProperty
This should also be fixed now. The push_error method had an argument that I didn't realize that encodes the line number. |
68b0ea9 to
23143a4
Compare
dfa1527 to
52b08bd
Compare
52b08bd to
2f67f9a
Compare
2f67f9a to
c3e7519
Compare
|
Rebased and updated to include changes made in #108065 |
Fixes #105875, Fixes #112647
Currently, numeric inspector properties support
PROPERTY_HINT_RANGEimplicitly (and are used by many editor classes), but the@export_rangedoes not recognize this. This PR allows@export_rangeannotation to use the following types:Vector2, Vector2I, Rect2, Rect2I, Vector3, Vector3I, Vector4, Vector4I, Transform2D, Transform3D, Plane, Quaternion, AABB, Basis, and Projection
It does this by replacing the float and int type check done in master with a custom check that was already partially implemented.