summaryrefslogtreecommitdiff
path: root/doc/classes
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-06-16 17:26:12 +0200
committerGitHub <noreply@github.com>2021-06-16 17:26:12 +0200
commitad28a03b4bbce7ee83950e31177ab384bb54cfd8 (patch)
treed315bfef09feda5eae316aa5c785826ba7a296ca /doc/classes
parent479737538b23ff36e81e9e1f6294464bba913e31 (diff)
parent38d164c74b24f10215312f304ec1b04175989376 (diff)
Merge pull request #49632 from reduz/refactor-visibility-notifier-2d
Refactor VisibilityNotifier2D
Diffstat (limited to 'doc/classes')
-rw-r--r--doc/classes/ProjectSettings.xml3
-rw-r--r--doc/classes/VisibilityEnabler2D.xml64
-rw-r--r--doc/classes/VisibilityNotifier2D.xml17
3 files changed, 6 insertions, 78 deletions
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index 25df918522..757f0691bf 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -1616,9 +1616,6 @@
<member name="rendering/xr/enabled" type="bool" setter="" getter="" default="false">
If [code]true[/code], XR support is enabled in Godot, this ensures required shaders are compiled.
</member>
- <member name="world/2d/cell_size" type="int" setter="" getter="" default="100">
- Cell size used for the 2D hash grid that [VisibilityNotifier2D] uses (in pixels).
- </member>
</members>
<constants>
</constants>
diff --git a/doc/classes/VisibilityEnabler2D.xml b/doc/classes/VisibilityEnabler2D.xml
index 02fe7a7cd0..8eb16ba075 100644
--- a/doc/classes/VisibilityEnabler2D.xml
+++ b/doc/classes/VisibilityEnabler2D.xml
@@ -1,79 +1,25 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisibilityEnabler2D" inherits="VisibilityNotifier2D" version="4.0">
<brief_description>
- Enables certain nodes only when approximately visible.
</brief_description>
<description>
- The VisibilityEnabler2D will disable [RigidBody2D], [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 [VisibilityNotifier2D] instead.
- [b]Note:[/b] For performance reasons, VisibilityEnabler2D uses an approximate heuristic with precision determined by [member ProjectSettings.world/2d/cell_size]. If you need precise visibility checking, use another method such as adding an [Area2D] node as a child of a [Camera2D] node.
- [b]Note:[/b] VisibilityEnabler2D will not affect nodes added after scene initialization.
</description>
<tutorials>
</tutorials>
<methods>
- <method name="is_enabler_enabled" qualifiers="const">
- <return type="bool">
- </return>
- <argument index="0" name="enabler" type="int" enum="VisibilityEnabler2D.Enabler">
- </argument>
- <description>
- Returns whether the enabler identified by given [enum Enabler] constant is active.
- </description>
- </method>
- <method name="set_enabler">
- <return type="void">
- </return>
- <argument index="0" name="enabler" type="int" enum="VisibilityEnabler2D.Enabler">
- </argument>
- <argument index="1" name="enabled" type="bool">
- </argument>
- <description>
- Sets active state of the enabler identified by given [enum Enabler] constant.
- </description>
- </method>
</methods>
<members>
- <member name="freeze_bodies" type="bool" setter="set_enabler" getter="is_enabler_enabled" default="true">
- If [code]true[/code], [RigidBody2D] nodes will be paused.
+ <member name="enable_mode" type="int" setter="set_enable_mode" getter="get_enable_mode" enum="VisibilityEnabler2D.EnableMode" default="0">
</member>
- <member name="pause_animated_sprites" type="bool" setter="set_enabler" getter="is_enabler_enabled" default="true">
- If [code]true[/code], [AnimatedSprite2D] nodes will be paused.
- </member>
- <member name="pause_animations" type="bool" setter="set_enabler" getter="is_enabler_enabled" default="true">
- If [code]true[/code], [AnimationPlayer] nodes will be paused.
- </member>
- <member name="pause_particles" type="bool" setter="set_enabler" getter="is_enabler_enabled" default="true">
- If [code]true[/code], [GPUParticles2D] nodes will be paused.
- </member>
- <member name="physics_process_parent" type="bool" setter="set_enabler" getter="is_enabler_enabled" default="false">
- If [code]true[/code], the parent's [method Node._physics_process] will be stopped.
- </member>
- <member name="process_parent" type="bool" setter="set_enabler" getter="is_enabler_enabled" default="false">
- If [code]true[/code], the parent's [method Node._process] will be stopped.
+ <member name="enable_node_path" type="NodePath" setter="set_enable_node_path" getter="get_enable_node_path" default="NodePath(&quot;..&quot;)">
</member>
</members>
<constants>
- <constant name="ENABLER_PAUSE_ANIMATIONS" value="0" enum="Enabler">
- This enabler will pause [AnimationPlayer] nodes.
- </constant>
- <constant name="ENABLER_FREEZE_BODIES" value="1" enum="Enabler">
- This enabler will freeze [RigidBody2D] nodes.
- </constant>
- <constant name="ENABLER_PAUSE_PARTICLES" value="2" enum="Enabler">
- This enabler will stop [GPUParticles2D] nodes.
- </constant>
- <constant name="ENABLER_PARENT_PROCESS" value="3" enum="Enabler">
- This enabler will stop the parent's _process function.
- </constant>
- <constant name="ENABLER_PARENT_PHYSICS_PROCESS" value="4" enum="Enabler">
- This enabler will stop the parent's _physics_process function.
+ <constant name="ENABLE_MODE_INHERIT" value="0" enum="EnableMode">
</constant>
- <constant name="ENABLER_PAUSE_ANIMATED_SPRITES" value="5" enum="Enabler">
- This enabler will stop [AnimatedSprite2D] nodes animations.
+ <constant name="ENABLE_MODE_ALWAYS" value="1" enum="EnableMode">
</constant>
- <constant name="ENABLER_MAX" value="6" enum="Enabler">
- Represents the size of the [enum Enabler] enum.
+ <constant name="ENABLE_MODE_WHEN_PAUSED" value="2" enum="EnableMode">
</constant>
</constants>
</class>
diff --git a/doc/classes/VisibilityNotifier2D.xml b/doc/classes/VisibilityNotifier2D.xml
index 761438b77e..78983e74ee 100644
--- a/doc/classes/VisibilityNotifier2D.xml
+++ b/doc/classes/VisibilityNotifier2D.xml
@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisibilityNotifier2D" inherits="Node2D" version="4.0">
<brief_description>
- Detects approximately when the node is visible on screen.
+ Detects when the node extents are visible on screen.
</brief_description>
<description>
The VisibilityNotifier2D detects when it is visible on the screen. It also notifies when its bounding rectangle enters or exits the screen or a viewport.
If you want nodes to be disabled automatically when they exit the screen, use [VisibilityEnabler2D] instead.
- [b]Note:[/b] For performance reasons, VisibilityNotifier2D uses an approximate heuristic with precision determined by [member ProjectSettings.world/2d/cell_size]. If you need precise visibility checking, use another method such as adding an [Area2D] node as a child of a [Camera2D] node.
</description>
<tutorials>
<link title="2D Dodge The Creeps Demo">https://godotengine.org/asset-library/asset/515</link>
@@ -37,20 +36,6 @@
Emitted when the VisibilityNotifier2D exits the screen.
</description>
</signal>
- <signal name="viewport_entered">
- <argument index="0" name="viewport" type="Viewport">
- </argument>
- <description>
- Emitted when the VisibilityNotifier2D enters a [Viewport]'s view.
- </description>
- </signal>
- <signal name="viewport_exited">
- <argument index="0" name="viewport" type="Viewport">
- </argument>
- <description>
- Emitted when the VisibilityNotifier2D exits a [Viewport]'s view.
- </description>
- </signal>
</signals>
<constants>
</constants>