Browse Source

Merge pull request #61148 from Jummit/drop-unique-nodes

Rémi Verschelde 3 years ago
parent
commit
e7868626fa
1 changed files with 12 additions and 2 deletions
  1. 12 2
      editor/plugins/script_text_editor.cpp

+ 12 - 2
editor/plugins/script_text_editor.cpp

@@ -1568,7 +1568,12 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
 					continue;
 					continue;
 				}
 				}
 
 
-				String path = sn->get_path_to(node);
+				String path;
+				if (node->is_unique_name_in_owner()) {
+					path = "%" + node->get_name();
+				} else {
+					path = sn->get_path_to(node);
+				}
 				for (const String &segment : path.split("/")) {
 				for (const String &segment : path.split("/")) {
 					if (!segment.is_valid_identifier()) {
 					if (!segment.is_valid_identifier()) {
 						path = path.c_escape().quote(quote_style);
 						path = path.c_escape().quote(quote_style);
@@ -1595,7 +1600,12 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
 					continue;
 					continue;
 				}
 				}
 
 
-				String path = sn->get_path_to(node);
+				String path;
+				if (node->is_unique_name_in_owner()) {
+					path = "%" + node->get_name();
+				} else {
+					path = sn->get_path_to(node);
+				}
 				for (const String &segment : path.split("/")) {
 				for (const String &segment : path.split("/")) {
 					if (!segment.is_valid_identifier()) {
 					if (!segment.is_valid_identifier()) {
 						path = path.c_escape().quote(quote_style);
 						path = path.c_escape().quote(quote_style);