summaryrefslogtreecommitdiff
path: root/editor/editor_node.h
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_node.h')
-rw-r--r--editor/editor_node.h293
1 files changed, 149 insertions, 144 deletions
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 7d24cfe758..9cd96050e3 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -273,163 +273,164 @@ private:
Vector<EditorPlugin *> editor_plugins;
bool _initializing_plugins = false;
- Map<String, EditorPlugin *> addon_name_to_plugin;
+ HashMap<String, EditorPlugin *> addon_name_to_plugin;
- PanelContainer *scene_root_parent;
- Control *theme_base;
- Control *gui_base;
- VBoxContainer *main_vbox;
- OptionButton *rendering_driver;
+ PanelContainer *scene_root_parent = nullptr;
+ Control *theme_base = nullptr;
+ Control *gui_base = nullptr;
+ VBoxContainer *main_vbox = nullptr;
+ OptionButton *rendering_driver = nullptr;
- ConfirmationDialog *video_restart_dialog;
+ ConfirmationDialog *video_restart_dialog = nullptr;
- int rendering_driver_current;
+ int rendering_driver_current = 0;
String rendering_driver_request;
// 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;
+ 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<VSplitContainer *> vsplits;
Vector<HSplitContainer *> hsplits;
// Main tabs.
- TabBar *scene_tabs;
- PopupMenu *scene_tabs_context_menu;
- Panel *tab_preview_panel;
- TextureRect *tab_preview;
- int tab_closing_idx;
+ 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;
- 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;
+ int old_split_ofs = 0;
+ VSplitContainer *top_split = nullptr;
+ HBoxContainer *bottom_hb = nullptr;
+ Control *vp_base = nullptr;
+
+ HBoxContainer *menu_hb = nullptr;
+ Control *main_control = nullptr;
+ MenuButton *file_menu = nullptr;
+ MenuButton *project_menu = nullptr;
+ MenuButton *debug_menu = nullptr;
+ MenuButton *settings_menu = nullptr;
+ MenuButton *help_menu = nullptr;
+ PopupMenu *tool_menu = nullptr;
+ PopupMenu *export_as_menu = nullptr;
+ Button *export_button = nullptr;
+ Button *prev_scene = nullptr;
+ Button *play_button = nullptr;
+ Button *pause_button = nullptr;
+ Button *stop_button = nullptr;
+ Button *run_settings_button = nullptr;
+ Button *play_scene_button = nullptr;
+ Button *play_custom_scene_button = nullptr;
+ Button *search_button = nullptr;
+ TextureProgressBar *audio_vu = 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> theme;
- PopupMenu *recent_scenes;
+ PopupMenu *recent_scenes = nullptr;
String _recent_scene;
List<String> previous_scenes;
String defer_load_scene;
- Node *_last_instantiated_scene;
-
- ConfirmationDialog *confirmation;
- ConfirmationDialog *save_confirmation;
- ConfirmationDialog *import_confirmation;
- ConfirmationDialog *pick_main_scene;
- Button *select_current_scene_button;
- AcceptDialog *accept;
- AcceptDialog *save_accept;
- EditorAbout *about;
- AcceptDialog *warning;
-
- int overridden_default_layout;
+ 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<ConfigFile> default_layout;
- PopupMenu *editor_layouts;
- EditorLayoutsDialog *layout_dialog;
-
- ConfirmationDialog *custom_build_manage_templates;
- ConfirmationDialog *install_android_build_template;
- ConfirmationDialog *remove_android_build_template;
-
- PopupMenu *vcs_actions_menu;
- EditorFileDialog *file;
- ExportTemplateManager *export_template_manager;
- EditorFeatureProfileManager *feature_profile_manager;
- 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;
+ 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;
+ 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;
+ MenuButton *update_spinner = nullptr;
- HBoxContainer *main_editor_button_vb;
+ HBoxContainer *main_editor_button_vb = nullptr;
Vector<Button *> main_editor_buttons;
Vector<EditorPlugin *> editor_table;
- AudioStreamPreviewGenerator *audio_preview_gen;
- ProgressDialog *progress_dialog;
- BackgroundProgress *progress_hb;
+ AudioStreamPreviewGenerator *audio_preview_gen = nullptr;
+ ProgressDialog *progress_dialog = nullptr;
+ BackgroundProgress *progress_hb = nullptr;
- DependencyErrorDialog *dependency_error;
- Map<String, Set<String>> dependency_errors;
- DependencyEditor *dependency_fixer;
- OrphanResourcesDialog *orphan_resources;
- ConfirmationDialog *open_imported;
- Button *new_inherited_button;
+ DependencyErrorDialog *dependency_error = nullptr;
+ HashMap<String, RBSet<String>> dependency_errors;
+ DependencyEditor *dependency_fixer = nullptr;
+ OrphanResourcesDialog *orphan_resources = nullptr;
+ ConfirmationDialog *open_imported = nullptr;
+ Button *new_inherited_button = nullptr;
String open_import_request;
Vector<Control *> floating_docks;
- Button *dock_float;
- Button *dock_tab_move_left;
- Button *dock_tab_move_right;
- Control *dock_select;
- PopupPanel *dock_select_popup;
+ Button *dock_float = nullptr;
+ Button *dock_tab_move_left = nullptr;
+ Button *dock_tab_move_right = nullptr;
+ Control *dock_select = nullptr;
+ PopupPanel *dock_select_popup = nullptr;
Rect2 dock_select_rect[DOCK_SLOT_MAX];
TabContainer *dock_slot[DOCK_SLOT_MAX];
- Timer *dock_drag_timer;
+ Timer *dock_drag_timer = nullptr;
bool docks_visible = true;
- int dock_popup_selected_idx;
- int dock_select_rect_over_idx;
+ int dock_popup_selected_idx = -1;
+ int dock_select_rect_over_idx = -1;
- HBoxContainer *tabbar_container;
- Button *distraction_free;
- Button *scene_tab_add;
- Control *scene_tab_add_ph;
+ HBoxContainer *tabbar_container = nullptr;
+ Button *distraction_free = nullptr;
+ Button *scene_tab_add = nullptr;
+ Control *scene_tab_add_ph = nullptr;
Vector<BottomPanelItem> bottom_panel_items;
- PanelContainer *bottom_panel;
- HBoxContainer *bottom_panel_hb;
- HBoxContainer *bottom_panel_hb_editors;
- VBoxContainer *bottom_panel_vb;
- EditorToaster *editor_toaster;
- LinkButton *version_btn;
- Button *bottom_panel_raise;
+ PanelContainer *bottom_panel = nullptr;
+ HBoxContainer *bottom_panel_hb = nullptr;
+ HBoxContainer *bottom_panel_hb_editors = nullptr;
+ VBoxContainer *bottom_panel_vb = nullptr;
+ EditorToaster *editor_toaster = nullptr;
+ LinkButton *version_btn = nullptr;
+ Button *bottom_panel_raise = nullptr;
- Tree *disk_changed_list;
- ConfirmationDialog *disk_changed;
+ Tree *disk_changed_list = nullptr;
+ ConfirmationDialog *disk_changed = nullptr;
bool scene_distraction_free = false;
bool script_distraction_free = false;
@@ -445,38 +446,39 @@ private:
bool unsaved_cache = true;
bool waiting_for_first_scan = true;
- int current_menu_option;
+ int current_menu_option = 0;
- SubViewport *scene_root; // Root of the scene being edited.
- Object *current;
+ SubViewport *scene_root = nullptr; // Root of the scene being edited.
+ Object *current = nullptr;
Ref<Resource> saving_resource;
- uint64_t update_spinner_step_msec;
- uint64_t update_spinner_step_frame;
- int update_spinner_step;
+ uint64_t update_spinner_step_msec = 0;
+ uint64_t update_spinner_step_frame = 0;
+ int update_spinner_step = 0;
String _tmp_import_path;
String external_file;
String open_navigate;
String run_custom_filename;
- uint64_t saved_version;
- uint64_t last_checked_version;
+ uint64_t saved_version = 1;
+ uint64_t last_checked_version = 0;
- DynamicFontImportSettings *fontdata_import_settings;
- SceneImportSettings *scene_import_settings;
+ DynamicFontImportSettings *fontdata_import_settings = nullptr;
+ SceneImportSettings *scene_import_settings = nullptr;
String import_reload_fn;
- Set<String> textfile_extensions;
- Set<FileDialog *> file_dialogs;
- Set<EditorFileDialog *> editor_file_dialogs;
+ RBSet<String> textfile_extensions;
+ RBSet<FileDialog *> file_dialogs;
+ RBSet<EditorFileDialog *> editor_file_dialogs;
Vector<Ref<EditorResourceConversionPlugin>> resource_conversion_plugins;
PrintHandlerList print_handler;
- Map<String, Ref<Texture2D>> icon_type_cache;
+ HashMap<String, Ref<Texture2D>> icon_type_cache;
+ HashMap<Ref<Script>, Ref<Texture>> script_icon_cache;
static EditorBuildCallback build_callbacks[MAX_BUILD_CALLBACKS];
static EditorPluginInitializeCallback plugin_init_callbacks[MAX_INIT_CALLBACKS];
@@ -485,9 +487,9 @@ private:
static Vector<EditorNodeInitCallback> _init_callbacks;
static void _dependency_error_report(void *ud, const String &p_path, const String &p_dep, const String &p_type) {
- EditorNode *en = (EditorNode *)ud;
+ EditorNode *en = static_cast<EditorNode *>(ud);
if (!en->dependency_errors.has(p_path)) {
- en->dependency_errors[p_path] = Set<String>();
+ en->dependency_errors[p_path] = RBSet<String>();
}
en->dependency_errors[p_path].insert(p_dep + "::" + p_type);
}
@@ -502,8 +504,8 @@ private:
static void _file_access_close_error_notify(const String &p_str);
static void _print_handler(void *p_this, const String &p_string, bool p_error);
- static void _resource_saved(RES p_resource, const String &p_path);
- static void _resource_loaded(RES p_resource, const String &p_path);
+ static void _resource_saved(Ref<Resource> p_resource, const String &p_path);
+ static void _resource_loaded(Ref<Resource> p_resource, const String &p_path);
void _build_icon_type_cache();
@@ -524,6 +526,7 @@ private:
void _save_screenshot(NodePath p_path);
void _tool_menu_option(int p_idx);
+ void _export_as_menu_option(int p_idx);
void _update_file_menu_opened();
void _update_file_menu_closed();
@@ -575,7 +578,7 @@ private:
void _open_recent_scene(int p_idx);
void _global_menu_scene(const Variant &p_tag);
void _global_menu_new_window(const Variant &p_tag);
- void _dropped_files(const Vector<String> &p_files, int p_screen);
+ void _dropped_files(const Vector<String> &p_files);
void _add_dropped_files_recursive(const Vector<String> &p_files, String to_path);
void _update_from_settings();
@@ -585,15 +588,15 @@ private:
void _exit_editor(int p_exit_code);
- virtual void unhandled_input(const Ref<InputEvent> &p_event) override;
+ virtual void shortcut_input(const Ref<InputEvent> &p_event) override;
bool has_main_screen() const { return true; }
void _remove_edited_scene(bool p_change_tab = true);
void _remove_scene(int index, bool p_change_tab = true);
- bool _find_and_save_resource(RES p_res, Map<RES, bool> &processed, int32_t flags);
- bool _find_and_save_edited_subresources(Object *obj, Map<RES, bool> &processed, int32_t flags);
- void _save_edited_subresources(Node *scene, Map<RES, bool> &processed, int32_t flags);
+ bool _find_and_save_resource(Ref<Resource> p_res, HashMap<Ref<Resource>, bool> &processed, int32_t flags);
+ bool _find_and_save_edited_subresources(Object *obj, HashMap<Ref<Resource>, bool> &processed, int32_t flags);
+ void _save_edited_subresources(Node *scene, HashMap<Ref<Resource>, bool> &processed, int32_t flags);
void _mark_unsaved_scenes();
void _find_node_types(Node *p_node, int &count_2d, int &count_3d);
@@ -753,14 +756,14 @@ public:
void push_item(Object *p_object, const String &p_property = "", bool p_inspector_only = false);
void edit_item(Object *p_object);
- void edit_item_resource(RES p_resource);
+ void edit_item_resource(Ref<Resource> p_resource);
bool item_has_editor(Object *p_object);
void hide_top_editors();
void select_editor_by_name(const String &p_name);
void open_request(const String &p_path);
- void edit_foreign_resource(RES p_resource);
+ void edit_foreign_resource(Ref<Resource> p_resource);
bool is_changing_scene() const;
@@ -793,7 +796,7 @@ public:
Ref<Theme> get_editor_theme() const { return theme; }
Ref<Script> get_object_custom_type_base(const Object *p_object) const;
StringName get_object_custom_type_name(const Object *p_object) const;
- Ref<Texture2D> get_object_icon(const Object *p_object, const String &p_fallback = "Object") const;
+ Ref<Texture2D> get_object_icon(const Object *p_object, const String &p_fallback = "Object");
Ref<Texture2D> get_class_icon(const String &p_class, const String &p_fallback = "Object") const;
void show_accept(const String &p_text, const String &p_title);
@@ -840,6 +843,8 @@ public:
void add_tool_submenu_item(const String &p_name, PopupMenu *p_submenu);
void remove_tool_menu_item(const String &p_name);
+ PopupMenu *get_export_as_menu();
+
void save_all_scenes();
void save_scene_list(Vector<String> p_scene_filenames);
void restart_editor();