/*************************************************************************/ /* editor_node.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2021 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 "editor/editor_data.h" #include "editor/editor_export.h" #include "editor/editor_folding.h" #include "editor/editor_native_shader_source_visualizer.h" #include "editor/editor_run.h" #include "editor/inspector_dock.h" #include "editor/property_editor.h" #include "editor/scene_tree_dock.h" typedef void (*EditorNodeInitCallback)(); typedef void (*EditorPluginInitializeCallback)(); typedef bool (*EditorBuildCallback)(); class AcceptDialog; class AudioStreamPreviewGenerator; class BackgroundProgress; class CenterContainer; class ConfirmationDialog; class Control; class DependencyEditor; class DependencyErrorDialog; class EditorAbout; class EditorExport; class EditorFeatureProfileManager; class EditorFileServer; class EditorInspector; class EditorLayoutsDialog; class EditorLog; class EditorPlugin; class EditorPluginList; class EditorQuickOpen; class EditorResourcePreview; class EditorRunNative; class EditorSettingsDialog; class ExportTemplateManager; class FileSystemDock; class HSplitContainer; class ImportDock; class MenuButton; class NodeDock; class OrphanResourcesDialog; class Panel; class PanelContainer; class PluginConfigDialog; class ProgressDialog; class ProjectExportDialog; class ProjectSettingsEditor; class RunSettingsDialog; class ScriptCreateDialog; class TabContainer; class Tabs; class TextureProgressBar; class Button; class VSplitContainer; class Window; class SubViewport; 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 }; struct ExecuteThreadArgs { String path; List args; String output; Thread execute_output_thread; Mutex execute_output_mutex; int exitcode = 0; volatile bool done = false; }; private: enum { HISTORY_SIZE = 64 }; 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_SHOW_IN_FILESYSTEM, FILE_IMPORT_SUBSCENE, FILE_EXPORT_PROJECT, FILE_EXPORT_MESH_LIBRARY, FILE_INSTALL_ANDROID_SOURCE, FILE_EXPLORE_ANDROID_BUILD_TEMPLATES, FILE_EXPORT_TILESET, 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_QUIT, FILE_EXTERNAL_OPEN_SCENE, EDIT_UNDO, EDIT_REDO, EDIT_RELOAD_SAVED_SCENE, TOOLS_ORPHAN_RESOURCES, TOOLS_CUSTOM, RESOURCE_SAVE, RESOURCE_SAVE_AS, RUN_PLAY, RUN_STOP, RUN_PLAY_SCENE, RUN_PLAY_CUSTOM_SCENE, RUN_SETTINGS, RUN_PROJECT_DATA_FOLDER, RUN_PROJECT_MANAGER, RUN_VCS_SETTINGS, RUN_VCS_SHUT_DOWN, 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_PICK_MAIN_SCENE, SETTINGS_TOGGLE_CONSOLE, SETTINGS_TOGGLE_FULLSCREEN, SETTINGS_HELP, SCENE_TAB_CLOSE, EDITOR_SCREENSHOT, EDITOR_OPEN_SCREENSHOT, HELP_SEARCH, HELP_DOCS, HELP_QA, HELP_REPORT_A_BUG, HELP_SEND_DOCS_FEEDBACK, HELP_COMMUNITY, HELP_ABOUT, SET_VIDEO_DRIVER_SAVE_AND_RESTART, GLOBAL_NEW_WINDOW, GLOBAL_SCENE, IMPORT_PLUGIN_BASE = 100, TOOL_MENU_BASE = 1000 }; SubViewport *scene_root; //root of the scene being edited PanelContainer *scene_root_parent; Control *theme_base; Control *gui_base; VBoxContainer *main_vbox; OptionButton *video_driver; ConfirmationDialog *video_restart_dialog; int video_driver_current; String video_driver_request; void _video_driver_selected(int); void _update_video_driver_color(); // Split containers HSplitContainer *left_l_hsplit; VSplitContainer *left_l_vsplit; HSplitContainer *left_r_hsplit; VSplitContainer *left_r_vsplit; HSplitContainer *main_hsplit; HSplitContainer *right_hsplit; VSplitContainer *right_l_vsplit; VSplitContainer *right_r_vsplit; VSplitContainer *center_split; // To access those easily by index Vector vsplits; Vector hsplits; // Main tabs Tabs *scene_tabs; PopupMenu *scene_tabs_context_menu; Panel *tab_preview_panel; TextureRect *tab_preview; int tab_closing; bool exiting; bool dimmed; int old_split_ofs; VSplitContainer *top_split; HBoxContainer *bottom_hb; Control *vp_base; HBoxContainer *menu_hb; Control *main_control; MenuButton *file_menu; MenuButton *project_menu; MenuButton *debug_menu; MenuButton *settings_menu; MenuButton *help_menu; PopupMenu *tool_menu; Button *export_button; Button *prev_scene; Button *play_button; Button *pause_button; Button *stop_button; Button *run_settings_button; Button *play_scene_button; Button *play_custom_scene_button; Button *search_button; TextureProgressBar *audio_vu; Timer *screenshot_timer; PluginConfigDialog *plugin_config_dialog; RichTextLabel *load_errors; AcceptDialog *load_error_dialog; RichTextLabel *execute_outputs; AcceptDialog *execute_output_dialog; Ref theme; PopupMenu *recent_scenes; SceneTreeDock *scene_tree_dock; InspectorDock *inspector_dock; NodeDock *node_dock; ImportDock *import_dock; FileSystemDock *filesystem_dock; EditorRunNative *run_native; ConfirmationDialog *confirmation; ConfirmationDialog *save_confirmation; ConfirmationDialog *import_confirmation; ConfirmationDialog *pick_main_scene; AcceptDialog *accept; EditorAbout *about; AcceptDialog *warning; int overridden_default_layout; Ref default_layout; PopupMenu *editor_layouts; EditorLayoutsDialog *layout_dialog; ConfirmationDialog *custom_build_manage_templates; ConfirmationDialog *install_android_build_template; ConfirmationDialog *remove_android_build_template; EditorSettingsDialog *settings_config_dialog; ProjectSettingsEditor *project_settings; bool settings_changed = true; //make it update settings on first frame void _update_from_settings(); PopupMenu *vcs_actions_menu; EditorFileDialog *file; ExportTemplateManager *export_template_manager; EditorFeatureProfileManager *feature_profile_manager; EditorFileDialog *file_templates; EditorFileDialog *file_export_lib; EditorFileDialog *file_script; CheckBox *file_export_lib_merge; String current_path; MenuButton *update_spinner; EditorNativeShaderSourceVisualizer *native_shader_source_visualizer; String defer_load_scene; Node *_last_instanced_scene; EditorLog *log; CenterContainer *tabs_center; EditorQuickOpen *quick_open; EditorQuickOpen *quick_run; HBoxContainer *main_editor_button_vb; Vector