summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-08-13 21:13:54 +0200
committerGitHub <noreply@github.com>2021-08-13 21:13:54 +0200
commit4c3ece8c4bdb6d4927e69dce1c9b716ebc93d4ee (patch)
tree0b60e49c8e6b1e2f68401a1be28262afb61fe98c /editor/plugins
parent7ab604b677c0bb4f5b06d661fbed07cc2faffc00 (diff)
parentdae51cc6b305be3aa2ead6a0cc72907ba8f557a1 (diff)
Merge pull request #51628 from timothyqiu/drag-property-path
Allow dropping property path into script editor
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/script_text_editor.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 8cd746304c..e06e6eefff 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -1390,6 +1390,7 @@ bool ScriptTextEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_
if (d.has("type") && (String(d["type"]) == "resource" ||
String(d["type"]) == "files" ||
String(d["type"]) == "nodes" ||
+ String(d["type"]) == "obj_property" ||
String(d["type"]) == "files_and_dirs")) {
return true;
}
@@ -1495,6 +1496,15 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
te->set_caret_column(col);
te->insert_text_at_caret(text_to_drop);
}
+
+ if (d.has("type") && String(d["type"]) == "obj_property") {
+ const String quote_style = EDITOR_DEF("text_editor/completion/use_single_quotes", false) ? "'" : "\"";
+ const String text_to_drop = String(d["property"]).c_escape().quote(quote_style);
+
+ te->set_caret_line(row);
+ te->set_caret_column(col);
+ te->insert_text_at_caret(text_to_drop);
+ }
}
void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {