/*************************************************************************/ /* editor_node.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* 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. */ /*************************************************************************/ #ifndef EDITOR_NODE_H #define EDITOR_NODE_H #include "core/templates/safe_refcount.h" #include "editor/editor_folding.h" #include "editor/editor_native_shader_source_visualizer.h" #include "editor/editor_run.h" #include "editor/editor_title_bar.h" #include "editor/export/editor_export.h" #include "editor/inspector_dock.h" typedef void (*EditorNodeInitCallback)(); typedef void (*EditorPluginInitializeCallback)(); typedef bool (*EditorBuildCallback)(); class AcceptDialog; class AudioStreamPreviewGenerator; class BackgroundProgress; class Button; class CenterContainer; class ColorPicker; class ConfirmationDialog; class Control; class DependencyEditor; class DependencyErrorDialog; class DynamicFontImportSettings; class EditorAbout; class EditorCommandPalette; class EditorExport; class EditorExtensionManager; class EditorFeatureProfileManager; class EditorFileServer; class EditorFolding; class EditorInspector; class EditorLayoutsDialog; class EditorLog; class EditorPlugin; class EditorPluginList; class EditorQuickOpen; class EditorResourcePreview; class EditorResourceConversionPlugin; class EditorRun; class EditorRunNative; class EditorSettingsDialog; class EditorToaster; class EditorUndoRedoManager; class ExportTemplateManager; class FileDialog; class FileSystemDock; class HSplitContainer; class ImportDock; class LinkButton; class MenuBar; class MenuButton; class NodeDock; class OrphanResourcesDialog; class Panel; class PanelContainer; class PluginConfigDialog; class ProgressDialog; class ProjectExportDialog; class ProjectSettingsEditor; class RunSettingsDialog; class SceneImportSettings; class AudioStreamImportSettings; class ScriptCreateDialog; class SubViewport; class TabBar; class TabContainer; class TextureProgressBar; class VSplitContainer; class Window; class EditorBuildProfileManager; class EditorNode : public Node { GDCLASS(EditorNode, Node); public: 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 }; enum EditorTable { EDITOR_2D = 0, EDITOR_3D, EDITOR_SCRIPT, EDITOR_ASSETLIB }; struct ExecuteThreadArgs { String path; List args; String output; Thread execute_output_thread; Mutex execute_output_mutex; int exitcode = 0; SafeFlag done; }; private: enum MenuOptions { FILE_NEW_SCENE, FILE_NEW_INHERITED_SCENE, FILE_OPEN_SCENE, FILE_SAVE_SCENE, FILE_SAVE_AS_SCENE, FILE_SAVE_ALL_SCENES, FILE_SAVE_AND_RUN, FILE_SAVE_AND_RUN_MAIN_SCENE, FILE_SHOW_IN_FILESYSTEM, FILE_EXPORT_PROJECT, FILE_EXPORT_MESH_LIBRARY, FILE_INSTALL_ANDROID_SOURCE, FILE_EXPLORE_ANDROID_BUILD_TEMPLATES, FILE_SAVE_OPTIMIZED, FILE_OPEN_RECENT, FILE_OPEN_OLD_SCENE, FILE_QUICK_OPEN, FILE_QUICK_OPEN_SCENE, FILE_QUICK_OPEN_SCRIPT, FILE_OPEN_PREV, FILE_CLOSE, FILE_CLOSE_OTHERS, FILE_CLOSE_RIGHT, FILE_CLOSE_ALL, FILE_CLOSE_ALL_AND_QUIT, FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER, FILE_CLOSE_ALL_AND_RELOAD_CURRENT_PROJECT, FILE_QUIT, FILE_EXTERNAL_OPEN_SCENE, EDIT_UNDO, EDIT_REDO, EDIT_RELOAD_SAVED_SCENE, TOOLS_ORPHAN_RESOURCES, TOOLS_BUILD_PROFILE_MANAGER, TOOLS_CUSTOM, RESOURCE_SAVE, RESOURCE_SAVE_AS, RUN_PLAY, RUN_STOP, RUN_PLAY_SCENE, RUN_PLAY_CUSTOM_SCENE, RUN_SETTINGS, RUN_USER_DATA_FOLDER, RELOAD_CURRENT_PROJECT, RUN_PROJECT_MANAGER, RUN_VCS_METADATA, RUN_VCS_SETTINGS, SETTINGS_UPDATE_CONTINUOUSLY, SETTINGS_UPDATE_WHEN_CHANGED, SETTINGS_UPDATE_ALWAYS, SETTINGS_UPDATE_CHANGES, SETTINGS_UPDATE_SPINNER_HIDE, SETTINGS_PREFERENCES, SETTINGS_LAYOUT_SAVE, SETTINGS_LAYOUT_DELETE, SETTINGS_LAYOUT_DEFAULT, SETTINGS_EDITOR_DATA_FOLDER, SETTINGS_EDITOR_CONFIG_FOLDER, SETTINGS_MANAGE_EXPORT_TEMPLATES, SETTINGS_MANAGE_FEATURE_PROFILES, SETTINGS_INSTALL_ANDROID_BUILD_TEMPLATE, SETTINGS_PICK_MAIN_SCENE, SETTINGS_TOGGLE_FULLSCREEN, SETTINGS_HELP, SCENE_TAB_CLOSE, EDITOR_SCREENSHOT, EDITOR_OPEN_SCREENSHOT, HELP_SEARCH, HELP_COMMAND_PALETTE, HELP_DOCS, HELP_QA, HELP_REPORT_A_BUG, HELP_SUGGEST_A_FEATURE, HELP_SEND_DOCS_FEEDBACK, HELP_COMMUNITY, HELP_ABOUT, HELP_SUPPORT_GODOT_DEVELOPMENT, SET_RENDERER_NAME_SAVE_AND_RESTART, GLOBAL_NEW_WINDOW, GLOBAL_SCENE, IMPORT_PLUGIN_BASE = 100, TOOL_MENU_BASE = 1000 }; enum { MAX_INIT_CALLBACKS = 128, MAX_BUILD_CALLBACKS = 128 }; enum ScriptNameCasing { SCENE_NAME_CASING_AUTO, SCENE_NAME_CASING_PASCAL_CASE, SCENE_NAME_CASING_SNAKE_CASE }; struct BottomPanelItem { String name; Control *control = nullptr; Button *button = nullptr; }; struct ExportDefer { String preset; String path; bool debug = false; bool pack_only = false; } export_defer; static EditorNode *singleton; EditorData editor_data; EditorFolding editor_folding; EditorRun editor_run; EditorSelectionHistory editor_history; EditorCommandPalette *command_palette = nullptr; EditorExport *editor_export = nullptr; EditorInterface *editor_interface = nullptr; EditorLog *log = nullptr; EditorNativeShaderSourceVisualizer *native_shader_source_visualizer = nullptr; EditorPlugin *editor_plugin_screen = nullptr; EditorPluginList *editor_plugins_force_input_forwarding = nullptr; EditorPluginList *editor_plugins_force_over = nullptr; EditorPluginList *editor_plugins_over = nullptr; EditorQuickOpen *quick_open = nullptr; EditorQuickOpen *quick_run = nullptr; EditorResourcePreview *resource_preview = nullptr; EditorRunNative *run_native = nullptr; EditorSelection *editor_selection = nullptr; EditorSettingsDialog *editor_settings_dialog = nullptr; ProjectExportDialog *project_export = nullptr; ProjectSettingsEditor *project_settings_editor = nullptr; Vector editor_plugins; bool _initializing_plugins = false; HashMap addon_name_to_plugin; PanelContainer *scene_root_parent = nullptr; Control *theme_base = nullptr; Control *gui_base = nullptr; VBoxContainer *main_vbox = nullptr; OptionButton *renderer = nullptr; ConfirmationDialog *video_restart_dialog = nullptr; int renderer_current = 0; String renderer_request; // Split containers. HSplitContainer *left_l_hsplit = nullptr; VSplitContainer *left_l_vsplit = nullptr; HSplitContainer *left_r_hsplit = nullptr; VSplitContainer *left_r_vsplit = nullptr; HSplitContainer *main_hsplit = nullptr; HSplitContainer *right_hsplit = nullptr; VSplitContainer *right_l_vsplit = nullptr; VSplitContainer *right_r_vsplit = nullptr; VSplitContainer *center_split = nullptr; // To access those easily by index. Vector vsplits; Vector hsplits; // Main tabs. TabBar *scene_tabs = nullptr; PopupMenu *scene_tabs_context_menu = nullptr; Panel *tab_preview_panel = nullptr; TextureRect *tab_preview = nullptr; int tab_closing_idx = 0; bool exiting = false; bool dimmed = false; int old_split_ofs = 0; VSplitContainer *top_split = nullptr; HBoxContainer *bottom_hb = nullptr; Control *vp_base = nullptr; EditorTitleBar *menu_hb = nullptr; VBoxContainer *main_screen_vbox = nullptr; MenuBar *main_menu = nullptr; PopupMenu *file_menu = nullptr; PopupMenu *project_menu = nullptr; PopupMenu *debug_menu = nullptr; PopupMenu *settings_menu = nullptr; PopupMenu *help_menu = nullptr; PopupMenu *tool_menu = nullptr; PopupMenu *export_as_menu = nullptr; Button *export_button = nullptr; Button *prev_scene = nullptr; Button *search_button = nullptr; TextureProgressBar *audio_vu = nullptr; PanelContainer *launch_pad = nullptr; Button *play_button = nullptr; Button *pause_button = nullptr; Button *stop_button = nullptr; Button *play_scene_button = nullptr; Button *play_custom_scene_button = nullptr; PanelContainer *write_movie_panel = nullptr; Button *write_movie_button = nullptr; Timer *screenshot_timer = nullptr; PluginConfigDialog *plugin_config_dialog = nullptr; RichTextLabel *load_errors = nullptr; AcceptDialog *load_error_dialog = nullptr; RichTextLabel *execute_outputs = nullptr; AcceptDialog *execute_output_dialog = nullptr; Ref theme; PopupMenu *recent_scenes = nullptr; String _recent_scene; List previous_scenes; String defer_load_scene; Node *_last_instantiated_scene = nullptr; ConfirmationDialog *confirmation = nullptr; ConfirmationDialog *save_confirmation = nullptr; ConfirmationDialog *import_confirmation = nullptr; ConfirmationDialog *pick_main_scene = nullptr; Button *select_current_scene_button = nullptr; AcceptDialog *accept = nullptr; AcceptDialog *save_accept = nullptr; EditorAbout *about = nullptr; AcceptDialog *warning = nullptr; int overridden_default_layout = -1; Ref default_layout; PopupMenu *editor_layouts = nullptr; EditorLayoutsDialog *layout_dialog = nullptr; ConfirmationDialog *custom_build_manage_templates = nullptr; ConfirmationDialog *install_android_build_template = nullptr; ConfirmationDialog *remove_android_build_template = nullptr; PopupMenu *vcs_actions_menu = nullptr; EditorFileDialog *file = nullptr; ExportTemplateManager *export_template_manager = nullptr; EditorFeatureProfileManager *feature_profile_manager = nullptr; EditorBuildProfileManager *build_profile_manager = nullptr; EditorFileDialog *file_templates = nullptr; EditorFileDialog *file_export_lib = nullptr; EditorFileDialog *file_script = nullptr; EditorFileDialog *file_android_build_source = nullptr; CheckBox *file_export_lib_merge = nullptr; CheckBox *file_export_lib_apply_xforms = nullptr; String current_path; MenuButton *update_spinner = nullptr; HBoxContainer *main_editor_button_vb = nullptr; Vector