2023-01-05 12:25:55 +00:00
|
|
|
/**************************************************************************/
|
|
|
|
/* editor_plugin.h */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
|
|
|
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/**************************************************************************/
|
2018-01-04 23:50:27 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
#ifndef EDITOR_PLUGIN_H
|
|
|
|
#define EDITOR_PLUGIN_H
|
|
|
|
|
2018-09-11 16:13:45 +00:00
|
|
|
#include "core/io/config_file.h"
|
2021-08-22 01:52:44 +00:00
|
|
|
#include "scene/3d/camera_3d.h"
|
2022-11-11 19:12:48 +00:00
|
|
|
#include "scene/gui/control.h"
|
2022-01-28 14:06:54 +00:00
|
|
|
|
2020-03-26 21:49:16 +00:00
|
|
|
class Node3D;
|
2022-11-11 19:12:48 +00:00
|
|
|
class Button;
|
|
|
|
class PopupMenu;
|
2021-05-29 13:28:16 +00:00
|
|
|
class EditorCommandPalette;
|
2022-10-03 13:21:25 +00:00
|
|
|
class EditorDebuggerPlugin;
|
2017-02-20 02:19:30 +00:00
|
|
|
class EditorExport;
|
2016-02-28 02:10:44 +00:00
|
|
|
class EditorExportPlugin;
|
2022-11-11 19:12:48 +00:00
|
|
|
class EditorFileSystem;
|
|
|
|
class EditorImportPlugin;
|
|
|
|
class EditorInspector;
|
|
|
|
class EditorInspectorPlugin;
|
2020-03-26 21:49:16 +00:00
|
|
|
class EditorNode3DGizmoPlugin;
|
2022-11-11 19:12:48 +00:00
|
|
|
class EditorPaths;
|
2016-09-10 18:32:17 +00:00
|
|
|
class EditorResourcePreview;
|
2022-11-11 19:12:48 +00:00
|
|
|
class EditorSceneFormatImporter;
|
|
|
|
class EditorScenePostImportPlugin;
|
|
|
|
class EditorSelection;
|
|
|
|
class EditorSettings;
|
2017-07-06 07:18:20 +00:00
|
|
|
class EditorToolAddons;
|
2022-11-11 19:12:48 +00:00
|
|
|
class EditorTranslationParserPlugin;
|
|
|
|
class EditorUndoRedoManager;
|
2020-03-17 00:40:15 +00:00
|
|
|
class FileSystemDock;
|
2022-11-11 19:12:48 +00:00
|
|
|
class ScriptCreateDialog;
|
2017-07-06 07:18:20 +00:00
|
|
|
class ScriptEditor;
|
2022-11-11 19:12:48 +00:00
|
|
|
class VBoxContainer;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-08-26 13:32:15 +00:00
|
|
|
class EditorInterface : public Node {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(EditorInterface, Node);
|
|
|
|
|
2017-08-26 13:32:15 +00:00
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
static EditorInterface *singleton;
|
|
|
|
|
2022-08-31 17:24:04 +00:00
|
|
|
TypedArray<Texture2D> _make_mesh_previews(const TypedArray<Mesh> &p_meshes, int p_preview_size);
|
2017-08-28 03:03:34 +00:00
|
|
|
|
2017-08-26 13:32:15 +00:00
|
|
|
public:
|
|
|
|
static EditorInterface *get_singleton() { return singleton; }
|
|
|
|
|
2022-09-06 23:30:54 +00:00
|
|
|
VBoxContainer *get_editor_main_screen();
|
2017-08-26 13:32:15 +00:00
|
|
|
void edit_resource(const Ref<Resource> &p_resource);
|
2021-04-07 20:08:41 +00:00
|
|
|
void edit_node(Node *p_node);
|
2021-12-07 20:00:26 +00:00
|
|
|
void edit_script(const Ref<Script> &p_script, int p_line = -1, int p_col = 0, bool p_grab_focus = true);
|
2017-08-26 13:32:15 +00:00
|
|
|
void open_scene_from_path(const String &scene_path);
|
|
|
|
void reload_scene_from_path(const String &scene_path);
|
|
|
|
|
2020-04-05 14:19:24 +00:00
|
|
|
void play_main_scene();
|
|
|
|
void play_current_scene();
|
|
|
|
void play_custom_scene(const String &scene_path);
|
|
|
|
void stop_playing_scene();
|
|
|
|
bool is_playing_scene() const;
|
|
|
|
String get_playing_scene() const;
|
|
|
|
|
2017-08-26 13:32:15 +00:00
|
|
|
Node *get_edited_scene_root();
|
2022-08-05 01:41:48 +00:00
|
|
|
PackedStringArray get_open_scenes() const;
|
2017-08-26 13:32:15 +00:00
|
|
|
ScriptEditor *get_script_editor();
|
|
|
|
|
2021-05-29 13:28:16 +00:00
|
|
|
EditorCommandPalette *get_command_palette() const;
|
|
|
|
|
2017-12-20 20:44:16 +00:00
|
|
|
void select_file(const String &p_file);
|
2022-05-10 20:25:36 +00:00
|
|
|
Vector<String> get_selected_paths() const;
|
2019-09-01 05:51:33 +00:00
|
|
|
String get_current_path() const;
|
2022-05-10 20:25:36 +00:00
|
|
|
String get_current_directory() const;
|
2017-12-20 20:44:16 +00:00
|
|
|
|
2020-09-16 19:27:19 +00:00
|
|
|
void inspect_object(Object *p_obj, const String &p_for_property = String(), bool p_inspector_only = false);
|
2017-08-26 13:32:15 +00:00
|
|
|
|
|
|
|
EditorSelection *get_selection();
|
|
|
|
//EditorImportExport *get_import_export();
|
2019-07-03 07:49:46 +00:00
|
|
|
Ref<EditorSettings> get_editor_settings();
|
2021-05-25 00:25:11 +00:00
|
|
|
EditorPaths *get_editor_paths();
|
2017-08-26 13:32:15 +00:00
|
|
|
EditorResourcePreview *get_resource_previewer();
|
|
|
|
EditorFileSystem *get_resource_file_system();
|
|
|
|
|
2020-03-17 00:40:15 +00:00
|
|
|
FileSystemDock *get_file_system_dock();
|
|
|
|
|
2017-08-26 13:32:15 +00:00
|
|
|
Control *get_base_control();
|
2021-04-04 14:08:25 +00:00
|
|
|
float get_editor_scale() const;
|
2017-08-26 13:32:15 +00:00
|
|
|
|
2018-01-30 22:11:07 +00:00
|
|
|
void set_plugin_enabled(const String &p_plugin, bool p_enabled);
|
|
|
|
bool is_plugin_enabled(const String &p_plugin) const;
|
|
|
|
|
2022-06-26 00:23:59 +00:00
|
|
|
void set_movie_maker_enabled(bool p_enabled);
|
|
|
|
bool is_movie_maker_enabled() const;
|
|
|
|
|
2019-03-12 06:43:48 +00:00
|
|
|
EditorInspector *get_inspector() const;
|
|
|
|
|
2017-08-26 13:32:15 +00:00
|
|
|
Error save_scene();
|
|
|
|
void save_scene_as(const String &p_scene, bool p_with_preview = true);
|
2022-08-18 23:46:31 +00:00
|
|
|
void restart_editor(bool p_save = true);
|
2017-08-26 13:32:15 +00:00
|
|
|
|
2020-10-17 05:08:21 +00:00
|
|
|
Vector<Ref<Texture2D>> make_mesh_previews(const Vector<Ref<Mesh>> &p_meshes, Vector<Transform3D> *p_transforms, int p_preview_size);
|
2017-08-28 03:03:34 +00:00
|
|
|
|
2019-08-05 17:57:23 +00:00
|
|
|
void set_main_screen_editor(const String &p_name);
|
|
|
|
void set_distraction_free_mode(bool p_enter);
|
2020-05-31 17:58:15 +00:00
|
|
|
bool is_distraction_free_mode_enabled() const;
|
2019-08-05 17:57:23 +00:00
|
|
|
|
2017-08-26 13:32:15 +00:00
|
|
|
EditorInterface();
|
|
|
|
};
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
class EditorPlugin : public Node {
|
2017-03-05 15:44:50 +00:00
|
|
|
GDCLASS(EditorPlugin, Node);
|
|
|
|
friend class EditorData;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2020-05-12 15:01:17 +00:00
|
|
|
bool input_event_forwarding_always_enabled = false;
|
|
|
|
bool force_draw_over_forwarding_enabled = false;
|
2017-06-08 17:57:35 +00:00
|
|
|
|
2017-07-06 07:18:20 +00:00
|
|
|
String last_main_screen_name;
|
|
|
|
|
2021-02-13 14:06:56 +00:00
|
|
|
void _editor_project_settings_changed();
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
protected:
|
2021-02-13 14:06:56 +00:00
|
|
|
void _notification(int p_what);
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
static void _bind_methods();
|
2022-03-25 17:06:46 +00:00
|
|
|
Ref<EditorUndoRedoManager> get_undo_redo();
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2019-06-11 18:43:37 +00:00
|
|
|
void add_custom_type(const String &p_type, const String &p_base, const Ref<Script> &p_script, const Ref<Texture2D> &p_icon);
|
2017-03-05 15:44:50 +00:00
|
|
|
void remove_custom_type(const String &p_type);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2021-08-22 01:52:44 +00:00
|
|
|
GDVIRTUAL1R(bool, _forward_canvas_gui_input, Ref<InputEvent>)
|
|
|
|
GDVIRTUAL1(_forward_canvas_draw_over_viewport, Control *)
|
|
|
|
GDVIRTUAL1(_forward_canvas_force_draw_over_viewport, Control *)
|
2021-02-04 08:20:26 +00:00
|
|
|
GDVIRTUAL2R(int, _forward_3d_gui_input, Camera3D *, Ref<InputEvent>)
|
2021-08-22 01:52:44 +00:00
|
|
|
GDVIRTUAL1(_forward_3d_draw_over_viewport, Control *)
|
|
|
|
GDVIRTUAL1(_forward_3d_force_draw_over_viewport, Control *)
|
|
|
|
GDVIRTUAL0RC(String, _get_plugin_name)
|
|
|
|
GDVIRTUAL0RC(Ref<Texture2D>, _get_plugin_icon)
|
|
|
|
GDVIRTUAL0RC(bool, _has_main_screen)
|
|
|
|
GDVIRTUAL1(_make_visible, bool)
|
|
|
|
GDVIRTUAL1(_edit, Variant)
|
|
|
|
GDVIRTUAL1RC(bool, _handles, Variant)
|
|
|
|
GDVIRTUAL0RC(Dictionary, _get_state)
|
|
|
|
GDVIRTUAL1(_set_state, Dictionary)
|
|
|
|
GDVIRTUAL0(_clear)
|
|
|
|
GDVIRTUAL0(_save_external_data)
|
|
|
|
GDVIRTUAL0(_apply_changes)
|
|
|
|
GDVIRTUAL0RC(Vector<String>, _get_breakpoints)
|
|
|
|
GDVIRTUAL1(_set_window_layout, Ref<ConfigFile>)
|
|
|
|
GDVIRTUAL1(_get_window_layout, Ref<ConfigFile>)
|
|
|
|
GDVIRTUAL0R(bool, _build)
|
|
|
|
GDVIRTUAL0(_enable_plugin)
|
|
|
|
GDVIRTUAL0(_disable_plugin)
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
public:
|
|
|
|
enum CustomControlContainer {
|
|
|
|
CONTAINER_TOOLBAR,
|
|
|
|
CONTAINER_SPATIAL_EDITOR_MENU,
|
2018-08-21 04:35:48 +00:00
|
|
|
CONTAINER_SPATIAL_EDITOR_SIDE_LEFT,
|
|
|
|
CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT,
|
2014-02-10 01:10:30 +00:00
|
|
|
CONTAINER_SPATIAL_EDITOR_BOTTOM,
|
|
|
|
CONTAINER_CANVAS_EDITOR_MENU,
|
2018-08-21 04:35:48 +00:00
|
|
|
CONTAINER_CANVAS_EDITOR_SIDE_LEFT,
|
|
|
|
CONTAINER_CANVAS_EDITOR_SIDE_RIGHT,
|
2016-05-23 20:10:26 +00:00
|
|
|
CONTAINER_CANVAS_EDITOR_BOTTOM,
|
2022-08-13 10:56:52 +00:00
|
|
|
CONTAINER_INSPECTOR_BOTTOM,
|
2019-05-27 20:33:52 +00:00
|
|
|
CONTAINER_PROJECT_SETTING_TAB_LEFT,
|
|
|
|
CONTAINER_PROJECT_SETTING_TAB_RIGHT,
|
2014-02-10 01:10:30 +00:00
|
|
|
};
|
|
|
|
|
2016-02-28 02:10:44 +00:00
|
|
|
enum DockSlot {
|
|
|
|
DOCK_SLOT_LEFT_UL,
|
|
|
|
DOCK_SLOT_LEFT_BL,
|
|
|
|
DOCK_SLOT_LEFT_UR,
|
|
|
|
DOCK_SLOT_LEFT_BR,
|
|
|
|
DOCK_SLOT_RIGHT_UL,
|
|
|
|
DOCK_SLOT_RIGHT_BL,
|
|
|
|
DOCK_SLOT_RIGHT_UR,
|
|
|
|
DOCK_SLOT_RIGHT_BR,
|
|
|
|
DOCK_SLOT_MAX
|
|
|
|
};
|
|
|
|
|
2021-02-04 08:20:26 +00:00
|
|
|
enum AfterGUIInput {
|
|
|
|
AFTER_GUI_INPUT_PASS,
|
|
|
|
AFTER_GUI_INPUT_STOP,
|
2022-08-15 18:04:17 +00:00
|
|
|
AFTER_GUI_INPUT_CUSTOM
|
2021-02-04 08:20:26 +00:00
|
|
|
};
|
|
|
|
|
2017-08-08 05:02:49 +00:00
|
|
|
//TODO: send a resource for editing to the editor node?
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2016-02-27 03:32:00 +00:00
|
|
|
void add_control_to_container(CustomControlContainer p_location, Control *p_control);
|
2018-02-13 21:21:19 +00:00
|
|
|
void remove_control_from_container(CustomControlContainer p_location, Control *p_control);
|
2020-06-19 18:49:04 +00:00
|
|
|
Button *add_control_to_bottom_panel(Control *p_control, const String &p_title);
|
2017-03-05 15:44:50 +00:00
|
|
|
void add_control_to_dock(DockSlot p_slot, Control *p_control);
|
2016-02-28 02:10:44 +00:00
|
|
|
void remove_control_from_docks(Control *p_control);
|
2016-02-28 19:58:17 +00:00
|
|
|
void remove_control_from_bottom_panel(Control *p_control);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2020-12-15 23:04:21 +00:00
|
|
|
void add_tool_menu_item(const String &p_name, const Callable &p_callable);
|
2022-01-28 14:06:54 +00:00
|
|
|
void add_tool_submenu_item(const String &p_name, PopupMenu *p_submenu);
|
2017-03-05 15:44:50 +00:00
|
|
|
void remove_tool_menu_item(const String &p_name);
|
2016-08-07 14:01:22 +00:00
|
|
|
|
2022-04-06 12:41:04 +00:00
|
|
|
PopupMenu *get_export_as_menu();
|
|
|
|
|
2017-06-08 17:57:35 +00:00
|
|
|
void set_input_event_forwarding_always_enabled();
|
|
|
|
bool is_input_event_forwarding_always_enabled() { return input_event_forwarding_always_enabled; }
|
|
|
|
|
2017-10-29 19:32:09 +00:00
|
|
|
void set_force_draw_over_forwarding_enabled();
|
|
|
|
bool is_force_draw_over_forwarding_enabled() { return force_draw_over_forwarding_enabled; }
|
|
|
|
|
2017-07-06 07:18:20 +00:00
|
|
|
void notify_main_screen_changed(const String &screen_name);
|
|
|
|
void notify_scene_changed(const Node *scn_root);
|
|
|
|
void notify_scene_closed(const String &scene_filepath);
|
2018-01-12 21:43:29 +00:00
|
|
|
void notify_resource_saved(const Ref<Resource> &p_resource);
|
2017-07-06 07:18:20 +00:00
|
|
|
|
2017-10-15 20:33:25 +00:00
|
|
|
virtual bool forward_canvas_gui_input(const Ref<InputEvent> &p_event);
|
2018-09-18 18:00:07 +00:00
|
|
|
virtual void forward_canvas_draw_over_viewport(Control *p_overlay);
|
|
|
|
virtual void forward_canvas_force_draw_over_viewport(Control *p_overlay);
|
|
|
|
|
2022-09-08 16:38:33 +00:00
|
|
|
virtual EditorPlugin::AfterGUIInput forward_3d_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event);
|
|
|
|
virtual void forward_3d_draw_over_viewport(Control *p_overlay);
|
|
|
|
virtual void forward_3d_force_draw_over_viewport(Control *p_overlay);
|
2018-09-18 18:00:07 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
virtual String get_name() const;
|
2019-06-11 18:43:37 +00:00
|
|
|
virtual const Ref<Texture2D> get_icon() const;
|
2014-02-10 01:10:30 +00:00
|
|
|
virtual bool has_main_screen() const;
|
|
|
|
virtual void make_visible(bool p_visible);
|
2017-03-05 15:44:50 +00:00
|
|
|
virtual void selected_notify() {} //notify that it was raised by the user, not the editor
|
2014-02-10 01:10:30 +00:00
|
|
|
virtual void edit(Object *p_object);
|
2017-08-12 16:52:50 +00:00
|
|
|
virtual bool handles(Object *p_object) const;
|
2014-02-10 01:10:30 +00:00
|
|
|
virtual Dictionary get_state() const; //save editor state so it can't be reloaded when reloading scene
|
2017-03-05 15:44:50 +00:00
|
|
|
virtual void set_state(const Dictionary &p_state); //restore editor state (likely was saved with the scene)
|
2018-01-18 20:37:17 +00:00
|
|
|
virtual void clear(); // clear any temporary data in the editor, reset it (likely new scene or load another scene)
|
2017-03-05 15:44:50 +00:00
|
|
|
virtual void save_external_data(); // if editor references external resources/scenes, save them
|
|
|
|
virtual void apply_changes(); // if changes are pending in editor, apply them
|
2014-02-10 01:10:30 +00:00
|
|
|
virtual void get_breakpoints(List<String> *p_breakpoints);
|
2017-03-05 15:44:50 +00:00
|
|
|
virtual bool get_remove_list(List<Node *> *p_list);
|
2015-06-22 03:03:19 +00:00
|
|
|
virtual void set_window_layout(Ref<ConfigFile> p_layout);
|
|
|
|
virtual void get_window_layout(Ref<ConfigFile> p_layout);
|
2017-03-05 15:44:50 +00:00
|
|
|
virtual void edited_scene_changed() {} // if changes are pending in editor, apply them
|
2018-01-08 15:55:22 +00:00
|
|
|
virtual bool build(); // builds with external tools. Returns true if safe to continue running scene.
|
2016-09-10 17:44:28 +00:00
|
|
|
|
2017-08-26 13:32:15 +00:00
|
|
|
EditorInterface *get_editor_interface();
|
2018-06-30 03:08:28 +00:00
|
|
|
ScriptCreateDialog *get_script_create_dialog();
|
2016-09-10 17:44:28 +00:00
|
|
|
|
2021-04-28 15:39:57 +00:00
|
|
|
void add_undo_redo_inspector_hook_callback(Callable p_callable);
|
|
|
|
void remove_undo_redo_inspector_hook_callback(Callable p_callable);
|
|
|
|
|
2017-10-29 19:32:09 +00:00
|
|
|
int update_overlays() const;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2020-10-15 15:29:59 +00:00
|
|
|
void queue_save_layout();
|
2016-02-27 03:32:00 +00:00
|
|
|
|
2016-09-17 14:59:12 +00:00
|
|
|
void make_bottom_panel_item_visible(Control *p_item);
|
|
|
|
void hide_bottom_panel();
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
virtual void restore_global_state();
|
|
|
|
virtual void save_global_state();
|
|
|
|
|
2020-06-23 11:48:59 +00:00
|
|
|
void add_translation_parser_plugin(const Ref<EditorTranslationParserPlugin> &p_parser);
|
|
|
|
void remove_translation_parser_plugin(const Ref<EditorTranslationParserPlugin> &p_parser);
|
|
|
|
|
2022-02-07 08:38:42 +00:00
|
|
|
void add_import_plugin(const Ref<EditorImportPlugin> &p_importer, bool p_first_priority = false);
|
2017-06-11 09:18:22 +00:00
|
|
|
void remove_import_plugin(const Ref<EditorImportPlugin> &p_importer);
|
2017-04-08 22:37:31 +00:00
|
|
|
|
2017-09-14 22:38:38 +00:00
|
|
|
void add_export_plugin(const Ref<EditorExportPlugin> &p_exporter);
|
|
|
|
void remove_export_plugin(const Ref<EditorExportPlugin> &p_exporter);
|
|
|
|
|
2022-09-08 16:38:33 +00:00
|
|
|
void add_node_3d_gizmo_plugin(const Ref<EditorNode3DGizmoPlugin> &p_gizmo_plugin);
|
|
|
|
void remove_node_3d_gizmo_plugin(const Ref<EditorNode3DGizmoPlugin> &p_gizmo_plugin);
|
2018-10-29 10:30:28 +00:00
|
|
|
|
2018-05-17 21:02:16 +00:00
|
|
|
void add_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin);
|
|
|
|
void remove_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin);
|
|
|
|
|
2022-02-07 08:38:42 +00:00
|
|
|
void add_scene_format_importer_plugin(const Ref<EditorSceneFormatImporter> &p_importer, bool p_first_priority = false);
|
2021-10-14 17:34:27 +00:00
|
|
|
void remove_scene_format_importer_plugin(const Ref<EditorSceneFormatImporter> &p_importer);
|
|
|
|
|
2022-02-07 08:38:42 +00:00
|
|
|
void add_scene_post_import_plugin(const Ref<EditorScenePostImportPlugin> &p_importer, bool p_first_priority = false);
|
2021-10-14 17:34:27 +00:00
|
|
|
void remove_scene_post_import_plugin(const Ref<EditorScenePostImportPlugin> &p_importer);
|
2017-12-07 18:44:20 +00:00
|
|
|
|
2018-02-14 04:31:38 +00:00
|
|
|
void add_autoload_singleton(const String &p_name, const String &p_path);
|
|
|
|
void remove_autoload_singleton(const String &p_name);
|
|
|
|
|
2022-10-03 13:21:25 +00:00
|
|
|
void add_debugger_plugin(const Ref<EditorDebuggerPlugin> &p_plugin);
|
|
|
|
void remove_debugger_plugin(const Ref<EditorDebuggerPlugin> &p_plugin);
|
2020-05-18 14:55:49 +00:00
|
|
|
|
2018-06-11 00:59:53 +00:00
|
|
|
void enable_plugin();
|
|
|
|
void disable_plugin();
|
|
|
|
|
2020-05-12 15:01:17 +00:00
|
|
|
EditorPlugin() {}
|
|
|
|
virtual ~EditorPlugin() {}
|
2014-02-10 01:10:30 +00:00
|
|
|
};
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
VARIANT_ENUM_CAST(EditorPlugin::CustomControlContainer);
|
|
|
|
VARIANT_ENUM_CAST(EditorPlugin::DockSlot);
|
2022-08-15 18:04:17 +00:00
|
|
|
VARIANT_ENUM_CAST(EditorPlugin::AfterGUIInput);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2022-02-14 16:59:06 +00:00
|
|
|
typedef EditorPlugin *(*EditorPluginCreateFunc)();
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
class EditorPlugins {
|
|
|
|
enum {
|
2022-05-01 09:57:36 +00:00
|
|
|
MAX_CREATE_FUNCS = 128
|
2014-02-10 01:10:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static EditorPluginCreateFunc creation_funcs[MAX_CREATE_FUNCS];
|
|
|
|
static int creation_func_count;
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
template <class T>
|
2022-02-14 16:59:06 +00:00
|
|
|
static EditorPlugin *creator() {
|
|
|
|
return memnew(T);
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
static int get_plugin_count() { return creation_func_count; }
|
2022-02-14 16:59:06 +00:00
|
|
|
static EditorPlugin *create(int p_idx) {
|
2020-04-01 23:20:12 +00:00
|
|
|
ERR_FAIL_INDEX_V(p_idx, creation_func_count, nullptr);
|
2022-02-14 16:59:06 +00:00
|
|
|
return creation_funcs[p_idx]();
|
2017-03-05 15:44:50 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
template <class T>
|
2014-02-10 01:10:30 +00:00
|
|
|
static void add_by_type() {
|
|
|
|
add_create_func(creator<T>);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void add_create_func(EditorPluginCreateFunc p_func) {
|
2017-03-05 15:44:50 +00:00
|
|
|
ERR_FAIL_COND(creation_func_count >= MAX_CREATE_FUNCS);
|
|
|
|
creation_funcs[creation_func_count++] = p_func;
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-07-23 21:41:51 +00:00
|
|
|
#endif // EDITOR_PLUGIN_H
|