diff options
Diffstat (limited to 'editor/editor_node.h')
-rw-r--r-- | editor/editor_node.h | 101 |
1 files changed, 70 insertions, 31 deletions
diff --git a/editor/editor_node.h b/editor/editor_node.h index dec28b0d2b..2e8b850c7b 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* 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 */ @@ -31,13 +31,16 @@ #ifndef EDITOR_NODE_H #define EDITOR_NODE_H +#include "core/templates/safe_refcount.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" +#include "scene/gui/link_button.h" typedef void (*EditorNodeInitCallback)(); typedef void (*EditorPluginInitializeCallback)(); @@ -52,6 +55,7 @@ class Control; class DependencyEditor; class DependencyErrorDialog; class EditorAbout; +class EditorCommandPalette; class EditorExport; class EditorFeatureProfileManager; class EditorFileServer; @@ -81,11 +85,14 @@ class RunSettingsDialog; class ScriptCreateDialog; class TabContainer; class Tabs; -class TextureProgress; +class TextureProgressBar; class Button; class VSplitContainer; class Window; class SubViewport; +class SceneImportSettings; +class EditorExtensionManager; +class DynamicFontImportSettings; class EditorNode : public Node { GDCLASS(EditorNode, Node); @@ -107,10 +114,10 @@ public: String path; List<String> args; String output; - Thread *execute_output_thread; + Thread execute_output_thread; Mutex execute_output_mutex; - int exitcode; - volatile bool done; + int exitcode = 0; + SafeFlag done; }; private: @@ -125,15 +132,12 @@ private: FILE_SAVE_SCENE, FILE_SAVE_AS_SCENE, FILE_SAVE_ALL_SCENES, - FILE_SAVE_BEFORE_RUN, 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, @@ -161,9 +165,9 @@ private: RUN_STOP, RUN_PLAY_SCENE, RUN_PLAY_CUSTOM_SCENE, - RUN_SCENE_SETTINGS, RUN_SETTINGS, RUN_PROJECT_DATA_FOLDER, + RUN_RELOAD_CURRENT_PROJECT, RUN_PROJECT_MANAGER, RUN_VCS_SETTINGS, RUN_VCS_SHUT_DOWN, @@ -180,6 +184,7 @@ private: SETTINGS_EDITOR_CONFIG_FOLDER, SETTINGS_MANAGE_EXPORT_TEMPLATES, SETTINGS_MANAGE_FEATURE_PROFILES, + SETTINGS_INSTALL_ANDROID_BUILD_TEMPLATE, SETTINGS_PICK_MAIN_SCENE, SETTINGS_TOGGLE_CONSOLE, SETTINGS_TOGGLE_FULLSCREEN, @@ -190,12 +195,15 @@ private: 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_VIDEO_DRIVER_SAVE_AND_RESTART, @@ -256,7 +264,7 @@ private: Control *vp_base; HBoxContainer *menu_hb; - Control *viewport; + Control *main_control; MenuButton *file_menu; MenuButton *project_menu; MenuButton *debug_menu; @@ -272,7 +280,7 @@ private: Button *play_scene_button; Button *play_custom_scene_button; Button *search_button; - TextureProgress *audio_vu; + TextureProgressBar *audio_vu; Timer *screenshot_timer; @@ -298,6 +306,7 @@ private: ConfirmationDialog *save_confirmation; ConfirmationDialog *import_confirmation; ConfirmationDialog *pick_main_scene; + Button *select_current_scene_button; AcceptDialog *accept; EditorAbout *about; AcceptDialog *warning; @@ -312,8 +321,10 @@ private: ConfirmationDialog *remove_android_build_template; EditorSettingsDialog *settings_config_dialog; - RunSettingsDialog *run_settings_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; @@ -321,17 +332,22 @@ private: EditorFileDialog *file_templates; EditorFileDialog *file_export_lib; EditorFileDialog *file_script; + EditorFileDialog *file_android_build_source; CheckBox *file_export_lib_merge; + CheckBox *file_export_lib_apply_xforms; String current_path; MenuButton *update_spinner; + EditorNativeShaderSourceVisualizer *native_shader_source_visualizer; + String defer_load_scene; - Node *_last_instanced_scene; + Node *_last_instantiated_scene; EditorLog *log; CenterContainer *tabs_center; EditorQuickOpen *quick_open; EditorQuickOpen *quick_run; + EditorCommandPalette *command_palette; HBoxContainer *main_editor_button_vb; Vector<Button *> main_editor_buttons; @@ -407,10 +423,12 @@ private: EditorResourcePreview *resource_preview; EditorFolding editor_folding; + DynamicFontImportSettings *fontdata_import_settings; + SceneImportSettings *scene_import_settings; struct BottomPanelItem { String name; - Control *control; - Button *button; + Control *control = nullptr; + Button *button = nullptr; }; Vector<BottomPanelItem> bottom_panel_items; @@ -419,9 +437,12 @@ private: HBoxContainer *bottom_panel_hb; HBoxContainer *bottom_panel_hb_editors; VBoxContainer *bottom_panel_vb; - Label *version_label; + LinkButton *version_btn; Button *bottom_panel_raise; + Tree *disk_changed_list; + ConfirmationDialog *disk_changed; + void _bottom_panel_raise_toggled(bool); EditorInterface *editor_interface; @@ -443,6 +464,8 @@ private: void _menu_confirm_current(); void _menu_option_confirm(int p_option, bool p_confirmed); + void _android_build_source_selected(const String &p_file); + void _request_screenshot(); void _screenshot(bool p_use_utc = false); void _save_screenshot(NodePath p_path); @@ -452,6 +475,7 @@ private: void _update_file_menu_closed(); void _on_plugin_ready(Object *p_script, const String &p_activate_name); + void _remove_plugin_from_enabled(const String &p_name); void _fs_changed(); void _resources_reimported(const Vector<String> &p_resources); @@ -469,6 +493,7 @@ private: void _close_messages(); void _show_messages(); void _vp_resized(); + void _version_button_pressed(); int _save_external_resources(); @@ -479,7 +504,7 @@ private: void _discard_changes(const String &p_str = String()); void _inherit_request(String p_file); - void _instance_request(const Vector<String> &p_files); + void _instantiate_request(const Vector<String> &p_files); void _display_top_editors(bool p_display); void _set_top_editors(Vector<EditorPlugin *> p_editor_plugins_over); @@ -487,6 +512,7 @@ private: void _quick_opened(); void _quick_run(); + void _open_command_palette(); void _run(bool p_current = false, const String &p_custom = ""); void _run_native(const Ref<EditorExportPreset> &p_preset); @@ -507,7 +533,7 @@ private: bool convert_old; - void _unhandled_input(const Ref<InputEvent> &p_event); + virtual void unhandled_input(const Ref<InputEvent> &p_event) override; static void _load_error_notify(void *p_ud, const String &p_text); @@ -554,8 +580,8 @@ private: struct ExportDefer { String preset; String path; - bool debug; - bool pack_only; + bool debug = false; + bool pack_only = false; } export_defer; bool cmdline_export_mode; @@ -579,7 +605,7 @@ private: void _dock_make_float(); void _scene_tab_changed(int p_tab); void _scene_tab_closed(int p_tab, int option = SCENE_TAB_CLOSE); - void _scene_tab_hover(int p_tab); + void _scene_tab_hovered(int p_tab); void _scene_tab_exit(); void _scene_tab_input(const Ref<InputEvent> &p_input); void _reposition_active_tab(int idx_to); @@ -641,11 +667,22 @@ private: static void _resource_loaded(RES p_resource, const String &p_path); void _resources_changed(const Vector<String> &p_resources); + void _scan_external_changes(); + void _reload_modified_scenes(); + void _reload_project_settings(); + void _resave_scenes(String p_str); void _feature_profile_changed(); bool _is_class_editor_disabled_by_feature_profile(const StringName &p_class); Ref<ImageTexture> _load_custom_class_icon(const String &p_path) const; + void _pick_main_scene_custom_action(const String &p_custom_action_name); + + bool immediate_dialog_confirmed = false; + void _immediate_dialog_confirmed(); + + void _select_default_main_screen_plugin(); + protected: void _notification(int p_what); @@ -709,8 +746,6 @@ public: void save_resource(const Ref<Resource> &p_resource); void save_resource_as(const Ref<Resource> &p_resource, const String &p_at_path = String()); - void merge_from_scene() { _menu_option_confirm(FILE_IMPORT_SUBSCENE, false); } - void show_about() { _menu_option_confirm(HELP_ABOUT, false); } static bool has_unsaved_changes() { return singleton->unsaved_cache; } @@ -730,7 +765,7 @@ public: bool is_changing_scene() const; static EditorLog *get_log() { return singleton->log; } - Control *get_viewport(); + Control *get_main_control(); void set_edited_scene(Node *p_scene); @@ -741,7 +776,7 @@ public: void fix_dependencies(const String &p_for_file); void clear_scene() { _cleanup_scene(); } int new_scene(); - Error load_scene(const String &p_scene, bool p_ignore_broken_deps = false, bool p_set_inherited = false, bool p_clear_errors = true, bool p_force_open_imported = false); + Error load_scene(const String &p_scene, bool p_ignore_broken_deps = false, bool p_set_inherited = false, bool p_clear_errors = true, bool p_force_open_imported = false, bool p_silent_change_tab = false); Error load_resource(const String &p_resource, bool p_ignore_broken_deps = false); bool is_scene_open(const String &p_path); @@ -756,7 +791,7 @@ public: static VSplitContainer *get_top_split() { return singleton->top_split; } void request_instance_scene(const String &p_path); - void request_instance_scenes(const Vector<String> &p_files); + void request_instantiate_scenes(const Vector<String> &p_files); FileSystemDock *get_filesystem_dock(); ImportDock *get_import_dock(); SceneTreeDock *get_scene_tree_dock(); @@ -824,7 +859,6 @@ public: Button *get_pause_button() { return pause_button; } Button *add_bottom_panel_item(String p_text, Control *p_item); - bool are_bottom_panels_hidden() const; void make_bottom_panel_item_visible(Control *p_item); void raise_bottom_panel_item(Control *p_item); void hide_bottom_panel(); @@ -833,7 +867,7 @@ public: Variant drag_resource(const Ref<Resource> &p_res, Control *p_from); Variant drag_files_and_dirs(const Vector<String> &p_paths, Control *p_from); - void add_tool_menu_item(const String &p_name, Object *p_handler, const String &p_callback, const Variant &p_ud = Variant()); + void add_tool_menu_item(const String &p_name, const Callable &p_callback); void add_tool_submenu_item(const String &p_name, PopupMenu *p_submenu); void remove_tool_menu_item(const String &p_name); @@ -841,7 +875,9 @@ public: void save_scene_list(Vector<String> p_scene_filenames); void restart_editor(); - void dim_editor(bool p_dimming, bool p_force_dim = false); + void notify_settings_changed(); + + void dim_editor(bool p_dimming); bool is_editor_dimmed() const; void edit_current() { _edit_current(); }; @@ -864,12 +900,15 @@ public: bool ensure_main_scene(bool p_from_native); + Error run_play_native(int p_idx, int p_platform); void run_play(); void run_play_current(); void run_play_custom(const String &p_custom); void run_stop(); bool is_run_playing() const; String get_run_playing_scene() const; + + static bool immediate_confirmation_dialog(const String &p_text, const String &p_ok_text = TTR("Ok"), const String &p_cancel_text = TTR("Cancel")); }; struct EditorProgress { @@ -906,7 +945,7 @@ public: void add_plugin(EditorPlugin *p_plugin); void remove_plugin(EditorPlugin *p_plugin); void clear(); - bool empty(); + bool is_empty(); EditorPluginList(); ~EditorPluginList(); |