Allow using the 3D editor's View menu while previewing a camera

This is already allowed when using cinematic preview, but not
when previewing a Camera3D the usual way.

Many operations from the View menu still work while previewing
a camera, such as switching between debug draw modes and toggling
information panes.
This commit is contained in:
Hugo Locurcio 2021-07-01 12:43:06 +02:00
parent 7ee419f8d9
commit fab3d136e0
No known key found for this signature in database
GPG key ID: 39E8F8BE30B0A49C

View file

@ -3254,14 +3254,12 @@ void Node3DEditorViewport::_toggle_camera_preview(bool p_activate) {
if (!preview) { if (!preview) {
preview_camera->hide(); preview_camera->hide();
} }
view_menu->set_disabled(false);
surface->update(); surface->update();
} else { } else {
previewing = preview; previewing = preview;
previewing->connect("tree_exiting", callable_mp(this, &Node3DEditorViewport::_preview_exited_scene)); previewing->connect("tree_exiting", callable_mp(this, &Node3DEditorViewport::_preview_exited_scene));
RS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), preview->get_camera()); //replace RS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), preview->get_camera()); //replace
view_menu->set_disabled(true);
surface->update(); surface->update();
} }
} }
@ -3508,7 +3506,6 @@ void Node3DEditorViewport::set_state(const Dictionary &p_state) {
previewing = Object::cast_to<Camera3D>(pv); previewing = Object::cast_to<Camera3D>(pv);
previewing->connect("tree_exiting", callable_mp(this, &Node3DEditorViewport::_preview_exited_scene)); previewing->connect("tree_exiting", callable_mp(this, &Node3DEditorViewport::_preview_exited_scene));
RS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), previewing->get_camera()); //replace RS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), previewing->get_camera()); //replace
view_menu->set_disabled(true);
surface->update(); surface->update();
preview_camera->set_pressed(true); preview_camera->set_pressed(true);
preview_camera->show(); preview_camera->show();