Allow to use sliders for integers in EditorSpinSlider

This commit is contained in:
Michael Alexsander
2025-09-12 12:40:07 -03:00
parent ba0da90ba6
commit f16ff829f0
21 changed files with 189 additions and 97 deletions

View File

@ -2771,7 +2771,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, [code]"prefer_slider"[/code] to show the slider for integers, and [code]"hide_control"[/code] to hide the slider or up-down arrows.
</constant>
<constant name="PROPERTY_HINT_ENUM" value="2" enum="PropertyHint">
Hints that an [int] or [String] property is an enumerated value to pick in a list specified via a hint string.

View File

@ -1027,6 +1027,9 @@
<member name="interface/inspector/horizontal_vector_types_editing" type="bool" setter="" getter="">
If [code]true[/code], [Vector3], [Vector3i], [Vector4], [Vector4i], [Rect2], [Rect2i], [Plane], and [Quaternion] properties are shown on a single line in the inspector instead of multiple lines. This is overall more compact, but it can be harder to view and edit large values without expanding the inspector horizontally.
</member>
<member name="interface/inspector/integer_drag_speed" type="float" setter="" getter="">
Base speed for increasing/decreasing integer values by dragging them in the inspector.
</member>
<member name="interface/inspector/max_array_dictionary_items_per_page" type="int" setter="" getter="">
The number of [Array] or [Dictionary] items to display on each "page" in the inspector. Higher values allow viewing more values per page, but take more time to load. This increased load time is noticeable when selecting nodes that have array or dictionary properties in the editor.
</member>

View File

@ -10,14 +10,17 @@
<tutorials>
</tutorials>
<members>
<member name="control_state" type="int" setter="set_control_state" getter="get_control_state" enum="EditorSpinSlider.ControlState" default="0">
The state in which the control used to manipulate the value will be.
</member>
<member name="editing_integer" type="bool" setter="set_editing_integer" getter="is_editing_integer" default="false">
If [code]true[/code], the [EditorSpinSlider] is considered to be editing an integer value. If [code]false[/code], the [EditorSpinSlider] is considered to be editing a floating-point value. This is used to determine whether a slider should be drawn. The slider is only drawn for floats; integers use up-down arrows similar to [SpinBox] instead.
If [code]true[/code], the [EditorSpinSlider] is considered to be editing an integer value. If [code]false[/code], the [EditorSpinSlider] is considered to be editing a floating-point value. This is used to determine whether a slider should be drawn by default. The slider is only drawn for floats; integers use up-down arrows similar to [SpinBox] instead, unless [member control_state] is set to [constant CONTROL_STATE_PREFER_SLIDER]. It will also use [member EditorSettings.interface/inspector/integer_drag_speed] instead of [member EditorSettings.interface/inspector/float_drag_speed] if the slider is available.
</member>
<member name="flat" type="bool" setter="set_flat" getter="is_flat" default="false">
If [code]true[/code], the slider will not draw background.
</member>
<member name="focus_mode" type="int" setter="set_focus_mode" getter="get_focus_mode" overrides="Control" enum="Control.FocusMode" default="2" />
<member name="hide_slider" type="bool" setter="set_hide_slider" getter="is_hiding_slider" default="false">
<member name="hide_slider" type="bool" setter="set_hide_slider" getter="is_hiding_slider" default="false" deprecated="Use [member control_state] instead.">
If [code]true[/code], the slider and up/down arrows are hidden.
</member>
<member name="label" type="String" setter="set_label" getter="get_label" default="&quot;&quot;">
@ -59,6 +62,17 @@
</description>
</signal>
</signals>
<constants>
<constant name="CONTROL_STATE_DEFAULT" value="0" enum="ControlState">
The type of control used will depend on the value of [member editing_integer]. Up-down arrows if [code]true[/code], a slider if [code]false[/code].
</constant>
<constant name="CONTROL_STATE_PREFER_SLIDER" value="1" enum="ControlState">
A slider will always be used, even if [member editing_integer] is enabled.
</constant>
<constant name="CONTROL_STATE_HIDE" value="2" enum="ControlState">
Neither the up-down arrows nor the slider will be shown.
</constant>
</constants>
<theme_items>
<theme_item name="updown" data_type="icon" type="Texture2D">
Single texture representing both the up and down buttons.