From 0988970c1fca780f51ba4f2dce6afebdfef7f292 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Tue, 19 Jul 2016 21:26:12 -0300 Subject: [PATCH] Fixed properly not save signals that already exist in their base scenes, closes #5656 --- core/path_db.cpp | 6 ++++ core/path_db.h | 2 ++ platform/android/export/export.cpp | 2 +- scene/resources/packed_scene.cpp | 51 ++++++++++++--------------- scene/resources/packed_scene.h | 2 +- scene/resources/scene_format_text.cpp | 4 ++- 6 files changed, 36 insertions(+), 31 deletions(-) diff --git a/core/path_db.cpp b/core/path_db.cpp index 0956c4cd3f3..d0feda5c82a 100644 --- a/core/path_db.cpp +++ b/core/path_db.cpp @@ -53,6 +53,12 @@ uint32_t NodePath::hash() const { } +void NodePath::prepend_period() { + + if (data->path.size() && data->path[0].operator String()!=".") { + data->path.insert(0,"."); + } +} bool NodePath::is_absolute() const { diff --git a/core/path_db.h b/core/path_db.h index 63adb42955e..3a550fe1d0e 100644 --- a/core/path_db.h +++ b/core/path_db.h @@ -72,6 +72,8 @@ public: NodePath rel_path_to(const NodePath& p_np) const; + void prepend_period(); + StringName get_property() const; NodePath get_parent() const; diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 83f72927161..f4fafc4fabe 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -1573,7 +1573,7 @@ void EditorExportPlatformAndroid::_device_poll_thread(void *ud) { String dp; Error err = OS::get_singleton()->execute(adb,args,true,NULL,&dp,&ec); - print_line("RV: "+itos(ec)); + Vector props = dp.split("\n"); String vendor; String device; diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 51e5b611038..f16d68a5216 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -756,8 +756,6 @@ Error SceneState::_parse_connections(Node *p_owner,Node *p_node, Mapget_path_to(target))); - print_line("CP : "+String(p_owner->get_path_to(common_parent))); Ref ps; if (common_parent==p_owner) @@ -768,29 +766,12 @@ Error SceneState::_parse_connections(Node *p_owner,Node *p_node, Mapget_path_to(p_node); NodePath signal_to = common_parent->get_path_to(target); - int path_from = ps->find_node_by_path(signal_from); - int path_to = ps->find_node_by_path(signal_to); - int signal_name = ps->find_name(c.signal); - int method_name = ps->find_name(c.method); - - print_line("path_from "+itos(path_from)); - print_line("path_to "+itos(path_to)); - print_line("signal_name "+itos(signal_name)); - print_line("method_name "+itos(method_name)); - - if (path_from>=0 && path_to>=0 && signal_name>=0 && method_name>=0) { - //if valid - print_line("EXISTS"); - if (ps->has_connection(path_from,signal_name,path_to,method_name)) { - print_line("YES"); - exists=true; - break; - } + if (ps->has_connection(signal_from,c.signal,signal_to,c.method)) { + exists=true; + break; } } @@ -1555,17 +1536,31 @@ Array SceneState::get_connection_binds(int p_idx) const { return binds; } -bool SceneState::has_connection(int p_node_from, int p_signal, int p_node_to, int 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) const { for(int i=0;i get_editable_instances() const; diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp index 95645107d40..7bb9ca90ae8 100644 --- a/scene/resources/scene_format_text.cpp +++ b/scene/resources/scene_format_text.cpp @@ -404,7 +404,9 @@ Error ResourceInteractiveLoaderText::poll() { } if (next_tag.fields.has("parent")) { - parent=packed_scene->get_state()->add_node_path(next_tag.fields["parent"]); + NodePath np = next_tag.fields["parent"]; + np.prepend_period(); //compatible to how it manages paths internally + parent=packed_scene->get_state()->add_node_path(np); }