You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-18 14:21:41 +00:00
Use % when dropping unique scene nodes into script
This expands uppon #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 1101f6c660)
This commit is contained in:
@@ -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()) {
|
||||
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user