diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/control.cpp | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | scene/main/node.cpp | 18 | ||||
-rw-r--r-- | scene/resources/packed_scene.cpp | 47 | ||||
-rw-r--r-- | scene/resources/packed_scene.h | 2 | ||||
-rw-r--r-- | scene/scene_string_names.cpp | 2 | ||||
-rw-r--r-- | scene/scene_string_names.h | 2 |
6 files changed, 45 insertions, 32 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 7779391bae..a8e364a4cd 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -692,7 +692,7 @@ Size2 Control::get_minimum_size() const { if (si) { Variant::CallError ce; - Variant s = si->call(SceneStringNames::get_singleton()->get_minimum_size, NULL, 0, ce); + Variant s = si->call(SceneStringNames::get_singleton()->_get_minimum_size, NULL, 0, ce); if (ce.error == Variant::CallError::CALL_OK) return s; } @@ -2419,7 +2419,7 @@ void Control::_bind_methods() { ClassDB::bind_method(D_METHOD("_font_changed"), &Control::_font_changed); BIND_VMETHOD(MethodInfo("_gui_input", PropertyInfo(Variant::INPUT_EVENT, "event"))); - BIND_VMETHOD(MethodInfo(Variant::VECTOR2, "get_minimum_size")); + BIND_VMETHOD(MethodInfo(Variant::VECTOR2, "_get_minimum_size")); BIND_VMETHOD(MethodInfo(Variant::OBJECT, "get_drag_data", PropertyInfo(Variant::VECTOR2, "pos"))); BIND_VMETHOD(MethodInfo(Variant::BOOL, "can_drop_data", PropertyInfo(Variant::VECTOR2, "pos"), PropertyInfo(Variant::NIL, "data"))); BIND_VMETHOD(MethodInfo("drop_data", PropertyInfo(Variant::VECTOR2, "pos"), PropertyInfo(Variant::NIL, "data"))); @@ -2514,6 +2514,8 @@ void Control::_bind_methods() { ADD_SIGNAL(MethodInfo("size_flags_changed")); ADD_SIGNAL(MethodInfo("minimum_size_changed")); ADD_SIGNAL(MethodInfo("modal_closed")); + + BIND_VMETHOD(MethodInfo("has_point", PropertyInfo(Variant::VECTOR2, "point"))); } Control::Control() { diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 0245944154..c13ed232a7 100644..100755 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1719,6 +1719,9 @@ void Node::get_owned_by(Node *p_by, List<Node *> *p_owned) { void Node::_set_owner_nocheck(Node *p_owner) { + if (data.owner == p_owner) + return; + ERR_FAIL_COND(data.owner); data.owner = p_owner; data.owner->data.owned.push_back(this); @@ -2020,12 +2023,13 @@ void Node::remove_and_skip() { bool clear = true; for (int i = 0; i < data.children.size(); i++) { - if (!data.children[i]->get_owner()) + Node *c_node = data.children[i]; + if (!c_node->get_owner()) continue; - remove_child(data.children[i]); - data.children[i]->_propagate_replace_owner(this, NULL); - children.push_back(data.children[i]); + remove_child(c_node); + c_node->_propagate_replace_owner(this, NULL); + children.push_back(c_node); clear = false; break; } @@ -2036,9 +2040,9 @@ void Node::remove_and_skip() { while (!children.empty()) { - Node *c = children.front()->get(); - data.parent->add_child(c); - c->_propagate_replace_owner(NULL, new_owner); + Node *c_node = children.front()->get(); + data.parent->add_child(c_node); + c_node->_propagate_replace_owner(NULL, new_owner); children.pop_front(); } diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index e46d9db7bc..76c6543a2f 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -1516,34 +1516,41 @@ Array SceneState::get_connection_binds(int p_idx) const { return binds; } -bool SceneState::has_connection(const NodePath &p_node_from, const StringName &p_signal, const NodePath &p_node_to, const StringName &p_method) const { +bool SceneState::has_connection(const NodePath &p_node_from, const StringName &p_signal, const NodePath &p_node_to, const StringName &p_method) { - for (int i = 0; i < connections.size(); i++) { - const ConnectionData &c = connections[i]; + // this method cannot be const because of this + Ref<SceneState> ss = this; - NodePath np_from; + do { + for (int i = 0; i < ss->connections.size(); i++) { + const ConnectionData &c = ss->connections[i]; - if (c.from & FLAG_ID_IS_PATH) { - np_from = node_paths[c.from & FLAG_MASK]; - } else { - np_from = get_node_path(c.from); - } + NodePath np_from; - NodePath np_to; + if (c.from & FLAG_ID_IS_PATH) { + np_from = ss->node_paths[c.from & FLAG_MASK]; + } else { + np_from = ss->get_node_path(c.from); + } - if (c.to & FLAG_ID_IS_PATH) { - np_to = node_paths[c.to & FLAG_MASK]; - } else { - np_to = get_node_path(c.to); - } + NodePath np_to; - StringName sn_signal = names[c.signal]; - StringName sn_method = names[c.method]; + if (c.to & FLAG_ID_IS_PATH) { + np_to = ss->node_paths[c.to & FLAG_MASK]; + } else { + np_to = ss->get_node_path(c.to); + } - if (np_from == p_node_from && sn_signal == p_signal && np_to == p_node_to && sn_method == p_method) { - return true; + StringName sn_signal = ss->names[c.signal]; + StringName sn_method = ss->names[c.method]; + + if (np_from == p_node_from && sn_signal == p_signal && np_to == p_node_to && sn_method == p_method) { + return true; + } } - } + + ss = ss->_get_base_scene_state(); + } while (ss.is_valid()); return false; } diff --git a/scene/resources/packed_scene.h b/scene/resources/packed_scene.h index b0e89205cb..fe451884f5 100644 --- a/scene/resources/packed_scene.h +++ b/scene/resources/packed_scene.h @@ -163,7 +163,7 @@ public: int get_connection_flags(int p_idx) const; Array get_connection_binds(int p_idx) const; - bool has_connection(const NodePath &p_node_from, const StringName &p_signal, const NodePath &p_node_to, const StringName &p_method) const; + bool has_connection(const NodePath &p_node_from, const StringName &p_signal, const NodePath &p_node_to, const StringName &p_method); Vector<NodePath> get_editable_instances() const; diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp index ae939ead5f..f0a33e0d3b 100644 --- a/scene/scene_string_names.cpp +++ b/scene/scene_string_names.cpp @@ -145,7 +145,7 @@ SceneStringNames::SceneStringNames() { _update_remote = StaticCString::create("_update_remote"); _update_pairs = StaticCString::create("_update_pairs"); - get_minimum_size = StaticCString::create("get_minimum_size"); + _get_minimum_size = StaticCString::create("_get_minimum_size"); area_entered = StaticCString::create("area_entered"); area_exited = StaticCString::create("area_exited"); diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h index e16e1e04e6..8900bbe1d9 100644 --- a/scene/scene_string_names.h +++ b/scene/scene_string_names.h @@ -167,7 +167,7 @@ public: StringName area_entered; StringName area_exited; - StringName get_minimum_size; + StringName _get_minimum_size; StringName play_play; |