diff options
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r-- | editor/editor_node.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index dd3198954d..fa8810c539 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -3664,6 +3664,8 @@ void EditorNode::fix_dependencies(const String &p_for_file) { int EditorNode::new_scene() { int idx = editor_data.add_edited_scene(-1); + _set_current_scene(idx); // Before trying to remove an empty scene, set the current tab index to the newly added tab index. + // Remove placeholder empty scene. if (editor_data.get_edited_scene_count() > 1) { for (int i = 0; i < editor_data.get_edited_scene_count() - 1; i++) { @@ -3674,9 +3676,7 @@ int EditorNode::new_scene() { } } } - idx = MAX(idx, 0); - _set_current_scene(idx); editor_data.clear_editor_states(); scene_tabs->update_scene_tabs(); return idx; @@ -3834,6 +3834,12 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b // If we are, we'll edit it after the restoration is done. if (!restoring_scenes) { push_item(new_scene); + } else { + // Initialize history for restored scenes. + ObjectID id = new_scene->get_instance_id(); + if (id != editor_history.get_current()) { + editor_history.add_object(id); + } } // Load the selected nodes. @@ -5850,6 +5856,14 @@ void EditorNode::add_control_to_dock(DockSlot p_slot, Control *p_control) { } void EditorNode::remove_control_from_dock(Control *p_control) { + // If the dock is floating, close it first. + for (WindowWrapper *wrapper : floating_docks) { + if (p_control == wrapper->get_wrapped_control()) { + wrapper->set_window_enabled(false); + break; + } + } + Control *dock = nullptr; for (int i = 0; i < DOCK_SLOT_MAX; i++) { if (p_control->get_parent() == dock_slot[i]) { @@ -6945,6 +6959,7 @@ EditorNode::EditorNode() { // Exporters might need the theme. EditorColorMap::create(); + EditorTheme::initialize(); theme = create_custom_theme(); DisplayServer::set_early_window_clear_color_override(true, theme->get_color(SNAME("background"), EditorStringName(Editor))); @@ -8032,6 +8047,8 @@ EditorNode::~EditorNode() { memdelete(progress_hb); EditorSettings::destroy(); + EditorColorMap::finish(); + EditorTheme::finalize(); GDExtensionEditorPlugins::editor_node_add_plugin = nullptr; GDExtensionEditorPlugins::editor_node_remove_plugin = nullptr; |