Merge pull request #49121 from KoBeWi/dropreload

Add preload() to resource path when holding Ctrl
This commit is contained in:
Rémi Verschelde 2021-05-31 11:10:37 +02:00 committed by GitHub
commit a8c144f72e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -1429,11 +1429,17 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
Array files = d["files"];
String text_to_drop;
bool preload = Input::get_singleton()->is_key_pressed(KEY_CTRL);
for (int i = 0; i < files.size(); i++) {
if (i > 0) {
text_to_drop += ",";
text_to_drop += ", ";
}
if (preload) {
text_to_drop += "preload(\"" + String(files[i]).c_escape() + "\")";
} else {
text_to_drop += "\"" + String(files[i]).c_escape() + "\"";
}
text_to_drop += "\"" + String(files[i]).c_escape() + "\"";
}
te->cursor_set_line(row);