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:
authorCampbell Barton <ideasman42@gmail.com>2019-04-14 14:11:17 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-14 14:17:55 +0300
commit2120c5af032831348412a2a8e6c61f82ba1b921c (patch)
treeaffb3acf7fd4c467aab6e7eac873dcf18d2d631a /source/blender/editors/space_view3d/view3d_gizmo_camera.c
parent90e760270aac6a1e995d8bfd629f9da1851a65c9 (diff)
Gizmo: individual toggles for 3D view gizmos
The popover for displaying gizmos now has options for empty, light & camera gizmos. Transform toggles are now checkboxes, which has the advantage that it's more obvious they can be mixed however changing from one to another now uses 3x clicks instead of a single click-drag action. We might need a faster way to switch between transform types.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_gizmo_camera.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_camera.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_camera.c b/source/blender/editors/space_view3d/view3d_gizmo_camera.c
index 8f0a57375fd..590597145a0 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_camera.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_camera.c
@@ -64,6 +64,11 @@ static bool WIDGETGROUP_camera_poll(const bContext *C, wmGizmoGroupType *UNUSED(
if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)) {
return false;
}
+ if ((v3d->gizmo_show_camera & V3D_GIZMO_SHOW_CAMERA_LENS) == 0 &&
+ (v3d->gizmo_show_camera & V3D_GIZMO_SHOW_CAMERA_DOF_DIST) == 0)
+ {
+ return false;
+ }
ViewLayer *view_layer = CTX_data_view_layer(C);
Base *base = BASACT(view_layer);
@@ -133,6 +138,7 @@ static void WIDGETGROUP_camera_refresh(const bContext *C, wmGizmoGroup *gzgroup)
}
struct CameraWidgetGroup *cagzgroup = gzgroup->customdata;
+ View3D *v3d = CTX_wm_view3d(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob = OBACT(view_layer);
Camera *ca = ob->data;
@@ -143,7 +149,9 @@ static void WIDGETGROUP_camera_refresh(const bContext *C, wmGizmoGroup *gzgroup)
negate_v3_v3(dir, ob->obmat[2]);
- if (ca->flag & CAM_SHOWLIMITS) {
+ if ((ca->flag & CAM_SHOWLIMITS) &&
+ (v3d->gizmo_show_camera & V3D_GIZMO_SHOW_CAMERA_DOF_DIST))
+ {
WM_gizmo_set_matrix_location(cagzgroup->dop_dist, ob->obmat[3]);
WM_gizmo_set_matrix_rotation_from_yz_axis(cagzgroup->dop_dist, ob->obmat[1], dir);
WM_gizmo_set_scale(cagzgroup->dop_dist, ca->drawsize);
@@ -232,6 +240,11 @@ static void WIDGETGROUP_camera_refresh(const bContext *C, wmGizmoGroup *gzgroup)
WM_gizmo_target_property_def_rna_ptr(widget, gz_prop_type, &camera_ptr, prop, -1);
}
+ /* This could be handled more elegently (split into two gizmo groups). */
+ if ((v3d->gizmo_show_camera & V3D_GIZMO_SHOW_CAMERA_LENS) == 0) {
+ WM_gizmo_set_flag(cagzgroup->focal_len, WM_GIZMO_HIDDEN, true);
+ WM_gizmo_set_flag(cagzgroup->ortho_scale, WM_GIZMO_HIDDEN, true);
+ }
}
static void WIDGETGROUP_camera_message_subscribe(