Commit: 6100dc6a202cb19a13b30210dc4a5afabd3afaa4
Author: Philipp Oeser
Date:   Thu Jan 24 17:20:04 2019 +0100
Branches: master
https://developer.blender.org/rB6100dc6a202cb19a13b30210dc4a5afabd3afaa4

bring back possibility to override camera per view

this can now be found in the sidebar View panel

- uses existing 'lock_camera_and_layers' but renames the property to
'use_local_camera'
- uses RNA_def_property_boolean_negative_sdna to flip the value
- remove the local view code in
rna_SpaceView3D_lock_camera_and_layers_set
- update Python code
- update Addons code will be separate commit

Fixes T60756

Reviewers: billreynish, brecht

Maniphest Tasks: T60756

Differential Revision: https://developer.blender.org/D4247

===================================================================

M       intern/cycles/blender/blender_camera.cpp
M       release/scripts/startup/bl_operators/object.py
M       release/scripts/startup/bl_ui/space_view3d.py
M       source/blender/makesrna/intern/rna_space.c

===================================================================

diff --git a/intern/cycles/blender/blender_camera.cpp 
b/intern/cycles/blender/blender_camera.cpp
index b41749a7f81..21efba4cdf0 100644
--- a/intern/cycles/blender/blender_camera.cpp
+++ b/intern/cycles/blender/blender_camera.cpp
@@ -648,7 +648,7 @@ static void blender_camera_from_view(BlenderCamera *bcam,
 
        if(b_rv3d.view_perspective() == 
BL::RegionView3D::view_perspective_CAMERA) {
                /* camera view */
-               BL::Object b_ob = (b_v3d.lock_camera_and_layers())? 
b_scene.camera(): b_v3d.camera();
+               BL::Object b_ob = (b_v3d.use_local_camera())? b_v3d.camera(): 
b_scene.camera();
 
                if(b_ob) {
                        blender_camera_from_object(bcam, b_engine, b_ob, 
skip_panorama);
@@ -784,7 +784,7 @@ static void blender_camera_border(BlenderCamera *bcam,
                return;
        }
 
-       BL::Object b_ob = (b_v3d.lock_camera_and_layers())? b_scene.camera(): 
b_v3d.camera();
+       BL::Object b_ob = (b_v3d.use_local_camera())? b_v3d.camera(): 
b_scene.camera();
 
        if(!b_ob)
                return;
diff --git a/release/scripts/startup/bl_operators/object.py 
b/release/scripts/startup/bl_operators/object.py
index d4085d70143..c945d15267a 100644
--- a/release/scripts/startup/bl_operators/object.py
+++ b/release/scripts/startup/bl_operators/object.py
@@ -133,7 +133,7 @@ class SelectCamera(Operator):
         scene = context.scene
         view_layer = context.view_layer
         view = context.space_data
-        if view.type == 'VIEW_3D' and not view.lock_camera_and_layers:
+        if view.type == 'VIEW_3D' and view.use_local_camera:
             camera = view.camera
         else:
             camera = scene.camera
diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index f0bbc1d39dc..5e42e0b655b 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -4206,7 +4206,10 @@ class VIEW3D_PT_view3d_properties(Panel):
         col = flow.column()
 
         subcol = col.column()
-        subcol.enabled = not view.lock_camera_and_layers
+        subcol.prop(view, "use_local_camera")
+
+        subcol = col.column()
+        subcol.enabled = view.use_local_camera
         subcol.prop(view, "camera", text="Local Camera")
 
         subcol = col.column(align=True)
diff --git a/source/blender/makesrna/intern/rna_space.c 
b/source/blender/makesrna/intern/rna_space.c
index 640929ead19..6fa13cadbd6 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -531,31 +531,15 @@ static void rna_SpaceView3D_camera_update(Main *bmain, 
Scene *scene, PointerRNA
        }
 }
 
-static void rna_SpaceView3D_lock_camera_and_layers_set(PointerRNA *ptr, bool 
value)
+static void rna_SpaceView3D_use_local_camera_set(PointerRNA *ptr, bool value)
 {
        View3D *v3d = (View3D *)(ptr->data);
        bScreen *sc = (bScreen *)ptr->id.data;
 
-       v3d->scenelock = value;
+       v3d->scenelock = !value;
 
-       if (value) {
+       if (!value) {
                Scene *scene = ED_screen_scene_find(sc, G_MAIN->wm.first);
-
-               /* TODO: restore local view. */
-#if 0
-               int bit;
-               v3d->lay = scene->lay;
-
-               /* seek for layact */
-               bit = 0;
-               while (bit < 32) {
-                       if (v3d->lay & (1u << bit)) {
-                               v3d->layact = (1u << bit);
-                               break;
-                       }
-                       bit++;
-               }
-#endif
                v3d->camera = scene->camera;
        }
 }
@@ -3189,12 +3173,11 @@ static void rna_def_space_view3d(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Tool Gizmo", "Active tool gizmo");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 
-       prop = RNA_def_property(srna, "lock_camera_and_layers", PROP_BOOLEAN, 
PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "scenelock", 1);
-       RNA_def_property_boolean_funcs(prop, NULL, 
"rna_SpaceView3D_lock_camera_and_layers_set");
-       RNA_def_property_ui_text(prop, "Lock Camera and Layers",
-                                "Use the scene's active camera and layers in 
this view, rather than local layers");
-       RNA_def_property_ui_icon(prop, ICON_LOCKVIEW_OFF, 1);
+       prop = RNA_def_property(srna, "use_local_camera", PROP_BOOLEAN, 
PROP_NONE);
+       RNA_def_property_boolean_negative_sdna(prop, NULL, "scenelock", 1);
+       RNA_def_property_boolean_funcs(prop, NULL, 
"rna_SpaceView3D_use_local_camera_set");
+       RNA_def_property_ui_text(prop, "Use Local Camera",
+                                "Use a local camera in this view, rather than 
scene's active camera camera");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 
        prop = RNA_def_property(srna, "region_3d", PROP_POINTER, PROP_NONE);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to