diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-08-29 22:59:25 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-08-29 22:59:25 -0300 |
commit | 1bad27e1f8460424fa4476fe65209aa250d43115 (patch) | |
tree | bdd6d510cef95b5a159d4e7b7981bb3be3458711 /tools/editor/plugins/spatial_editor_plugin.cpp | |
parent | b4acd18f3245d0e8c928b1f275847473de8a2270 (diff) | |
download | redot-engine-1bad27e1f8460424fa4476fe65209aa250d43115.tar.gz |
-Properly keep animation editor and viewport state while switching scene tabs
Diffstat (limited to 'tools/editor/plugins/spatial_editor_plugin.cpp')
-rw-r--r-- | tools/editor/plugins/spatial_editor_plugin.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 77663f39c0..8fc6a6931e 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -2168,7 +2168,18 @@ void SpatialEditorViewport::set_state(const Dictionary& p_state) { view_menu->get_popup()->set_item_checked( idx, listener ); } - + if (p_state.has("previewing")) { + Node *pv = EditorNode::get_singleton()->get_edited_scene()->get_node(p_state["previewing"]); + if (pv && pv->cast_to<Camera>()) { + previewing=pv->cast_to<Camera>(); + previewing->connect("exit_tree",this,"_preview_exited_scene"); + VS::get_singleton()->viewport_attach_camera( viewport->get_viewport(), previewing->get_camera() ); //replace + view_menu->hide(); + surface->update(); + preview_camera->set_pressed(true); + preview_camera->show(); + } + } } Dictionary SpatialEditorViewport::get_state() const { @@ -2181,6 +2192,10 @@ Dictionary SpatialEditorViewport::get_state() const { d["use_environment"]=camera->get_environment().is_valid(); d["use_orthogonal"]=camera->get_projection()==Camera::PROJECTION_ORTHOGONAL; d["listener"]=viewport->is_audio_listener(); + if (previewing) { + d["previewing"]=EditorNode::get_singleton()->get_edited_scene()->get_path_to(previewing); + } + return d; } |