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
This commit is contained in:
parent
15bae8ac00
commit
6100dc6a20
Notes:
blender-bot
2023-02-14 03:59:46 +01:00
Referenced by issue #60756, Several Cameras to different viewports
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue