diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-04-22 11:55:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-22 11:55:15 +0200 |
commit | 201cdd358a7955b81097004d22aed2414eedc41a (patch) | |
tree | 8feab9207fd858a8184925a98dc87b8d00533ad2 /scene/main/node.cpp | |
parent | 429fc5b62ce1a2069aaf7bf966d3557475c8b474 (diff) | |
parent | 04d0371648001c1fbf157156fce7f5e9581e1e02 (diff) | |
download | redot-engine-201cdd358a7955b81097004d22aed2414eedc41a.tar.gz |
Merge pull request #28140 from Daw11/orphan-nodes
Add a monitor for the orphan nodes
Diffstat (limited to 'scene/main/node.cpp')
-rw-r--r-- | scene/main/node.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp index cbe700c826..0465ffe442 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -41,6 +41,8 @@ VARIANT_ENUM_CAST(Node::PauseMode); +int Node::orphan_node_count = 0; + void Node::_notification(int p_notification) { switch (p_notification) { @@ -84,11 +86,14 @@ void Node::_notification(int p_notification) { add_to_group("_vp_unhandled_key_input" + itos(get_viewport()->get_instance_id())); get_tree()->node_count++; + orphan_node_count--; } break; case NOTIFICATION_EXIT_TREE: { get_tree()->node_count--; + orphan_node_count++; + if (data.input) remove_from_group("_vp_input" + itos(get_viewport()->get_instance_id())); if (data.unhandled_input) @@ -2938,6 +2943,8 @@ Node::Node() { data.use_placeholder = false; data.display_folded = false; data.ready_first = true; + + orphan_node_count++; } Node::~Node() { @@ -2948,6 +2955,8 @@ Node::~Node() { ERR_FAIL_COND(data.parent); ERR_FAIL_COND(data.children.size()); + + orphan_node_count--; } //////////////////////////////// |