### Godot version

v4.2.dev (221884e6b)

### System information

Godot v4.2.dev (221884e6b) - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3070 Ti Laptop GPU (NVIDIA; 31.0.15.3699) - 12th Gen Intel(R) Core(TM) i7-12700H (20 Threads)

### Issue description

When you are switching between open scenes the animation toolbar above the viewport can appear out of context. One example is having an animation player in a 3D scene (there is no animation toolbar in the 3D viewport), then switching to a 2D scene. The toolbar would be visible and the bottom panel would be expanded, despite no animation player or active animation being present in the second scene. Toggling the bottom panel fixes the state.

### Steps to reproduce


https://github.com/godotengine/godot/assets/11782833/f60cef64-1abc-4908-91ef-a8d12204383c



### Minimal reproduction project

N/a
undo_redo->add_do_method(viewport, "queue_redraw");
			undo_redo->add_undo_method(viewport, "queue_redraw");
			undo_redo->commit_action();
		} break;
		case UNGROUP_SELECTED: {
			undo_redo->create_action(TTR("Ungroup Selected"));
			List<Node *> selection = editor_selection->get_selected_node_list();
			for (Node *E : selection) {
				CanvasItem *ci = Object::cast_to<CanvasItem>(E);
				if (!ci || !ci->is_inside_tree()) {
					continue;
				}
				if (ci->get_viewport() != EditorNode::get_singleton()->get_scene_root()) {
					continue;
				}
				undo_redo->add_do_method(ci, "remove_meta", "_edit_group_");
				undo_redo->add_undo_method(ci, "set_meta", "_edit_group_", true);
				undo_redo->add_do_method(this, "emit_signal", "item_group_status_changed");
				undo_redo->add_undo_method(this, "emit_signal", "item_group_status_changed");
			}
			undo_redo->add_do_method(viewport, "queue_redraw");
			undo_redo->add_undo_method(viewport, "queue_redraw");
			undo_redo->commit_action();
		} break;
		case ANIM_INSERT_KEY:
		case ANIM_INSERT_KEY_EXISTING: {
			bool existing = p_op == ANIM_INSERT_KEY_EXISTING;
			_insert_animation_keys(true, true, true, existing);
		} break;
		case ANIM_INSERT_POS: {