diff options
Diffstat (limited to 'editor/editor_plugin.cpp')
-rw-r--r-- | editor/editor_plugin.cpp | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index 566c22f5a9..4fc6947636 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -35,6 +35,7 @@ #include "editor/editor_paths.h" #include "editor/editor_resource_preview.h" #include "editor/editor_settings.h" +#include "editor/editor_undo_redo_manager.h" #include "editor/export/editor_export.h" #include "editor/filesystem_dock.h" #include "editor/plugins/canvas_item_editor_plugin.h" @@ -47,7 +48,7 @@ #include "scene/gui/popup_menu.h" #include "servers/rendering_server.h" -Array EditorInterface::_make_mesh_previews(const Array &p_meshes, int p_preview_size) { +TypedArray<Texture2D> EditorInterface::_make_mesh_previews(const Array &p_meshes, int p_preview_size) { Vector<Ref<Mesh>> meshes; for (int i = 0; i < p_meshes.size(); i++) { @@ -55,7 +56,7 @@ Array EditorInterface::_make_mesh_previews(const Array &p_meshes, int p_preview_ } Vector<Ref<Texture2D>> textures = make_mesh_previews(meshes, nullptr, p_preview_size); - Array ret; + TypedArray<Texture2D> ret; for (int i = 0; i < textures.size(); i++) { ret.push_back(textures[i]); } @@ -215,8 +216,8 @@ Node *EditorInterface::get_edited_scene_root() { return EditorNode::get_singleton()->get_edited_scene(); } -Array EditorInterface::get_open_scenes() const { - Array ret; +PackedStringArray EditorInterface::get_open_scenes() const { + PackedStringArray ret; Vector<EditorData::EditedScene> scenes = EditorNode::get_editor_data().get_edited_scenes(); int scns_amount = scenes.size(); @@ -312,6 +313,13 @@ void EditorInterface::set_distraction_free_mode(bool p_enter) { EditorNode::get_singleton()->set_distraction_free_mode(p_enter); } +void EditorInterface::restart_editor(bool p_save) { + if (p_save) { + EditorNode::get_singleton()->save_all_scenes(); + } + EditorNode::get_singleton()->restart_editor(); +} + bool EditorInterface::is_distraction_free_mode_enabled() const { return EditorNode::get_singleton()->is_distraction_free_mode_enabled(); } @@ -360,6 +368,7 @@ void EditorInterface::_bind_methods() { ClassDB::bind_method(D_METHOD("save_scene"), &EditorInterface::save_scene); ClassDB::bind_method(D_METHOD("save_scene_as", "path", "with_preview"), &EditorInterface::save_scene_as, DEFVAL(true)); + ClassDB::bind_method(D_METHOD("restart_editor", "save"), &EditorInterface::restart_editor, DEFVAL(true)); ClassDB::bind_method(D_METHOD("set_main_screen_editor", "name"), &EditorInterface::set_main_screen_editor); ClassDB::bind_method(D_METHOD("set_distraction_free_mode", "enter"), &EditorInterface::set_distraction_free_mode); @@ -445,7 +454,7 @@ void EditorPlugin::add_control_to_container(CustomControlContainer p_location, C CanvasItemEditor::get_singleton()->get_bottom_split()->add_child(p_control); } break; - case CONTAINER_PROPERTY_EDITOR_BOTTOM: { + case CONTAINER_INSPECTOR_BOTTOM: { InspectorDock::get_singleton()->get_addon_area()->add_child(p_control); } break; @@ -498,7 +507,7 @@ void EditorPlugin::remove_control_from_container(CustomControlContainer p_locati CanvasItemEditor::get_singleton()->get_bottom_split()->remove_child(p_control); } break; - case CONTAINER_PROPERTY_EDITOR_BOTTOM: { + case CONTAINER_INSPECTOR_BOTTOM: { InspectorDock::get_singleton()->get_addon_area()->remove_child(p_control); } break; @@ -590,7 +599,7 @@ int EditorPlugin::update_overlays() const { return count; } else { // This will update the normal viewport itself as well - CanvasItemEditor::get_singleton()->get_viewport_control()->update(); + CanvasItemEditor::get_singleton()->get_viewport_control()->queue_redraw(); return 1; } } @@ -885,7 +894,7 @@ void EditorPlugin::_bind_methods() { ClassDB::bind_method(D_METHOD("make_bottom_panel_item_visible", "item"), &EditorPlugin::make_bottom_panel_item_visible); ClassDB::bind_method(D_METHOD("hide_bottom_panel"), &EditorPlugin::hide_bottom_panel); - ClassDB::bind_method(D_METHOD("get_undo_redo"), &EditorPlugin::_get_undo_redo); + ClassDB::bind_method(D_METHOD("get_undo_redo"), &EditorPlugin::get_undo_redo); ClassDB::bind_method(D_METHOD("add_undo_redo_inspector_hook_callback", "callable"), &EditorPlugin::add_undo_redo_inspector_hook_callback); ClassDB::bind_method(D_METHOD("remove_undo_redo_inspector_hook_callback", "callable"), &EditorPlugin::remove_undo_redo_inspector_hook_callback); ClassDB::bind_method(D_METHOD("queue_save_layout"), &EditorPlugin::queue_save_layout); @@ -950,7 +959,7 @@ void EditorPlugin::_bind_methods() { BIND_ENUM_CONSTANT(CONTAINER_CANVAS_EDITOR_SIDE_LEFT); BIND_ENUM_CONSTANT(CONTAINER_CANVAS_EDITOR_SIDE_RIGHT); BIND_ENUM_CONSTANT(CONTAINER_CANVAS_EDITOR_BOTTOM); - BIND_ENUM_CONSTANT(CONTAINER_PROPERTY_EDITOR_BOTTOM); + BIND_ENUM_CONSTANT(CONTAINER_INSPECTOR_BOTTOM); BIND_ENUM_CONSTANT(CONTAINER_PROJECT_SETTING_TAB_LEFT); BIND_ENUM_CONSTANT(CONTAINER_PROJECT_SETTING_TAB_RIGHT); @@ -965,6 +974,10 @@ void EditorPlugin::_bind_methods() { BIND_ENUM_CONSTANT(DOCK_SLOT_MAX); } +Ref<EditorUndoRedoManager> EditorPlugin::get_undo_redo() { + return undo_redo; +} + EditorPluginCreateFunc EditorPlugins::creation_funcs[MAX_CREATE_FUNCS]; int EditorPlugins::creation_func_count = 0; |