summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-05-31 11:10:37 +0200
committerGitHub <noreply@github.com>2021-05-31 11:10:37 +0200
commita8c144f72ef5aa0451a17961fa7f662680adb4b5 (patch)
tree27eb7cbb893d66776afc7dfa45ce9e91a82a4916 /editor
parent2f386ac100f6ab7577293a756ab38698e8276f28 (diff)
parent4bee21bcc4fafff2f810f9f835a39097073e0e56 (diff)
Merge pull request #49121 from KoBeWi/dropreload
Add preload() to resource path when holding Ctrl
Diffstat (limited to 'editor')
-rw-r--r--editor/plugins/script_text_editor.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 72a4bd8243..fe5d830239 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -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);