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.

(cherry picked from commit 1101f6c)
  • Loading branch information
Jummit authored and Riordan-DC committed Jan 23, 2023
1 parent 322b4de commit 2eb3bca
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 @@ -1563,7 +1563,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);
}
Vector<String> segments = path.split("/");
for (int j = 0; j < segments.size(); j++) {
if (!segments[j].is_valid_identifier()) {
Expand Down Expand Up @@ -1591,7 +1596,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);
}
Vector<String> segments = path.split("/");
for (int j = 0; j < segments.size(); j++) {
if (!segments[j].is_valid_identifier()) {
Expand Down

0 comments on commit 2eb3bca

Please sign in to comment.