mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-24 18:17:21 +01:00
Avoid compiling Editor checks in release builds for VisibilityNotifier2D
This commit is contained in:
parent
6c85c2389b
commit
f7d04cc052
@ -53,10 +53,6 @@ void VisibilityNotifier2D::_enter_world(World *p_world) {
|
|||||||
ERR_FAIL_COND(worlds.has(p_world));
|
ERR_FAIL_COND(worlds.has(p_world));
|
||||||
worlds.insert(p_world);
|
worlds.insert(p_world);
|
||||||
|
|
||||||
if (is_inside_tree() && Engine::get_singleton()->is_editor_hint()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (worlds.size() == 1) {
|
if (worlds.size() == 1) {
|
||||||
emit_signal(SceneStringNames::get_singleton()->screen_entered);
|
emit_signal(SceneStringNames::get_singleton()->screen_entered);
|
||||||
|
|
||||||
@ -69,10 +65,6 @@ void VisibilityNotifier2D::_exit_world(World *p_world) {
|
|||||||
ERR_FAIL_COND(!worlds.has(p_world));
|
ERR_FAIL_COND(!worlds.has(p_world));
|
||||||
worlds.erase(p_world);
|
worlds.erase(p_world);
|
||||||
|
|
||||||
if (is_inside_tree() && Engine::get_singleton()->is_editor_hint()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
emit_signal(SceneStringNames::get_singleton()->viewport_exited, p_world);
|
emit_signal(SceneStringNames::get_singleton()->viewport_exited, p_world);
|
||||||
if (worlds.size() == 0) {
|
if (worlds.size() == 0) {
|
||||||
emit_signal(SceneStringNames::get_singleton()->screen_exited);
|
emit_signal(SceneStringNames::get_singleton()->screen_exited);
|
||||||
@ -84,11 +76,16 @@ void VisibilityNotifier2D::_exit_world(World *p_world) {
|
|||||||
void VisibilityNotifier2D::set_rect(const Rect2 &p_rect) {
|
void VisibilityNotifier2D::set_rect(const Rect2 &p_rect) {
|
||||||
rect = p_rect;
|
rect = p_rect;
|
||||||
if (is_inside_tree()) {
|
if (is_inside_tree()) {
|
||||||
get_world_2d()->_update_notifier(this, get_global_transform().xform(rect));
|
#ifdef TOOLS_ENABLED
|
||||||
if (Engine::get_singleton()->is_editor_hint()) {
|
if (Engine::get_singleton()->is_editor_hint()) {
|
||||||
update();
|
update();
|
||||||
item_rect_changed();
|
item_rect_changed();
|
||||||
|
} else {
|
||||||
|
get_world_2d()->_update_notifier(this, get_global_transform().xform(rect));
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
get_world_2d()->_update_notifier(this, get_global_transform().xform(rect));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
_change_notify("rect");
|
_change_notify("rect");
|
||||||
@ -101,20 +98,38 @@ Rect2 VisibilityNotifier2D::get_rect() const {
|
|||||||
void VisibilityNotifier2D::_notification(int p_what) {
|
void VisibilityNotifier2D::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
//get_world_2d()->
|
#ifdef TOOLS_ENABLED
|
||||||
|
if (!Engine::get_singleton()->is_editor_hint()) {
|
||||||
get_world_2d()->_register_notifier(this, get_global_transform().xform(rect));
|
get_world_2d()->_register_notifier(this, get_global_transform().xform(rect));
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
get_world_2d()->_register_notifier(this, get_global_transform().xform(rect));
|
||||||
|
#endif
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_TRANSFORM_CHANGED: {
|
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||||
//get_world_2d()->
|
#ifdef TOOLS_ENABLED
|
||||||
|
if (!Engine::get_singleton()->is_editor_hint()) {
|
||||||
get_world_2d()->_update_notifier(this, get_global_transform().xform(rect));
|
get_world_2d()->_update_notifier(this, get_global_transform().xform(rect));
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
get_world_2d()->_update_notifier(this, get_global_transform().xform(rect));
|
||||||
|
#endif
|
||||||
} break;
|
} break;
|
||||||
|
#ifdef TOOLS_ENABLED
|
||||||
case NOTIFICATION_DRAW: {
|
case NOTIFICATION_DRAW: {
|
||||||
if (Engine::get_singleton()->is_editor_hint()) {
|
if (Engine::get_singleton()->is_editor_hint()) {
|
||||||
draw_rect(rect, Color(1, 0.5, 1, 0.2));
|
draw_rect(rect, Color(1, 0.5, 1, 0.2));
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
#endif
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
#ifdef TOOLS_ENABLED
|
||||||
|
if (!Engine::get_singleton()->is_editor_hint()) {
|
||||||
get_world_2d()->_remove_notifier(this);
|
get_world_2d()->_remove_notifier(this);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
get_world_2d()->_remove_notifier(this);
|
||||||
|
#endif
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -217,9 +232,11 @@ void VisibilityEnabler2D::_find_nodes(Node *p_node) {
|
|||||||
|
|
||||||
void VisibilityEnabler2D::_notification(int p_what) {
|
void VisibilityEnabler2D::_notification(int p_what) {
|
||||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
if (p_what == NOTIFICATION_ENTER_TREE) {
|
||||||
|
#ifdef TOOLS_ENABLED
|
||||||
if (Engine::get_singleton()->is_editor_hint()) {
|
if (Engine::get_singleton()->is_editor_hint()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
Node *from = this;
|
Node *from = this;
|
||||||
//find where current scene starts
|
//find where current scene starts
|
||||||
@ -245,9 +262,11 @@ void VisibilityEnabler2D::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_EXIT_TREE) {
|
if (p_what == NOTIFICATION_EXIT_TREE) {
|
||||||
|
#ifdef TOOLS_ENABLED
|
||||||
if (Engine::get_singleton()->is_editor_hint()) {
|
if (Engine::get_singleton()->is_editor_hint()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
for (Map<Node *, Variant>::Element *E = nodes.front(); E; E = E->next()) {
|
for (Map<Node *, Variant>::Element *E = nodes.front(); E; E = E->next()) {
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
|
Loading…
Reference in New Issue
Block a user