class_range.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.5/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.5/doc/classes/Range.xml.
  6. .. _class_Range:
  7. Range
  8. =====
  9. **Inherits:** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`EditorSpinSlider<class_EditorSpinSlider>`, :ref:`ProgressBar<class_ProgressBar>`, :ref:`ScrollBar<class_ScrollBar>`, :ref:`Slider<class_Slider>`, :ref:`SpinBox<class_SpinBox>`, :ref:`TextureProgress<class_TextureProgress>`
  11. Abstract base class for range-based controls.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. Range is a base class for :ref:`Control<class_Control>` nodes that change a floating-point :ref:`value<class_Range_property_value>` between a :ref:`min_value<class_Range_property_min_value>` and :ref:`max_value<class_Range_property_max_value>`, using a configured :ref:`step<class_Range_property_step>` and :ref:`page<class_Range_property_page>` size. See e.g. :ref:`ScrollBar<class_ScrollBar>` and :ref:`Slider<class_Slider>` for examples of higher level nodes using Range.
  16. .. rst-class:: classref-reftable-group
  17. Properties
  18. ----------
  19. .. table::
  20. :widths: auto
  21. +---------------------------+----------------------------------------------------------+-----------+
  22. | :ref:`bool<class_bool>` | :ref:`allow_greater<class_Range_property_allow_greater>` | ``false`` |
  23. +---------------------------+----------------------------------------------------------+-----------+
  24. | :ref:`bool<class_bool>` | :ref:`allow_lesser<class_Range_property_allow_lesser>` | ``false`` |
  25. +---------------------------+----------------------------------------------------------+-----------+
  26. | :ref:`bool<class_bool>` | :ref:`exp_edit<class_Range_property_exp_edit>` | ``false`` |
  27. +---------------------------+----------------------------------------------------------+-----------+
  28. | :ref:`float<class_float>` | :ref:`max_value<class_Range_property_max_value>` | ``100.0`` |
  29. +---------------------------+----------------------------------------------------------+-----------+
  30. | :ref:`float<class_float>` | :ref:`min_value<class_Range_property_min_value>` | ``0.0`` |
  31. +---------------------------+----------------------------------------------------------+-----------+
  32. | :ref:`float<class_float>` | :ref:`page<class_Range_property_page>` | ``0.0`` |
  33. +---------------------------+----------------------------------------------------------+-----------+
  34. | :ref:`float<class_float>` | :ref:`ratio<class_Range_property_ratio>` | |
  35. +---------------------------+----------------------------------------------------------+-----------+
  36. | :ref:`bool<class_bool>` | :ref:`rounded<class_Range_property_rounded>` | ``false`` |
  37. +---------------------------+----------------------------------------------------------+-----------+
  38. | :ref:`float<class_float>` | :ref:`step<class_Range_property_step>` | ``1.0`` |
  39. +---------------------------+----------------------------------------------------------+-----------+
  40. | :ref:`float<class_float>` | :ref:`value<class_Range_property_value>` | ``0.0`` |
  41. +---------------------------+----------------------------------------------------------+-----------+
  42. .. rst-class:: classref-reftable-group
  43. Methods
  44. -------
  45. .. table::
  46. :widths: auto
  47. +------+---------------------------------------------------------------------------------+
  48. | void | :ref:`share<class_Range_method_share>` **(** :ref:`Node<class_Node>` with **)** |
  49. +------+---------------------------------------------------------------------------------+
  50. | void | :ref:`unshare<class_Range_method_unshare>` **(** **)** |
  51. +------+---------------------------------------------------------------------------------+
  52. .. rst-class:: classref-section-separator
  53. ----
  54. .. rst-class:: classref-descriptions-group
  55. Signals
  56. -------
  57. .. _class_Range_signal_changed:
  58. .. rst-class:: classref-signal
  59. **changed** **(** **)**
  60. Emitted when :ref:`min_value<class_Range_property_min_value>`, :ref:`max_value<class_Range_property_max_value>`, :ref:`page<class_Range_property_page>`, or :ref:`step<class_Range_property_step>` change.
  61. .. rst-class:: classref-item-separator
  62. ----
  63. .. _class_Range_signal_value_changed:
  64. .. rst-class:: classref-signal
  65. **value_changed** **(** :ref:`float<class_float>` value **)**
  66. Emitted when :ref:`value<class_Range_property_value>` changes. When used on a :ref:`Slider<class_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<class_Range_signal_value_changed>`, consider using a *debouncing* :ref:`Timer<class_Timer>` to call the function less often.
  67. \ **Note:** Unlike signals such as :ref:`LineEdit.text_changed<class_LineEdit_signal_text_changed>`, :ref:`value_changed<class_Range_signal_value_changed>` is also emitted when ``value`` is set directly via code.
  68. .. rst-class:: classref-section-separator
  69. ----
  70. .. rst-class:: classref-descriptions-group
  71. Property Descriptions
  72. ---------------------
  73. .. _class_Range_property_allow_greater:
  74. .. rst-class:: classref-property
  75. :ref:`bool<class_bool>` **allow_greater** = ``false``
  76. .. rst-class:: classref-property-setget
  77. - void **set_allow_greater** **(** :ref:`bool<class_bool>` value **)**
  78. - :ref:`bool<class_bool>` **is_greater_allowed** **(** **)**
  79. If ``true``, :ref:`value<class_Range_property_value>` may be greater than :ref:`max_value<class_Range_property_max_value>`.
  80. .. rst-class:: classref-item-separator
  81. ----
  82. .. _class_Range_property_allow_lesser:
  83. .. rst-class:: classref-property
  84. :ref:`bool<class_bool>` **allow_lesser** = ``false``
  85. .. rst-class:: classref-property-setget
  86. - void **set_allow_lesser** **(** :ref:`bool<class_bool>` value **)**
  87. - :ref:`bool<class_bool>` **is_lesser_allowed** **(** **)**
  88. If ``true``, :ref:`value<class_Range_property_value>` may be less than :ref:`min_value<class_Range_property_min_value>`.
  89. .. rst-class:: classref-item-separator
  90. ----
  91. .. _class_Range_property_exp_edit:
  92. .. rst-class:: classref-property
  93. :ref:`bool<class_bool>` **exp_edit** = ``false``
  94. .. rst-class:: classref-property-setget
  95. - void **set_exp_ratio** **(** :ref:`bool<class_bool>` value **)**
  96. - :ref:`bool<class_bool>` **is_ratio_exp** **(** **)**
  97. If ``true``, and ``min_value`` is greater than 0, ``value`` will be represented exponentially rather than linearly.
  98. .. rst-class:: classref-item-separator
  99. ----
  100. .. _class_Range_property_max_value:
  101. .. rst-class:: classref-property
  102. :ref:`float<class_float>` **max_value** = ``100.0``
  103. .. rst-class:: classref-property-setget
  104. - void **set_max** **(** :ref:`float<class_float>` value **)**
  105. - :ref:`float<class_float>` **get_max** **(** **)**
  106. Maximum value. Range is clamped if ``value`` is greater than ``max_value``.
  107. .. rst-class:: classref-item-separator
  108. ----
  109. .. _class_Range_property_min_value:
  110. .. rst-class:: classref-property
  111. :ref:`float<class_float>` **min_value** = ``0.0``
  112. .. rst-class:: classref-property-setget
  113. - void **set_min** **(** :ref:`float<class_float>` value **)**
  114. - :ref:`float<class_float>` **get_min** **(** **)**
  115. Minimum value. Range is clamped if ``value`` is less than ``min_value``.
  116. .. rst-class:: classref-item-separator
  117. ----
  118. .. _class_Range_property_page:
  119. .. rst-class:: classref-property
  120. :ref:`float<class_float>` **page** = ``0.0``
  121. .. rst-class:: classref-property-setget
  122. - void **set_page** **(** :ref:`float<class_float>` value **)**
  123. - :ref:`float<class_float>` **get_page** **(** **)**
  124. Page size. Used mainly for :ref:`ScrollBar<class_ScrollBar>`. ScrollBar's length is its size multiplied by ``page`` over the difference between ``min_value`` and ``max_value``.
  125. .. rst-class:: classref-item-separator
  126. ----
  127. .. _class_Range_property_ratio:
  128. .. rst-class:: classref-property
  129. :ref:`float<class_float>` **ratio**
  130. .. rst-class:: classref-property-setget
  131. - void **set_as_ratio** **(** :ref:`float<class_float>` value **)**
  132. - :ref:`float<class_float>` **get_as_ratio** **(** **)**
  133. The value mapped between 0 and 1.
  134. .. rst-class:: classref-item-separator
  135. ----
  136. .. _class_Range_property_rounded:
  137. .. rst-class:: classref-property
  138. :ref:`bool<class_bool>` **rounded** = ``false``
  139. .. rst-class:: classref-property-setget
  140. - void **set_use_rounded_values** **(** :ref:`bool<class_bool>` value **)**
  141. - :ref:`bool<class_bool>` **is_using_rounded_values** **(** **)**
  142. If ``true``, ``value`` will always be rounded to the nearest integer.
  143. .. rst-class:: classref-item-separator
  144. ----
  145. .. _class_Range_property_step:
  146. .. rst-class:: classref-property
  147. :ref:`float<class_float>` **step** = ``1.0``
  148. .. rst-class:: classref-property-setget
  149. - void **set_step** **(** :ref:`float<class_float>` value **)**
  150. - :ref:`float<class_float>` **get_step** **(** **)**
  151. 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.
  152. .. rst-class:: classref-item-separator
  153. ----
  154. .. _class_Range_property_value:
  155. .. rst-class:: classref-property
  156. :ref:`float<class_float>` **value** = ``0.0``
  157. .. rst-class:: classref-property-setget
  158. - void **set_value** **(** :ref:`float<class_float>` value **)**
  159. - :ref:`float<class_float>` **get_value** **(** **)**
  160. Range's current value.
  161. .. rst-class:: classref-section-separator
  162. ----
  163. .. rst-class:: classref-descriptions-group
  164. Method Descriptions
  165. -------------------
  166. .. _class_Range_method_share:
  167. .. rst-class:: classref-method
  168. void **share** **(** :ref:`Node<class_Node>` with **)**
  169. 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.
  170. .. rst-class:: classref-item-separator
  171. ----
  172. .. _class_Range_method_unshare:
  173. .. rst-class:: classref-method
  174. void **unshare** **(** **)**
  175. Stops the **Range** from sharing its member variables with any other.
  176. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  177. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  178. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  179. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`