From f36543c5f552eae909e9afd72bef9773138c192a Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 10 Oct 2016 14:47:03 +0200 Subject: Fix viewport camera gets out of sync in certain cases It was possible to have two viewports opened and start using Ctrl-0 to make different objects an active camera for the viewport. This worked fine for viewports which had decoupled camera from the scene, but if viewport was locked to scene camera it was possible to run into situation when two different viewports are locked to scene camera but had different v3d->camera pointers. --- source/blender/makesrna/intern/rna_space.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'source/blender/makesrna/intern') diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 375d370097e..b6c393280ba 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -454,6 +454,15 @@ EnumPropertyItem *rna_TransformOrientation_itemf(bContext *C, PointerRNA *ptr, P } /* Space 3D View */ +static void rna_SpaceView3D_camera_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + View3D *v3d = (View3D *)(ptr->data); + if (v3d->scenelock) { + scene->camera = v3d->camera; + BKE_screen_view3d_main_sync(&bmain->screen, scene); + } +} + static void rna_SpaceView3D_lock_camera_and_layers_set(PointerRNA *ptr, int value) { View3D *v3d = (View3D *)(ptr->data); @@ -2368,7 +2377,7 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "camera"); RNA_def_property_ui_text(prop, "Camera", "Active camera used in this view (when unlocked from the scene's active camera)"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_SpaceView3D_camera_update"); /* render border */ prop = RNA_def_property(srna, "use_render_border", PROP_BOOLEAN, PROP_NONE); -- cgit v1.2.3