1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Add preload() to resource path when holding Ctrl

(cherry picked from commit 4bee21bcc4)
This commit is contained in:
kobewi
2021-05-27 00:29:36 +02:00
committed by Rémi Verschelde
parent 0d7130f37c
commit f7cfdfb1cc

View File

@@ -31,6 +31,7 @@
#include "script_text_editor.h"
#include "core/math/expression.h"
#include "core/os/input.h"
#include "core/os/keyboard.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
@@ -1506,12 +1507,18 @@ 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_CONTROL);
for (int i = 0; i < files.size(); i++) {
if (i > 0) {
text_to_drop += ", ";
}
if (preload) {
text_to_drop += "preload(\"" + String(files[i]).c_escape() + "\")";
} else {
text_to_drop += "\"" + String(files[i]).c_escape() + "\"";
}
}
te->cursor_set_line(row);
te->cursor_set_column(col);