Fix T62317: missing Cycles viewport update when changing active camera.

This commit is contained in:
Brecht Van Lommel 2019-03-08 12:11:42 +01:00
parent cf09a2443c
commit 49b9b159e4
Notes: blender-bot 2023-02-14 10:18:56 +01:00
Referenced by issue #62317, Switching between active cameras doesnt update camera shift in Viewport
3 changed files with 9 additions and 4 deletions

View File

@ -3899,8 +3899,10 @@ static int view_camera_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* important these don't get out of sync for locked scenes */
if (v3d->scenelock)
if (v3d->scenelock && scene->camera != v3d->camera) {
scene->camera = v3d->camera;
DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
}
/* finally do snazzy view zooming */
rv3d->persp = RV3D_CAMOB;

View File

@ -639,8 +639,10 @@ static int view3d_setobjectascamera_exec(bContext *C, wmOperator *op)
Object *camera_old = (rv3d->persp == RV3D_CAMOB) ? V3D_CAMERA_SCENE(scene, v3d) : NULL;
rv3d->persp = RV3D_CAMOB;
v3d->camera = ob;
if (v3d->scenelock)
if (v3d->scenelock && scene->camera != ob) {
scene->camera = ob;
DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
}
/* unlikely but looks like a glitch when set to the same */
if (camera_old != ob) {

View File

@ -659,12 +659,13 @@ void rna_Scene_set_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
}
}
static void rna_Scene_view3d_update(Main *bmain, Scene *UNUSED(scene_unused), PointerRNA *ptr)
static void rna_Scene_camera_update(Main *bmain, Scene *UNUSED(scene_unused), PointerRNA *ptr)
{
wmWindowManager *wm = bmain->wm.first;
Scene *scene = (Scene *)ptr->data;
WM_windows_scene_data_sync(&wm->windows, scene);
DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
}
static void rna_Scene_fps_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
@ -6387,7 +6388,7 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Camera_object_poll");
RNA_def_property_ui_text(prop, "Camera", "Active camera, used for rendering the scene");
RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_view3d_update");
RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_camera_update");
prop = RNA_def_property(srna, "background_set", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "set");