summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-10-27 13:59:04 +0100
committerGitHub <noreply@github.com>2019-10-27 13:59:04 +0100
commit816341af25749e3c2ee1fad370c0c5785293f5b6 (patch)
treefda4fd16eb9dda5c01b7140d48f00c121a76256c
parent61785bcc7d49cc2c6f1a351ed591dbf31748625b (diff)
parent4b53a86ce3bb6c1522a130e89631e86411f7204d (diff)
Merge pull request #33107 from volzhs/toggle-camera-preview-error
Fix error when opening or closing scene with camera preview on
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 1d8fd38858..eb39496106 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -2760,6 +2760,7 @@ void SpatialEditorViewport::_menu_option(int p_option) {
void SpatialEditorViewport::_preview_exited_scene() {
+ preview_camera->disconnect("toggled", this, "_toggle_camera_preview");
preview_camera->set_pressed(false);
_toggle_camera_preview(false);
view_menu->show();
@@ -3031,6 +3032,9 @@ void SpatialEditorViewport::set_state(const Dictionary &p_state) {
view_menu->get_popup()->set_item_checked(idx, previewing_cinema);
}
+ if (preview_camera->is_connected("toggled", this, "_toggle_camera_preview")) {
+ preview_camera->disconnect("toggled", this, "_toggle_camera_preview");
+ }
if (p_state.has("previewing")) {
Node *pv = EditorNode::get_singleton()->get_edited_scene()->get_node(p_state["previewing"]);
if (Object::cast_to<Camera>(pv)) {
@@ -3043,6 +3047,7 @@ void SpatialEditorViewport::set_state(const Dictionary &p_state) {
preview_camera->show();
}
}
+ preview_camera->connect("toggled", this, "_toggle_camera_preview");
}
Dictionary SpatialEditorViewport::get_state() const {
@@ -3594,7 +3599,6 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed
vbox->add_child(preview_camera);
preview_camera->set_h_size_flags(0);
preview_camera->hide();
- preview_camera->connect("toggled", this, "_toggle_camera_preview");
previewing = NULL;
gizmo_scale = 1.0;