Revert "Add option in VisibilityEnabler2D to hide the parent for better performance"
This commit is contained in:
parent
f386252dde
commit
eaca9a17c3
3 changed files with 1 additions and 31 deletions
|
@ -47,9 +47,6 @@
|
||||||
<member name="process_parent" type="bool" setter="set_enabler" getter="is_enabler_enabled" default="false">
|
<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.
|
If [code]true[/code], the parent's [method Node._process] will be stopped.
|
||||||
</member>
|
</member>
|
||||||
<member name="visibility_parent" type="bool" setter="set_enabler" getter="is_enabler_enabled" default="true">
|
|
||||||
If [code]true[/code] and the parent is a [CanvasItem], the parent will be hidden.
|
|
||||||
</member>
|
|
||||||
</members>
|
</members>
|
||||||
<constants>
|
<constants>
|
||||||
<constant name="ENABLER_PAUSE_ANIMATIONS" value="0" enum="Enabler">
|
<constant name="ENABLER_PAUSE_ANIMATIONS" value="0" enum="Enabler">
|
||||||
|
@ -70,9 +67,7 @@
|
||||||
<constant name="ENABLER_PAUSE_ANIMATED_SPRITES" value="5" enum="Enabler">
|
<constant name="ENABLER_PAUSE_ANIMATED_SPRITES" value="5" enum="Enabler">
|
||||||
This enabler will stop [AnimatedSprite] nodes animations.
|
This enabler will stop [AnimatedSprite] nodes animations.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="ENABLER_PARENT_VISIBILITY" value="6" enum="Enabler">
|
<constant name="ENABLER_MAX" value="6" enum="Enabler">
|
||||||
</constant>
|
|
||||||
<constant name="ENABLER_MAX" value="7" enum="Enabler">
|
|
||||||
Represents the size of the [enum Enabler] enum.
|
Represents the size of the [enum Enabler] enum.
|
||||||
</constant>
|
</constant>
|
||||||
</constants>
|
</constants>
|
||||||
|
|
|
@ -168,13 +168,6 @@ void VisibilityEnabler2D::_screen_enter() {
|
||||||
if (enabler[ENABLER_PARENT_PROCESS] && get_parent()) {
|
if (enabler[ENABLER_PARENT_PROCESS] && get_parent()) {
|
||||||
get_parent()->set_process(true);
|
get_parent()->set_process(true);
|
||||||
}
|
}
|
||||||
if (enabler[ENABLER_PARENT_VISIBILITY] && get_parent()) {
|
|
||||||
CanvasItem *ci = Object::cast_to<CanvasItem>(get_parent());
|
|
||||||
|
|
||||||
if (ci) {
|
|
||||||
ci->set_visible(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
visible = true;
|
visible = true;
|
||||||
}
|
}
|
||||||
|
@ -190,13 +183,6 @@ void VisibilityEnabler2D::_screen_exit() {
|
||||||
if (enabler[ENABLER_PARENT_PROCESS] && get_parent()) {
|
if (enabler[ENABLER_PARENT_PROCESS] && get_parent()) {
|
||||||
get_parent()->set_process(false);
|
get_parent()->set_process(false);
|
||||||
}
|
}
|
||||||
if (enabler[ENABLER_PARENT_VISIBILITY] && get_parent()) {
|
|
||||||
CanvasItem *ci = Object::cast_to<CanvasItem>(get_parent());
|
|
||||||
|
|
||||||
if (ci) {
|
|
||||||
ci->set_visible(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
visible = false;
|
visible = false;
|
||||||
}
|
}
|
||||||
|
@ -279,14 +265,6 @@ void VisibilityEnabler2D::_notification(int p_what) {
|
||||||
get_parent()->connect(SceneStringNames::get_singleton()->ready,
|
get_parent()->connect(SceneStringNames::get_singleton()->ready,
|
||||||
get_parent(), "set_process", varray(false), CONNECT_REFERENCE_COUNTED);
|
get_parent(), "set_process", varray(false), CONNECT_REFERENCE_COUNTED);
|
||||||
}
|
}
|
||||||
if (enabler[ENABLER_PARENT_VISIBILITY] && get_parent()) {
|
|
||||||
CanvasItem *ci = Object::cast_to<CanvasItem>(get_parent());
|
|
||||||
|
|
||||||
if (ci) {
|
|
||||||
ci->connect(SceneStringNames::get_singleton()->ready,
|
|
||||||
ci, "set_visible", varray(false), CONNECT_REFERENCE_COUNTED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_EXIT_TREE) {
|
if (p_what == NOTIFICATION_EXIT_TREE) {
|
||||||
|
@ -377,7 +355,6 @@ void VisibilityEnabler2D::_bind_methods() {
|
||||||
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "pause_animated_sprites"), "set_enabler", "is_enabler_enabled", ENABLER_PAUSE_ANIMATED_SPRITES);
|
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "pause_animated_sprites"), "set_enabler", "is_enabler_enabled", ENABLER_PAUSE_ANIMATED_SPRITES);
|
||||||
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "process_parent"), "set_enabler", "is_enabler_enabled", ENABLER_PARENT_PROCESS);
|
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "process_parent"), "set_enabler", "is_enabler_enabled", ENABLER_PARENT_PROCESS);
|
||||||
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "physics_process_parent"), "set_enabler", "is_enabler_enabled", ENABLER_PARENT_PHYSICS_PROCESS);
|
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "physics_process_parent"), "set_enabler", "is_enabler_enabled", ENABLER_PARENT_PHYSICS_PROCESS);
|
||||||
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "visibility_parent"), "set_enabler", "is_enabler_enabled", ENABLER_PARENT_VISIBILITY);
|
|
||||||
|
|
||||||
BIND_ENUM_CONSTANT(ENABLER_PAUSE_ANIMATIONS);
|
BIND_ENUM_CONSTANT(ENABLER_PAUSE_ANIMATIONS);
|
||||||
BIND_ENUM_CONSTANT(ENABLER_FREEZE_BODIES);
|
BIND_ENUM_CONSTANT(ENABLER_FREEZE_BODIES);
|
||||||
|
@ -385,7 +362,6 @@ void VisibilityEnabler2D::_bind_methods() {
|
||||||
BIND_ENUM_CONSTANT(ENABLER_PARENT_PROCESS);
|
BIND_ENUM_CONSTANT(ENABLER_PARENT_PROCESS);
|
||||||
BIND_ENUM_CONSTANT(ENABLER_PARENT_PHYSICS_PROCESS);
|
BIND_ENUM_CONSTANT(ENABLER_PARENT_PHYSICS_PROCESS);
|
||||||
BIND_ENUM_CONSTANT(ENABLER_PAUSE_ANIMATED_SPRITES);
|
BIND_ENUM_CONSTANT(ENABLER_PAUSE_ANIMATED_SPRITES);
|
||||||
BIND_ENUM_CONSTANT(ENABLER_PARENT_VISIBILITY);
|
|
||||||
BIND_ENUM_CONSTANT(ENABLER_MAX);
|
BIND_ENUM_CONSTANT(ENABLER_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,6 @@ public:
|
||||||
ENABLER_PARENT_PROCESS,
|
ENABLER_PARENT_PROCESS,
|
||||||
ENABLER_PARENT_PHYSICS_PROCESS,
|
ENABLER_PARENT_PHYSICS_PROCESS,
|
||||||
ENABLER_PAUSE_ANIMATED_SPRITES,
|
ENABLER_PAUSE_ANIMATED_SPRITES,
|
||||||
ENABLER_PARENT_VISIBILITY,
|
|
||||||
ENABLER_MAX
|
ENABLER_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue