123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276 |
- :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/VisibilityEnabler2D.xml.
- .. _class_VisibilityEnabler2D:
- VisibilityEnabler2D
- ===================
- **Inherits:** :ref:`VisibilityNotifier2D<class_VisibilityNotifier2D>` **<** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
- Enables certain nodes only when approximately visible.
- .. rst-class:: classref-introduction-group
- Description
- -----------
- 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.
- If you just want to receive notifications, use :ref:`VisibilityNotifier2D<class_VisibilityNotifier2D>` instead.
- \ **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.
- \ **Note:** VisibilityEnabler2D will not affect nodes added after scene initialization.
- .. rst-class:: classref-reftable-group
- Properties
- ----------
- .. table::
- :widths: auto
- +-------------------------+------------------------------------------------------------------------------------------+-----------+
- | :ref:`bool<class_bool>` | :ref:`freeze_bodies<class_VisibilityEnabler2D_property_freeze_bodies>` | ``true`` |
- +-------------------------+------------------------------------------------------------------------------------------+-----------+
- | :ref:`bool<class_bool>` | :ref:`pause_animated_sprites<class_VisibilityEnabler2D_property_pause_animated_sprites>` | ``true`` |
- +-------------------------+------------------------------------------------------------------------------------------+-----------+
- | :ref:`bool<class_bool>` | :ref:`pause_animations<class_VisibilityEnabler2D_property_pause_animations>` | ``true`` |
- +-------------------------+------------------------------------------------------------------------------------------+-----------+
- | :ref:`bool<class_bool>` | :ref:`pause_particles<class_VisibilityEnabler2D_property_pause_particles>` | ``true`` |
- +-------------------------+------------------------------------------------------------------------------------------+-----------+
- | :ref:`bool<class_bool>` | :ref:`physics_process_parent<class_VisibilityEnabler2D_property_physics_process_parent>` | ``false`` |
- +-------------------------+------------------------------------------------------------------------------------------+-----------+
- | :ref:`bool<class_bool>` | :ref:`process_parent<class_VisibilityEnabler2D_property_process_parent>` | ``false`` |
- +-------------------------+------------------------------------------------------------------------------------------+-----------+
- .. rst-class:: classref-reftable-group
- Methods
- -------
- .. table::
- :widths: auto
- +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_enabler_enabled<class_VisibilityEnabler2D_method_is_enabler_enabled>` **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler **)** |const| |
- +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_enabler<class_VisibilityEnabler2D_method_set_enabler>` **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler, :ref:`bool<class_bool>` enabled **)** |
- +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Enumerations
- ------------
- .. _enum_VisibilityEnabler2D_Enabler:
- .. rst-class:: classref-enumeration
- enum **Enabler**:
- .. _class_VisibilityEnabler2D_constant_ENABLER_PAUSE_ANIMATIONS:
- .. rst-class:: classref-enumeration-constant
- :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` **ENABLER_PAUSE_ANIMATIONS** = ``0``
- This enabler will pause :ref:`AnimationPlayer<class_AnimationPlayer>` nodes.
- .. _class_VisibilityEnabler2D_constant_ENABLER_FREEZE_BODIES:
- .. rst-class:: classref-enumeration-constant
- :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` **ENABLER_FREEZE_BODIES** = ``1``
- This enabler will freeze :ref:`RigidBody2D<class_RigidBody2D>` nodes.
- .. _class_VisibilityEnabler2D_constant_ENABLER_PAUSE_PARTICLES:
- .. rst-class:: classref-enumeration-constant
- :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` **ENABLER_PAUSE_PARTICLES** = ``2``
- This enabler will stop :ref:`Particles2D<class_Particles2D>` nodes.
- .. _class_VisibilityEnabler2D_constant_ENABLER_PARENT_PROCESS:
- .. rst-class:: classref-enumeration-constant
- :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` **ENABLER_PARENT_PROCESS** = ``3``
- This enabler will stop the parent's :ref:`Node._process<class_Node_method__process>` function.
- .. _class_VisibilityEnabler2D_constant_ENABLER_PARENT_PHYSICS_PROCESS:
- .. rst-class:: classref-enumeration-constant
- :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` **ENABLER_PARENT_PHYSICS_PROCESS** = ``4``
- This enabler will stop the parent's :ref:`Node._physics_process<class_Node_method__physics_process>` function.
- .. _class_VisibilityEnabler2D_constant_ENABLER_PAUSE_ANIMATED_SPRITES:
- .. rst-class:: classref-enumeration-constant
- :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` **ENABLER_PAUSE_ANIMATED_SPRITES** = ``5``
- This enabler will stop :ref:`AnimatedSprite<class_AnimatedSprite>` nodes animations.
- .. _class_VisibilityEnabler2D_constant_ENABLER_MAX:
- .. rst-class:: classref-enumeration-constant
- :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` **ENABLER_MAX** = ``6``
- Represents the size of the :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enum.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Property Descriptions
- ---------------------
- .. _class_VisibilityEnabler2D_property_freeze_bodies:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **freeze_bodies** = ``true``
- .. rst-class:: classref-property-setget
- - void **set_enabler** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler, :ref:`bool<class_bool>` enabled **)**
- - :ref:`bool<class_bool>` **is_enabler_enabled** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler **)** |const|
- If ``true``, :ref:`RigidBody2D<class_RigidBody2D>` nodes will be paused.
- .. rst-class:: classref-item-separator
- ----
- .. _class_VisibilityEnabler2D_property_pause_animated_sprites:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **pause_animated_sprites** = ``true``
- .. rst-class:: classref-property-setget
- - void **set_enabler** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler, :ref:`bool<class_bool>` enabled **)**
- - :ref:`bool<class_bool>` **is_enabler_enabled** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler **)** |const|
- If ``true``, :ref:`AnimatedSprite<class_AnimatedSprite>` nodes will be paused.
- .. rst-class:: classref-item-separator
- ----
- .. _class_VisibilityEnabler2D_property_pause_animations:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **pause_animations** = ``true``
- .. rst-class:: classref-property-setget
- - void **set_enabler** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler, :ref:`bool<class_bool>` enabled **)**
- - :ref:`bool<class_bool>` **is_enabler_enabled** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler **)** |const|
- If ``true``, :ref:`AnimationPlayer<class_AnimationPlayer>` nodes will be paused.
- .. rst-class:: classref-item-separator
- ----
- .. _class_VisibilityEnabler2D_property_pause_particles:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **pause_particles** = ``true``
- .. rst-class:: classref-property-setget
- - void **set_enabler** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler, :ref:`bool<class_bool>` enabled **)**
- - :ref:`bool<class_bool>` **is_enabler_enabled** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler **)** |const|
- If ``true``, :ref:`Particles2D<class_Particles2D>` nodes will be paused.
- .. rst-class:: classref-item-separator
- ----
- .. _class_VisibilityEnabler2D_property_physics_process_parent:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **physics_process_parent** = ``false``
- .. rst-class:: classref-property-setget
- - void **set_enabler** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler, :ref:`bool<class_bool>` enabled **)**
- - :ref:`bool<class_bool>` **is_enabler_enabled** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler **)** |const|
- If ``true``, the parent's :ref:`Node._physics_process<class_Node_method__physics_process>` will be stopped.
- .. rst-class:: classref-item-separator
- ----
- .. _class_VisibilityEnabler2D_property_process_parent:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **process_parent** = ``false``
- .. rst-class:: classref-property-setget
- - void **set_enabler** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler, :ref:`bool<class_bool>` enabled **)**
- - :ref:`bool<class_bool>` **is_enabler_enabled** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler **)** |const|
- If ``true``, the parent's :ref:`Node._process<class_Node_method__process>` will be stopped.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Method Descriptions
- -------------------
- .. _class_VisibilityEnabler2D_method_is_enabler_enabled:
- .. rst-class:: classref-method
- :ref:`bool<class_bool>` **is_enabler_enabled** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler **)** |const|
- Returns whether the enabler identified by given :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` constant is active.
- .. rst-class:: classref-item-separator
- ----
- .. _class_VisibilityEnabler2D_method_set_enabler:
- .. rst-class:: classref-method
- void **set_enabler** **(** :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` enabler, :ref:`bool<class_bool>` enabled **)**
- Sets active state of the enabler identified by given :ref:`Enabler<enum_VisibilityEnabler2D_Enabler>` constant.
- .. |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.)`
|