Skip to content

Commit

Permalink
Use % when dropping unique scene nodes into script
Browse files Browse the repository at this point in the history
This expands uppon godotengine#60708, using `get_node("%NodeName")` for nodes that
have a unique scene name to avoid having to change the onready
statements when the paths of the nodes change.
  • Loading branch information
Jummit committed May 18, 2022
1 parent 5631b59 commit 1101f6c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions editor/plugins/script_text_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1568,7 +1568,12 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
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("/")) {
if (!segment.is_valid_identifier()) {
path = path.c_escape().quote(quote_style);
Expand All @@ -1595,7 +1600,12 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
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("/")) {
if (!segment.is_valid_identifier()) {
path = path.c_escape().quote(quote_style);
Expand Down

0 comments on commit 1101f6c

Please sign in to comment.