Include quotes conditionally for dropped paths
This commit is contained in:
parent
1d5e662766
commit
995bcd6218
1 changed files with 8 additions and 2 deletions
|
@ -1586,7 +1586,7 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < nodes.size(); i++) {
|
for (int i = 0; i < nodes.size(); i++) {
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
text_to_drop += ",";
|
text_to_drop += ", ";
|
||||||
}
|
}
|
||||||
|
|
||||||
NodePath np = nodes[i];
|
NodePath np = nodes[i];
|
||||||
|
@ -1596,7 +1596,13 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
|
||||||
}
|
}
|
||||||
|
|
||||||
String path = sn->get_path_to(node);
|
String path = sn->get_path_to(node);
|
||||||
text_to_drop += path.c_escape().quote(quote_style);
|
for (const String &segment : path.split("/")) {
|
||||||
|
if (!segment.is_valid_identifier()) {
|
||||||
|
path = path.c_escape().quote(quote_style);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
text_to_drop += "$" + path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue