:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/Range.xml. .. _class_Range: Range ===== **Inherits:** :ref:`Control` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` **Inherited By:** :ref:`EditorSpinSlider`, :ref:`ProgressBar`, :ref:`ScrollBar`, :ref:`Slider`, :ref:`SpinBox`, :ref:`TextureProgress` Abstract base class for range-based controls. .. rst-class:: classref-introduction-group Description ----------- Range is a base class for :ref:`Control` nodes that change a floating-point :ref:`value` between a :ref:`min_value` and :ref:`max_value`, using a configured :ref:`step` and :ref:`page` size. See e.g. :ref:`ScrollBar` and :ref:`Slider` for examples of higher level nodes using Range. .. rst-class:: classref-reftable-group Properties ---------- .. table:: :widths: auto +---------------------------+----------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`allow_greater` | ``false`` | +---------------------------+----------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`allow_lesser` | ``false`` | +---------------------------+----------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`exp_edit` | ``false`` | +---------------------------+----------------------------------------------------------+-----------+ | :ref:`float` | :ref:`max_value` | ``100.0`` | +---------------------------+----------------------------------------------------------+-----------+ | :ref:`float` | :ref:`min_value` | ``0.0`` | +---------------------------+----------------------------------------------------------+-----------+ | :ref:`float` | :ref:`page` | ``0.0`` | +---------------------------+----------------------------------------------------------+-----------+ | :ref:`float` | :ref:`ratio` | | +---------------------------+----------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`rounded` | ``false`` | +---------------------------+----------------------------------------------------------+-----------+ | :ref:`float` | :ref:`step` | ``1.0`` | +---------------------------+----------------------------------------------------------+-----------+ | :ref:`float` | :ref:`value` | ``0.0`` | +---------------------------+----------------------------------------------------------+-----------+ .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +------+----------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_value_no_signal` **(** :ref:`float` value **)** | +------+----------------------------------------------------------------------------------------------------------------+ | void | :ref:`share` **(** :ref:`Node` with **)** | +------+----------------------------------------------------------------------------------------------------------------+ | void | :ref:`unshare` **(** **)** | +------+----------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Signals ------- .. _class_Range_signal_changed: .. rst-class:: classref-signal **changed** **(** **)** Emitted when :ref:`min_value`, :ref:`max_value`, :ref:`page`, or :ref:`step` change. .. rst-class:: classref-item-separator ---- .. _class_Range_signal_value_changed: .. rst-class:: classref-signal **value_changed** **(** :ref:`float` value **)** Emitted when :ref:`value` changes. When used on a :ref:`Slider`, this is called continuously while dragging (potentially every frame). If you are performing an expensive operation in a function connected to :ref:`value_changed`, consider using a *debouncing* :ref:`Timer` to call the function less often. \ **Note:** Unlike signals such as :ref:`LineEdit.text_changed`, :ref:`value_changed` is also emitted when ``value`` is set directly via code. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Property Descriptions --------------------- .. _class_Range_property_allow_greater: .. rst-class:: classref-property :ref:`bool` **allow_greater** = ``false`` .. rst-class:: classref-property-setget - void **set_allow_greater** **(** :ref:`bool` value **)** - :ref:`bool` **is_greater_allowed** **(** **)** If ``true``, :ref:`value` may be greater than :ref:`max_value`. .. rst-class:: classref-item-separator ---- .. _class_Range_property_allow_lesser: .. rst-class:: classref-property :ref:`bool` **allow_lesser** = ``false`` .. rst-class:: classref-property-setget - void **set_allow_lesser** **(** :ref:`bool` value **)** - :ref:`bool` **is_lesser_allowed** **(** **)** If ``true``, :ref:`value` may be less than :ref:`min_value`. .. rst-class:: classref-item-separator ---- .. _class_Range_property_exp_edit: .. rst-class:: classref-property :ref:`bool` **exp_edit** = ``false`` .. rst-class:: classref-property-setget - void **set_exp_ratio** **(** :ref:`bool` value **)** - :ref:`bool` **is_ratio_exp** **(** **)** If ``true``, and ``min_value`` is greater than 0, ``value`` will be represented exponentially rather than linearly. .. rst-class:: classref-item-separator ---- .. _class_Range_property_max_value: .. rst-class:: classref-property :ref:`float` **max_value** = ``100.0`` .. rst-class:: classref-property-setget - void **set_max** **(** :ref:`float` value **)** - :ref:`float` **get_max** **(** **)** Maximum value. Range is clamped if ``value`` is greater than ``max_value``. .. rst-class:: classref-item-separator ---- .. _class_Range_property_min_value: .. rst-class:: classref-property :ref:`float` **min_value** = ``0.0`` .. rst-class:: classref-property-setget - void **set_min** **(** :ref:`float` value **)** - :ref:`float` **get_min** **(** **)** Minimum value. Range is clamped if ``value`` is less than ``min_value``. .. rst-class:: classref-item-separator ---- .. _class_Range_property_page: .. rst-class:: classref-property :ref:`float` **page** = ``0.0`` .. rst-class:: classref-property-setget - void **set_page** **(** :ref:`float` value **)** - :ref:`float` **get_page** **(** **)** Page size. Used mainly for :ref:`ScrollBar`. ScrollBar's length is its size multiplied by ``page`` over the difference between ``min_value`` and ``max_value``. .. rst-class:: classref-item-separator ---- .. _class_Range_property_ratio: .. rst-class:: classref-property :ref:`float` **ratio** .. rst-class:: classref-property-setget - void **set_as_ratio** **(** :ref:`float` value **)** - :ref:`float` **get_as_ratio** **(** **)** The value mapped between 0 and 1. .. rst-class:: classref-item-separator ---- .. _class_Range_property_rounded: .. rst-class:: classref-property :ref:`bool` **rounded** = ``false`` .. rst-class:: classref-property-setget - void **set_use_rounded_values** **(** :ref:`bool` value **)** - :ref:`bool` **is_using_rounded_values** **(** **)** If ``true``, ``value`` will always be rounded to the nearest integer. .. rst-class:: classref-item-separator ---- .. _class_Range_property_step: .. rst-class:: classref-property :ref:`float` **step** = ``1.0`` .. rst-class:: classref-property-setget - void **set_step** **(** :ref:`float` value **)** - :ref:`float` **get_step** **(** **)** If greater than 0, ``value`` will always be rounded to a multiple of ``step``. If ``rounded`` is also ``true``, ``value`` will first be rounded to a multiple of ``step`` then rounded to the nearest integer. .. rst-class:: classref-item-separator ---- .. _class_Range_property_value: .. rst-class:: classref-property :ref:`float` **value** = ``0.0`` .. rst-class:: classref-property-setget - void **set_value** **(** :ref:`float` value **)** - :ref:`float` **get_value** **(** **)** Range's current value. Changing this property (even via code) will trigger :ref:`value_changed` signal. Use :ref:`set_value_no_signal` if you want to avoid it. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_Range_method_set_value_no_signal: .. rst-class:: classref-method void **set_value_no_signal** **(** :ref:`float` value **)** Sets the **Range**'s current value to the specified :ref:`value`, without emitting the :ref:`value_changed` signal. .. rst-class:: classref-item-separator ---- .. _class_Range_method_share: .. rst-class:: classref-method void **share** **(** :ref:`Node` with **)** Binds two **Range**\ s together along with any ranges previously grouped with either of them. When any of range's member variables change, it will share the new value with all other ranges in its group. .. rst-class:: classref-item-separator ---- .. _class_Range_method_unshare: .. rst-class:: classref-method void **unshare** **(** **)** Stops the **Range** from sharing its member variables with any other. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`