/**************************************************************************/ /* editor_node.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. */ /**************************************************************************/ #ifndef EDITOR_NODE_H #define EDITOR_NODE_H #include "core/object/script_language.h" #include "core/templates/safe_refcount.h" #include "editor/editor_data.h" #include "editor/editor_folding.h" #include "editor/plugins/editor_plugin.h" typedef void (*EditorNodeInitCallback)(); typedef void (*EditorPluginInitializeCallback)(); typedef bool (*EditorBuildCallback)(); class AcceptDialog; class CenterContainer; class CheckBox; class ColorPicker; class ConfirmationDialog; class Control; class FileDialog; class HBoxContainer; class HSplitContainer; class LinkButton; class MenuBar; class MenuButton; class Node2D; class OptionButton; class Panel; class PanelContainer; class PopupPanel; class RichTextLabel; class SubViewport; class TabBar; class TabContainer; class TextureRect; class TextureProgressBar; class Tree; class VBoxContainer; class VSplitContainer; class Window; class AudioStreamImportSettingsDialog; class AudioStreamPreviewGenerator; class BackgroundProgress; class DependencyEditor; class DependencyErrorDialog; class DockSplitContainer; class DynamicFontImportSettingsDialog; class EditorAbout; class EditorBuildProfileManager; class EditorBottomPanel; class EditorCommandPalette; class EditorDockManager; class EditorExport; class EditorExportPreset; class EditorExtensionManager; class EditorFeatureProfileManager; class EditorFileDialog; class EditorFolding; class EditorInspector; class EditorLayoutsDialog; class EditorLog; class EditorNativeShaderSourceVisualizer; class EditorPluginList; class EditorQuickOpen; class EditorPropertyResource; class EditorResourcePreview; class EditorResourceConversionPlugin; class EditorRunBar; class EditorRunNative; class EditorSceneTabs; class EditorSelectionHistory; class EditorSettingsDialog; class EditorTitleBar; class EditorToaster; class EditorUndoRedoManager; class ExportTemplateManager; class FBXImporterManager; class FileSystemDock; class HistoryDock; class ImportDock; class NodeDock; class OrphanResourcesDialog; class PluginConfigDialog; class ProgressDialog; class ProjectExportDialog; class ProjectSettingsEditor; class RunSettingsDialog; class SceneImportSettingsDialog; class ScriptCreateDialog; class SurfaceUpgradeTool; class SurfaceUpgradeDialog; class WindowWrapper; class EditorNode : public Node { GDCLASS(EditorNode, Node); public: enum EditorTable { EDITOR_2D = 0, EDITOR_3D, EDITOR_SCRIPT, EDITOR_ASSETLIB }; enum SceneNameCasing { SCENE_NAME_CASING_AUTO, SCENE_NAME_CASING_PASCAL_CASE, SCENE_NAME_CASING_SNAKE_CASE, SCENE_NAME_CASING_KEBAB_CASE, }; enum ActionOnPlay { ACTION_ON_PLAY_DO_NOTHING, ACTION_ON_PLAY_OPEN_OUTPUT, ACTION_ON_PLAY_OPEN_DEBUGGER, }; enum ActionOnStop { ACTION_ON_STOP_DO_NOTHING, ACTION_ON_STOP_CLOSE_BUTTOM_PANEL, }; struct ExecuteThreadArgs { String path; List args; String output; Thread execute_output_thread; Mutex execute_output_mutex; int exitcode = 0; SafeFlag done; }; private: friend class EditorSceneTabs; friend class SurfaceUpgradeTool; enum MenuOptions { FILE_NEW_SCENE, FILE_NEW_INHERITED_SCENE, FILE_OPEN_SCENE, FILE_SAVE_SCENE, FILE_SAVE_SCENE_SILENTLY, FILE_SAVE_AS_SCENE, FILE_SAVE_ALL_SCENES, FILE_SAVE_AND_RUN, FILE_SAVE_AND_RUN_MAIN_SCENE, FILE_RUN_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_QUIT, FILE_EXTERNAL_OPEN_SCENE, EDIT_UNDO, EDIT_REDO, EDIT_RELOAD_SAVED_SCENE, TOOLS_ORPHAN_RESOURCES, TOOLS_BUILD_PROFILE_MANAGER, TOOLS_SURFACE_UPGRADE, TOOLS_CUSTOM, RESOURCE_SAVE, RESOURCE_SAVE_AS, RUN_SETTINGS, RUN_USER_DATA_FOLDER, RELOAD_CURRENT_PROJECT, RUN_PROJECT_MANAGER, VCS_MENU, 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_FBX_IMPORTER, 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_FORUM, HELP_REPORT_A_BUG, HELP_COPY_SYSTEM_INFO, HELP_SUGGEST_A_FEATURE, HELP_SEND_DOCS_FEEDBACK, HELP_COMMUNITY, HELP_ABOUT, HELP_SUPPORT_GODOT_DEVELOPMENT, SET_RENDERER_NAME_SAVE_AND_RESTART, IMPORT_PLUGIN_BASE = 100, TOOL_MENU_BASE = 1000 }; enum { MAX_INIT_CALLBACKS = 128, MAX_BUILD_CALLBACKS = 128 }; struct ExportDefer { String preset; String path; bool debug = false; bool pack_only = false; bool android_build_template = false; } export_defer; static EditorNode *singleton; EditorData editor_data; EditorFolding editor_folding; EditorSelectionHistory editor_history; EditorCommandPalette *command_palette = nullptr; EditorExport *editor_export = 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; EditorResourcePreview *resource_preview = nullptr; EditorSelection *editor_selection = nullptr; EditorSettingsDialog *editor_settings_dialog = nullptr; HistoryDock *history_dock = nullptr; ProjectExportDialog *project_export = nullptr; ProjectSettingsEditor *project_settings_editor = nullptr; FBXImporterManager *fbx_importer_manager = nullptr; Vector editor_plugins; bool _initializing_plugins = false; HashMap addon_name_to_plugin; LocalVector pending_addons; HashMap> active_plugins; bool is_main_screen_editing = false; PanelContainer *scene_root_parent = 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. DockSplitContainer *left_l_hsplit = nullptr; DockSplitContainer *left_l_vsplit = nullptr; DockSplitContainer *left_r_hsplit = nullptr; DockSplitContainer *left_r_vsplit = nullptr; DockSplitContainer *main_hsplit = nullptr; DockSplitContainer *right_hsplit = nullptr; DockSplitContainer *right_l_vsplit = nullptr; DockSplitContainer *right_r_vsplit = nullptr; DockSplitContainer *center_split = nullptr; // Main tabs. EditorSceneTabs *scene_tabs = nullptr; int tab_closing_idx = 0; List tabs_to_close; int tab_closing_menu_option = -1; bool exiting = false; bool dimmed = false; DisplayServer::WindowMode prev_mode = DisplayServer::WINDOW_MODE_MAXIMIZED; int old_split_ofs = 0; VSplitContainer *top_split = nullptr; Control *vp_base = nullptr; Label *project_title = nullptr; Control *left_menu_spacer = nullptr; Control *right_menu_spacer = nullptr; EditorTitleBar *title_bar = nullptr; EditorRunBar *project_run_bar = nullptr; VBoxContainer *main_screen_vbox = nullptr; MenuBar *main_menu = nullptr; PopupMenu *apple_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 *search_button = nullptr; TextureProgressBar *audio_vu = nullptr; Timer *screenshot_timer = nullptr; uint64_t started_timestamp = 0; RichTextLabel *load_errors = nullptr; AcceptDialog *load_error_dialog = nullptr; RichTextLabel *execute_outputs = nullptr; AcceptDialog *execute_output_dialog = nullptr; Ref theme; Timer *system_theme_timer = nullptr; bool follow_system_theme = false; bool use_system_accent_color = false; bool last_dark_mode_state = false; Color last_system_base_color = Color(0, 0, 0, 0); Color last_system_accent_color = Color(0, 0, 0, 0); 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; EditorPlugin *plugin_to_save = nullptr; int overridden_default_layout = -1; Ref default_layout; PopupMenu *editor_layouts = nullptr; EditorLayoutsDialog *layout_dialog = nullptr; ConfirmationDialog *gradle_build_manage_templates = nullptr; ConfirmationDialog *install_android_build_template = nullptr; ConfirmationDialog *remove_android_build_template = nullptr; Label *install_android_build_template_message = nullptr; OptionButton *choose_android_export_profile = nullptr; Ref android_export_preset; 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; String current_path; MenuButton *update_spinner = nullptr; HBoxContainer *main_editor_button_hb = nullptr; Vector