-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
[Editor] Add support for displaying unsigned integers in the inspector #89529
base: master
Are you sure you want to change the base?
Conversation
51db66a
to
9a5daf3
Compare
9a5daf3
to
e1f5a81
Compare
e1f5a81
to
b6bf138
Compare
@@ -2764,7 +2764,7 @@ | |||
<constant name="PROPERTY_HINT_RANGE" value="1" enum="PropertyHint"> | |||
Hints that an [int] or [float] property should be within a range specified via the hint string [code]"min,max"[/code] or [code]"min,max,step"[/code]. The hint string can optionally include [code]"or_greater"[/code] and/or [code]"or_less"[/code] to allow manual input going respectively above the max or below the min values. | |||
[b]Example:[/b] [code]"-360,360,1,or_greater,or_less"[/code]. | |||
Additionally, other keywords can be included: [code]"exp"[/code] for exponential range editing, [code]"radians_as_degrees"[/code] for editing radian angles in degrees (the range values are also in degrees), [code]"degrees"[/code] to hint at an angle and [code]"hide_slider"[/code] to hide the slider. | |||
Additionally, other keywords can be included: [code]"exp"[/code] for exponential range editing, [code]"radians_as_degrees"[/code] for editing radian angles in degrees (the range values are also in degrees), [code]"degrees"[/code] to hint at an angle and [code]"hide_slider"[/code] to hide the slider, and [code]"display_unsigned"[/code] to allow signed integers to be displayed as unsigned (this is especially useful with [PackedInt32Array]). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additionally, other keywords can be included: [code]"exp"[/code] for exponential range editing, [code]"radians_as_degrees"[/code] for editing radian angles in degrees (the range values are also in degrees), [code]"degrees"[/code] to hint at an angle and [code]"hide_slider"[/code] to hide the slider, and [code]"display_unsigned"[/code] to allow signed integers to be displayed as unsigned (this is especially useful with [PackedInt32Array]). | |
Additionally, other keywords can be included: [code]"exp"[/code] for exponential range editing, [code]"radians_as_degrees"[/code] for editing radian angles in degrees (the range values are also in degrees), [code]"degrees"[/code] to hint at an angle, [code]"hide_slider"[/code] to hide the slider, and [code]"display_unsigned"[/code] to allow signed integers to be displayed as unsigned (this is especially useful with [PackedInt32Array]). |
"and" appears twice.
b6bf138
to
7b1b761
Compare
7b1b761
to
b53d518
Compare
b53d518
to
8fcf37d
Compare
8fcf37d
to
7fbfde7
Compare
@@ -49,7 +49,7 @@ class TypedArray; | |||
|
|||
enum PropertyHint { | |||
PROPERTY_HINT_NONE, ///< no hint provided. | |||
PROPERTY_HINT_RANGE, ///< hint_text = "min,max[,step][,or_greater][,or_less][,hide_slider][,radians_as_degrees][,degrees][,exp][,suffix:<keyword>] range. | |||
PROPERTY_HINT_RANGE, ///< hint_text = "min,max[,step][,or_greater][,or_less][,hide_slider][,radians_as_degrees][,degrees][,exp][,display_unsigned][,suffix:<keyword>] range. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should go beyond just display_unsigned
(which is only about display) to something more like treat_as_unsigned
or similar name (which is more about how to interpret the data)?
There's a couple of places in Godot's API where we treat the value of an integer as unsigned, but we don't have a way to formally mark it as such. This has come up in the context of GDExtension a number of times. We've decided to assume that bitfields are unsigned, which covers many of these cases. But having a property hint like this would help with any remaining ones.
cc @Bromeon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point, would be interested in looking at it, could name it that way here and leave things open for future expansion
7fbfde7
to
2b35ab4
Compare
2b35ab4
to
b89d388
Compare
Added these hints to shader uniforms, which is what inspired this improvement Also made improvements to handling of vector inspector
Added these hints to shader uniforms, which is what inspired this improvement
Also made improvements to handling of vector inspector
Still in progress with some details to work out, but basically ready, works well with the specific use case, limited at the moment but useful for the specific use of handling shaders, where editing unsigned values is very difficult from the editor
Considering it a feature, but it technically covers a broken or missing editor feature, I think it speaks for itself in this format, but can open a proposal if desired, but I don't think there's anything more to discuss except implementation details
It's of very limited use for
int
but forPackedInt32Array
andVector2/3/4i
it's very potentSee for background:
PropertyInfo
s #89488 (comment)uvec
shader uniform parameters as signed #92064