class_visibilityenabler2d.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  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.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/VisibilityEnabler2D.xml.
  6. .. _class_VisibilityEnabler2D:
  7. VisibilityEnabler2D
  8. ===================
  9. **Inherits:** :ref:`VisibilityNotifier2D<class_VisibilityNotifier2D>` **<** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. Enables certain nodes only when approximately visible.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. The VisibilityEnabler2D will disable :ref:`RigidBody2D<class_RigidBody2D>`, :ref:`AnimationPlayer<class_AnimationPlayer>`, and other nodes when they are not visible. It will only affect nodes with the same root node as the VisibilityEnabler2D, and the root node itself.
  15. If you just want to receive notifications, use :ref:`VisibilityNotifier2D<class_VisibilityNotifier2D>` instead.
  16. \ **Note:** For performance reasons, VisibilityEnabler2D uses an approximate heuristic with precision determined by :ref:`ProjectSettings.world/2d/cell_size<class_ProjectSettings_property_world/2d/cell_size>`. If you need precise visibility checking, use another method such as adding an :ref:`Area2D<class_Area2D>` node as a child of a :ref:`Camera2D<class_Camera2D>` node.
  17. \ **Note:** VisibilityEnabler2D will not affect nodes added after scene initialization.
  18. .. rst-class:: classref-reftable-group
  19. Properties
  20. ----------
  21. .. table::
  22. :widths: auto
  23. +-------------------------+------------------------------------------------------------------------------------------+-----------+
  24. | :ref:`bool<class_bool>` | :ref:`freeze_bodies<class_VisibilityEnabler2D_property_freeze_bodies>` | ``true`` |
  25. +-------------------------+------------------------------------------------------------------------------------------+-----------+
  26. | :ref:`bool<class_bool>` | :ref:`pause_animated_sprites<class_VisibilityEnabler2D_property_pause_animated_sprites>` | ``true`` |
  27. +-------------------------+------------------------------------------------------------------------------------------+-----------+
  28. | :ref:`bool<class_bool>` | :ref:`pause_animations<class_VisibilityEnabler2D_property_pause_animations>` | ``true`` |
  29. +-------------------------+------------------------------------------------------------------------------------------+-----------+
  30. | :ref:`bool<class_bool>` | :ref:`pause_particles<class_VisibilityEnabler2D_property_pause_particles>` | ``true`` |
  31. +-------------------------+------------------------------------------------------------------------------------------+-----------+
  32. | :ref:`bool<class_bool>` | :ref:`physics_process_parent<class_VisibilityEnabler2D_property_physics_process_parent>` | ``false`` |
  33. +-------------------------+------------------------------------------------------------------------------------------+-----------+
  34. | :ref:`bool<class_bool>` | :ref:`process_parent<class_VisibilityEnabler2D_property_process_parent>` | ``false`` |
  35. +-------------------------+------------------------------------------------------------------------------------------+-----------+
  36. .. rst-class:: classref-reftable-group
  37. Methods
  38. -------
  39. .. table::
  40. :widths: auto
  41. +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`bool<class_bool>` | :ref:`is_enabler_enabled<class_VisibilityEnabler2D_method_is_enabler_enabled>` **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler **)** |const| |
  43. +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | void | :ref:`set_enabler<class_VisibilityEnabler2D_method_set_enabler>` **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler, :ref:`bool<class_bool>` enabled **)** |
  45. +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. .. rst-class:: classref-section-separator
  47. ----
  48. .. rst-class:: classref-descriptions-group
  49. Enumerations
  50. ------------
  51. .. _enum_VisibilityEnabler2D_Enabler:
  52. .. rst-class:: classref-enumeration
  53. enum **Enabler**:
  54. .. _class_VisibilityEnabler2D_constant_ENABLER_PAUSE_ANIMATIONS:
  55. .. rst-class:: classref-enumeration-constant
  56. :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` **ENABLER_PAUSE_ANIMATIONS** = ``0``
  57. This enabler will pause :ref:`AnimationPlayer<class_AnimationPlayer>` nodes.
  58. .. _class_VisibilityEnabler2D_constant_ENABLER_FREEZE_BODIES:
  59. .. rst-class:: classref-enumeration-constant
  60. :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` **ENABLER_FREEZE_BODIES** = ``1``
  61. This enabler will freeze :ref:`RigidBody2D<class_RigidBody2D>` nodes.
  62. .. _class_VisibilityEnabler2D_constant_ENABLER_PAUSE_PARTICLES:
  63. .. rst-class:: classref-enumeration-constant
  64. :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` **ENABLER_PAUSE_PARTICLES** = ``2``
  65. This enabler will stop :ref:`Particles2D<class_Particles2D>` nodes.
  66. .. _class_VisibilityEnabler2D_constant_ENABLER_PARENT_PROCESS:
  67. .. rst-class:: classref-enumeration-constant
  68. :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` **ENABLER_PARENT_PROCESS** = ``3``
  69. This enabler will stop the parent's :ref:`Node._process<class_Node_method__process>` function.
  70. .. _class_VisibilityEnabler2D_constant_ENABLER_PARENT_PHYSICS_PROCESS:
  71. .. rst-class:: classref-enumeration-constant
  72. :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` **ENABLER_PARENT_PHYSICS_PROCESS** = ``4``
  73. This enabler will stop the parent's :ref:`Node._physics_process<class_Node_method__physics_process>` function.
  74. .. _class_VisibilityEnabler2D_constant_ENABLER_PAUSE_ANIMATED_SPRITES:
  75. .. rst-class:: classref-enumeration-constant
  76. :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` **ENABLER_PAUSE_ANIMATED_SPRITES** = ``5``
  77. This enabler will stop :ref:`AnimatedSprite<class_AnimatedSprite>` nodes animations.
  78. .. _class_VisibilityEnabler2D_constant_ENABLER_MAX:
  79. .. rst-class:: classref-enumeration-constant
  80. :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` **ENABLER_MAX** = ``6``
  81. Represents the size of the :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enum.
  82. .. rst-class:: classref-section-separator
  83. ----
  84. .. rst-class:: classref-descriptions-group
  85. Property Descriptions
  86. ---------------------
  87. .. _class_VisibilityEnabler2D_property_freeze_bodies:
  88. .. rst-class:: classref-property
  89. :ref:`bool<class_bool>` **freeze_bodies** = ``true``
  90. .. rst-class:: classref-property-setget
  91. - void **set_enabler** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler, :ref:`bool<class_bool>` enabled **)**
  92. - :ref:`bool<class_bool>` **is_enabler_enabled** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler **)** |const|
  93. If ``true``, :ref:`RigidBody2D<class_RigidBody2D>` nodes will be paused.
  94. .. rst-class:: classref-item-separator
  95. ----
  96. .. _class_VisibilityEnabler2D_property_pause_animated_sprites:
  97. .. rst-class:: classref-property
  98. :ref:`bool<class_bool>` **pause_animated_sprites** = ``true``
  99. .. rst-class:: classref-property-setget
  100. - void **set_enabler** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler, :ref:`bool<class_bool>` enabled **)**
  101. - :ref:`bool<class_bool>` **is_enabler_enabled** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler **)** |const|
  102. If ``true``, :ref:`AnimatedSprite<class_AnimatedSprite>` nodes will be paused.
  103. .. rst-class:: classref-item-separator
  104. ----
  105. .. _class_VisibilityEnabler2D_property_pause_animations:
  106. .. rst-class:: classref-property
  107. :ref:`bool<class_bool>` **pause_animations** = ``true``
  108. .. rst-class:: classref-property-setget
  109. - void **set_enabler** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler, :ref:`bool<class_bool>` enabled **)**
  110. - :ref:`bool<class_bool>` **is_enabler_enabled** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler **)** |const|
  111. If ``true``, :ref:`AnimationPlayer<class_AnimationPlayer>` nodes will be paused.
  112. .. rst-class:: classref-item-separator
  113. ----
  114. .. _class_VisibilityEnabler2D_property_pause_particles:
  115. .. rst-class:: classref-property
  116. :ref:`bool<class_bool>` **pause_particles** = ``true``
  117. .. rst-class:: classref-property-setget
  118. - void **set_enabler** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler, :ref:`bool<class_bool>` enabled **)**
  119. - :ref:`bool<class_bool>` **is_enabler_enabled** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler **)** |const|
  120. If ``true``, :ref:`Particles2D<class_Particles2D>` nodes will be paused.
  121. .. rst-class:: classref-item-separator
  122. ----
  123. .. _class_VisibilityEnabler2D_property_physics_process_parent:
  124. .. rst-class:: classref-property
  125. :ref:`bool<class_bool>` **physics_process_parent** = ``false``
  126. .. rst-class:: classref-property-setget
  127. - void **set_enabler** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler, :ref:`bool<class_bool>` enabled **)**
  128. - :ref:`bool<class_bool>` **is_enabler_enabled** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler **)** |const|
  129. If ``true``, the parent's :ref:`Node._physics_process<class_Node_method__physics_process>` will be stopped.
  130. .. rst-class:: classref-item-separator
  131. ----
  132. .. _class_VisibilityEnabler2D_property_process_parent:
  133. .. rst-class:: classref-property
  134. :ref:`bool<class_bool>` **process_parent** = ``false``
  135. .. rst-class:: classref-property-setget
  136. - void **set_enabler** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler, :ref:`bool<class_bool>` enabled **)**
  137. - :ref:`bool<class_bool>` **is_enabler_enabled** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler **)** |const|
  138. If ``true``, the parent's :ref:`Node._process<class_Node_method__process>` will be stopped.
  139. .. rst-class:: classref-section-separator
  140. ----
  141. .. rst-class:: classref-descriptions-group
  142. Method Descriptions
  143. -------------------
  144. .. _class_VisibilityEnabler2D_method_is_enabler_enabled:
  145. .. rst-class:: classref-method
  146. :ref:`bool<class_bool>` **is_enabler_enabled** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler **)** |const|
  147. Returns whether the enabler identified by given :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` constant is active.
  148. .. rst-class:: classref-item-separator
  149. ----
  150. .. _class_VisibilityEnabler2D_method_set_enabler:
  151. .. rst-class:: classref-method
  152. void **set_enabler** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler, :ref:`bool<class_bool>` enabled **)**
  153. Sets active state of the enabler identified by given :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` constant.
  154. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  155. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  156. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  157. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`