From db10ce3d8db0249e03ced4224b23a3c4ef5130b3 Mon Sep 17 00:00:00 2001 From: Micky Date: Sat, 6 Jan 2024 18:06:41 +0100 Subject: [PATCH] Add autocompletion for a few EditorInterface methods --- editor/editor_interface.cpp | 15 +++++++++++++++ editor/editor_interface.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/editor/editor_interface.cpp b/editor/editor_interface.cpp index af1d23a4feca..b007f6d5303b 100644 --- a/editor/editor_interface.cpp +++ b/editor/editor_interface.cpp @@ -400,6 +400,21 @@ bool EditorInterface::is_movie_maker_enabled() const { } // Base. +void EditorInterface::get_argument_options(const StringName &p_function, int p_idx, List *r_options) const { + String pf = p_function; + if (p_idx == 0) { + if (pf == "set_main_screen_editor") { + for (String E : { "\"2D\"", "\"3D\"", "\"Script\"", "\"AssetLib\"" }) { + r_options->push_back(E); + } + } else if (pf == "get_editor_viewport_3d") { + for (uint32_t i = 0; i < Node3DEditor::VIEWPORTS_COUNT; i++) { + r_options->push_back(String::num_int64(i)); + } + } + } + Object::get_argument_options(p_function, p_idx, r_options); +} void EditorInterface::_bind_methods() { ClassDB::bind_method(D_METHOD("restart_editor", "save"), &EditorInterface::restart_editor, DEFVAL(true)); diff --git a/editor/editor_interface.h b/editor/editor_interface.h index 079fc169f273..73e89ae2f243 100644 --- a/editor/editor_interface.h +++ b/editor/editor_interface.h @@ -152,6 +152,8 @@ class EditorInterface : public Object { // Base. + virtual void get_argument_options(const StringName &p_function, int p_idx, List *r_options) const override; + static void create(); static void free();