Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2016-10-10 15:47:03 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-10-10 16:05:05 +0300
commitf36543c5f552eae909e9afd72bef9773138c192a (patch)
tree89e01e29143deebf64582f3ff9a7571c5cafb6b4 /source/blender/makesrna/intern
parent54dad5c49fb7f1bd6de0731756e2fadb863ed1b8 (diff)
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.
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r--source/blender/makesrna/intern/rna_space.c11
1 files changed, 10 insertions, 1 deletions
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);