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:
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py23
-rw-r--r--source/blender/blenkernel/intern/scene.c8
-rw-r--r--source/blender/blenloader/intern/versioning_280.c16
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_camera.c15
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_empty.c3
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_forcefield.c3
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_light.c13
-rw-r--r--source/blender/editors/transform/transform_gizmo_3d.c71
-rw-r--r--source/blender/makesdna/DNA_view3d_types.h58
-rw-r--r--source/blender/makesrna/intern/rna_space.c73
10 files changed, 202 insertions, 81 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index a3d5045135b..4413e4f06eb 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -4788,11 +4788,24 @@ class VIEW3D_PT_gizmo_display(Panel):
colsub.prop(view, "show_gizmo_tool", text="Active Tools")
colsub.prop(view, "show_gizmo_context", text="Active Object")
- col.label(text="Transform Gizmos")
- rowsub = col.row()
- rowsub.active = view.show_gizmo_context
- rowsub.prop(view, "show_gizmo_transform")
- col.prop(scene.transform_orientation_slots[1], "type", text="")
+ colsub = col.column()
+ colsub.active = view.show_gizmo_context
+ colsub.label(text="Object Gizmos")
+ colsub.prop(scene.transform_orientation_slots[1], "type", text="")
+ colsub.prop(view, "show_gizmo_object_translate", text="Move")
+ colsub.prop(view, "show_gizmo_object_rotate", text="Rotate")
+ colsub.prop(view, "show_gizmo_object_scale", text="Scale")
+
+ # Match order of object type visibility
+ colsub.label(text="Empty")
+ colsub.prop(view, "show_gizmo_empty_image", text="Image")
+ colsub.prop(view, "show_gizmo_empty_force_field", text="Force Field")
+ colsub.label(text="Light")
+ colsub.prop(view, "show_gizmo_light_size", text="Size")
+ colsub.prop(view, "show_gizmo_light_look_at", text="Look At")
+ colsub.label(text="Camera")
+ colsub.prop(view, "show_gizmo_camera_lens", text="Lens")
+ colsub.prop(view, "show_gizmo_camera_dof_distance", text="Focus Distance")
class VIEW3D_PT_overlay(Panel):
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 630441265e1..361459c7c18 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -1356,15 +1356,15 @@ TransformOrientationSlot *BKE_scene_orientation_slot_get(Scene *scene, int slot_
TransformOrientationSlot *BKE_scene_orientation_slot_get_from_flag(Scene *scene, int flag)
{
- BLI_assert(flag && !(flag & ~(V3D_GIZMO_TYPE_MASK_TRANSLATE | V3D_GIZMO_TYPE_MASK_ROTATE | V3D_GIZMO_TYPE_MASK_SCALE)));
+ BLI_assert(flag && !(flag & ~(V3D_GIZMO_SHOW_OBJECT_TRANSLATE | V3D_GIZMO_SHOW_OBJECT_ROTATE | V3D_GIZMO_SHOW_OBJECT_SCALE)));
int slot_index = SCE_ORIENT_DEFAULT;
- if (flag & V3D_GIZMO_TYPE_MASK_TRANSLATE) {
+ if (flag & V3D_GIZMO_SHOW_OBJECT_TRANSLATE) {
slot_index = SCE_ORIENT_TRANSLATE;
}
- else if (flag & V3D_GIZMO_TYPE_MASK_ROTATE) {
+ else if (flag & V3D_GIZMO_SHOW_OBJECT_ROTATE) {
slot_index = SCE_ORIENT_ROTATE;
}
- else if (flag & V3D_GIZMO_TYPE_MASK_SCALE) {
+ else if (flag & V3D_GIZMO_SHOW_OBJECT_SCALE) {
slot_index = SCE_ORIENT_SCALE;
}
return BKE_scene_orientation_slot_get(scene, slot_index);
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 8d20cc0a820..952c3646e2e 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -3080,6 +3080,22 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
+ if (!MAIN_VERSION_ATLEAST(bmain, 280, 56)) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+ for (ScrArea *area = screen->areabase.first; area; area = area->next) {
+ for (SpaceLink *sl = area->spacedata.first; sl; sl = sl->next) {
+ if (sl->spacetype == SPACE_VIEW3D) {
+ View3D *v3d = (View3D *)sl;
+ v3d->gizmo_show_armature = V3D_GIZMO_SHOW_ARMATURE_BBONE | V3D_GIZMO_SHOW_ARMATURE_ROLL;
+ v3d->gizmo_show_empty = V3D_GIZMO_SHOW_EMPTY_IMAGE | V3D_GIZMO_SHOW_EMPTY_FORCE_FIELD;
+ v3d->gizmo_show_light = V3D_GIZMO_SHOW_LIGHT_SIZE | V3D_GIZMO_SHOW_LIGHT_LOOK_AT;
+ v3d->gizmo_show_camera = V3D_GIZMO_SHOW_CAMERA_LENS | V3D_GIZMO_SHOW_CAMERA_DOF_DIST;
+ }
+ }
+ }
+ }
+ }
+
{
/* Versioning code until next subversion bump goes here. */
}
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(
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_empty.c b/source/blender/editors/space_view3d/view3d_gizmo_empty.c
index b44e48a0670..8e78fe8a18e 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_empty.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_empty.c
@@ -109,6 +109,9 @@ static bool WIDGETGROUP_empty_image_poll(const bContext *C, wmGizmoGroupType *UN
if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)) {
return false;
}
+ if ((v3d->gizmo_show_empty & V3D_GIZMO_SHOW_EMPTY_IMAGE) == 0) {
+ return false;
+ }
ViewLayer *view_layer = CTX_data_view_layer(C);
Base *base = BASACT(view_layer);
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c b/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c
index 8aa5cca4cbf..34cf38b3466 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c
@@ -52,6 +52,9 @@ static bool WIDGETGROUP_forcefield_poll(const bContext *C, wmGizmoGroupType *UNU
if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)) {
return false;
}
+ if ((v3d->gizmo_show_empty & V3D_GIZMO_SHOW_EMPTY_FORCE_FIELD) == 0) {
+ return false;
+ }
ViewLayer *view_layer = CTX_data_view_layer(C);
Base *base = BASACT(view_layer);
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_light.c b/source/blender/editors/space_view3d/view3d_gizmo_light.c
index f8f9951c20e..5fd5336f4ca 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_light.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_light.c
@@ -54,6 +54,9 @@ static bool WIDGETGROUP_light_spot_poll(const bContext *C, wmGizmoGroupType *UNU
if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)) {
return false;
}
+ if ((v3d->gizmo_show_light & V3D_GIZMO_SHOW_LIGHT_SIZE) == 0) {
+ return false;
+ }
ViewLayer *view_layer = CTX_data_view_layer(C);
Base *base = BASACT(view_layer);
@@ -159,7 +162,10 @@ static void gizmo_area_light_prop_matrix_set(
static bool WIDGETGROUP_light_area_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt))
{
View3D *v3d = CTX_wm_view3d(C);
- if (v3d->flag2 & V3D_HIDE_OVERLAYS) {
+ if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)) {
+ return false;
+ }
+ if ((v3d->gizmo_show_light & V3D_GIZMO_SHOW_LIGHT_SIZE) == 0) {
return false;
}
@@ -242,7 +248,10 @@ void VIEW3D_GGT_light_area(wmGizmoGroupType *gzgt)
static bool WIDGETGROUP_light_target_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt))
{
View3D *v3d = CTX_wm_view3d(C);
- if (v3d->flag2 & V3D_HIDE_OVERLAYS) {
+ if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)) {
+ return false;
+ }
+ if ((v3d->gizmo_show_light & V3D_GIZMO_SHOW_LIGHT_LOOK_AT) == 0) {
return false;
}
diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c
index a13da29fd4c..77480e1a8ce 100644
--- a/source/blender/editors/transform/transform_gizmo_3d.c
+++ b/source/blender/editors/transform/transform_gizmo_3d.c
@@ -274,9 +274,9 @@ static bool gizmo_is_axis_visible(
}
}
- if ((axis_type == MAN_AXES_TRANSLATE && !(twtype & V3D_GIZMO_TYPE_MASK_TRANSLATE)) ||
- (axis_type == MAN_AXES_ROTATE && !(twtype & V3D_GIZMO_TYPE_MASK_ROTATE)) ||
- (axis_type == MAN_AXES_SCALE && !(twtype & V3D_GIZMO_TYPE_MASK_SCALE)))
+ if ((axis_type == MAN_AXES_TRANSLATE && !(twtype & V3D_GIZMO_SHOW_OBJECT_TRANSLATE)) ||
+ (axis_type == MAN_AXES_ROTATE && !(twtype & V3D_GIZMO_SHOW_OBJECT_ROTATE)) ||
+ (axis_type == MAN_AXES_SCALE && !(twtype & V3D_GIZMO_SHOW_OBJECT_SCALE)))
{
return false;
}
@@ -306,34 +306,34 @@ static bool gizmo_is_axis_visible(
case MAN_AXIS_SCALE_Z:
return (rv3d->twdrawflag & MAN_SCALE_Z);
case MAN_AXIS_SCALE_C:
- return (rv3d->twdrawflag & MAN_SCALE_C && (twtype & V3D_GIZMO_TYPE_MASK_TRANSLATE) == 0);
+ return (rv3d->twdrawflag & MAN_SCALE_C && (twtype & V3D_GIZMO_SHOW_OBJECT_TRANSLATE) == 0);
case MAN_AXIS_TRANS_XY:
return (rv3d->twdrawflag & MAN_TRANS_X &&
rv3d->twdrawflag & MAN_TRANS_Y &&
- (twtype & V3D_GIZMO_TYPE_MASK_ROTATE) == 0);
+ (twtype & V3D_GIZMO_SHOW_OBJECT_ROTATE) == 0);
case MAN_AXIS_TRANS_YZ:
return (rv3d->twdrawflag & MAN_TRANS_Y &&
rv3d->twdrawflag & MAN_TRANS_Z &&
- (twtype & V3D_GIZMO_TYPE_MASK_ROTATE) == 0);
+ (twtype & V3D_GIZMO_SHOW_OBJECT_ROTATE) == 0);
case MAN_AXIS_TRANS_ZX:
return (rv3d->twdrawflag & MAN_TRANS_Z &&
rv3d->twdrawflag & MAN_TRANS_X &&
- (twtype & V3D_GIZMO_TYPE_MASK_ROTATE) == 0);
+ (twtype & V3D_GIZMO_SHOW_OBJECT_ROTATE) == 0);
case MAN_AXIS_SCALE_XY:
return (rv3d->twdrawflag & MAN_SCALE_X &&
rv3d->twdrawflag & MAN_SCALE_Y &&
- (twtype & V3D_GIZMO_TYPE_MASK_TRANSLATE) == 0 &&
- (twtype & V3D_GIZMO_TYPE_MASK_ROTATE) == 0);
+ (twtype & V3D_GIZMO_SHOW_OBJECT_TRANSLATE) == 0 &&
+ (twtype & V3D_GIZMO_SHOW_OBJECT_ROTATE) == 0);
case MAN_AXIS_SCALE_YZ:
return (rv3d->twdrawflag & MAN_SCALE_Y &&
rv3d->twdrawflag & MAN_SCALE_Z &&
- (twtype & V3D_GIZMO_TYPE_MASK_TRANSLATE) == 0 &&
- (twtype & V3D_GIZMO_TYPE_MASK_ROTATE) == 0);
+ (twtype & V3D_GIZMO_SHOW_OBJECT_TRANSLATE) == 0 &&
+ (twtype & V3D_GIZMO_SHOW_OBJECT_ROTATE) == 0);
case MAN_AXIS_SCALE_ZX:
return (rv3d->twdrawflag & MAN_SCALE_Z &&
rv3d->twdrawflag & MAN_SCALE_X &&
- (twtype & V3D_GIZMO_TYPE_MASK_TRANSLATE) == 0 &&
- (twtype & V3D_GIZMO_TYPE_MASK_ROTATE) == 0);
+ (twtype & V3D_GIZMO_SHOW_OBJECT_TRANSLATE) == 0 &&
+ (twtype & V3D_GIZMO_SHOW_OBJECT_ROTATE) == 0);
}
return false;
}
@@ -1185,15 +1185,15 @@ static void gizmo_line_range(const int twtype, const short axis_type, float *r_s
switch (axis_type) {
case MAN_AXES_TRANSLATE:
- if (twtype & V3D_GIZMO_TYPE_MASK_SCALE) {
+ if (twtype & V3D_GIZMO_SHOW_OBJECT_SCALE) {
*r_start = *r_len - ofs + 0.075f;
}
- if (twtype & V3D_GIZMO_TYPE_MASK_ROTATE) {
+ if (twtype & V3D_GIZMO_SHOW_OBJECT_ROTATE) {
*r_len += ofs;
}
break;
case MAN_AXES_SCALE:
- if (twtype & (V3D_GIZMO_TYPE_MASK_TRANSLATE | V3D_GIZMO_TYPE_MASK_ROTATE)) {
+ if (twtype & (V3D_GIZMO_SHOW_OBJECT_TRANSLATE | V3D_GIZMO_SHOW_OBJECT_ROTATE)) {
*r_len -= ofs + 0.025f;
}
break;
@@ -1219,11 +1219,11 @@ static void gizmo_xform_message_subscribe(
orient_flag = ggd->twtype_init;
}
else if (type_fn == VIEW3D_GGT_xform_cage) {
- orient_flag = V3D_GIZMO_TYPE_MASK_SCALE;
+ orient_flag = V3D_GIZMO_SHOW_OBJECT_SCALE;
/* pass */
}
else if (type_fn == VIEW3D_GGT_xform_shear) {
- orient_flag = V3D_GIZMO_TYPE_MASK_ROTATE;
+ orient_flag = V3D_GIZMO_SHOW_OBJECT_ROTATE;
}
TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get_from_flag(scene, orient_flag);
PointerRNA orient_ref_ptr;
@@ -1283,14 +1283,19 @@ static void gizmo_xform_message_subscribe(
if (type_fn == VIEW3D_GGT_xform_gizmo) {
GizmoGroup *ggd = gzgroup->customdata;
- extern PropertyRNA rna_SpaceView3D_show_gizmo_transform;
- const PropertyRNA *props[] = {
- ggd->use_twtype_refresh ? &rna_SpaceView3D_show_gizmo_transform : NULL,
- };
- for (int i = 0; i < ARRAY_SIZE(props); i++) {
- WM_msg_subscribe_rna(mbus, &view3d_ptr, props[i], &msg_sub_value_gz_tag_refresh, __func__);
+ if (ggd->use_twtype_refresh) {
+ extern PropertyRNA rna_SpaceView3D_show_gizmo_object_translate;
+ extern PropertyRNA rna_SpaceView3D_show_gizmo_object_rotate;
+ extern PropertyRNA rna_SpaceView3D_show_gizmo_object_scale;
+ const PropertyRNA *props[] = {
+ &rna_SpaceView3D_show_gizmo_object_translate,
+ &rna_SpaceView3D_show_gizmo_object_rotate,
+ &rna_SpaceView3D_show_gizmo_object_scale,
+ };
+ for (int i = 0; i < ARRAY_SIZE(props); i++) {
+ WM_msg_subscribe_rna(mbus, &view3d_ptr, props[i], &msg_sub_value_gz_tag_refresh, __func__);
+ }
}
-
}
else if (type_fn == VIEW3D_GGT_xform_cage) {
/* pass */
@@ -1526,7 +1531,7 @@ static void gizmogroup_init_properties_from_twtype(wmGizmoGroup *gzgroup)
case MAN_AXIS_SCALE_Z:
if (axis_idx >= MAN_AXIS_RANGE_TRANS_START && axis_idx < MAN_AXIS_RANGE_TRANS_END) {
int draw_options = 0;
- if ((ggd->twtype & (V3D_GIZMO_TYPE_MASK_ROTATE | V3D_GIZMO_TYPE_MASK_SCALE)) == 0) {
+ if ((ggd->twtype & (V3D_GIZMO_SHOW_OBJECT_ROTATE | V3D_GIZMO_SHOW_OBJECT_SCALE)) == 0) {
draw_options |= ED_GIZMO_ARROW_DRAW_FLAG_STEM;
}
RNA_enum_set(axis->ptr, "draw_options", draw_options);
@@ -1634,17 +1639,17 @@ static void WIDGETGROUP_gizmo_setup(const bContext *C, wmGizmoGroup *gzgroup)
ggd->twtype = 0;
if (tref && STREQ(tref->idname, "builtin.move")) {
- ggd->twtype |= V3D_GIZMO_TYPE_MASK_TRANSLATE;
+ ggd->twtype |= V3D_GIZMO_SHOW_OBJECT_TRANSLATE;
}
else if (tref && STREQ(tref->idname, "builtin.rotate")) {
- ggd->twtype |= V3D_GIZMO_TYPE_MASK_ROTATE;
+ ggd->twtype |= V3D_GIZMO_SHOW_OBJECT_ROTATE;
}
else if (tref && STREQ(tref->idname, "builtin.scale")) {
- ggd->twtype |= V3D_GIZMO_TYPE_MASK_SCALE;
+ ggd->twtype |= V3D_GIZMO_SHOW_OBJECT_SCALE;
}
else {
/* Setup all gizmos, they can be toggled via 'ToolSettings.gizmo_flag' */
- ggd->twtype = V3D_GIZMO_TYPE_MASK_TRANSLATE | V3D_GIZMO_TYPE_MASK_ROTATE | V3D_GIZMO_TYPE_MASK_SCALE;
+ ggd->twtype = V3D_GIZMO_SHOW_OBJECT_TRANSLATE | V3D_GIZMO_SHOW_OBJECT_ROTATE | V3D_GIZMO_SHOW_OBJECT_SCALE;
ggd->use_twtype_refresh = true;
}
BLI_assert(ggd->twtype != 0);
@@ -1666,7 +1671,7 @@ static void WIDGETGROUP_gizmo_refresh(const bContext *C, wmGizmoGroup *gzgroup)
struct TransformBounds tbounds;
if (ggd->use_twtype_refresh) {
- ggd->twtype = v3d->gizmo_type_mask & ggd->twtype_init;
+ ggd->twtype = v3d->gizmo_show_object & ggd->twtype_init;
if (ggd->twtype != ggd->twtype_prev) {
ggd->twtype_prev = ggd->twtype;
gizmogroup_init_properties_from_twtype(gzgroup);
@@ -1715,7 +1720,7 @@ static void WIDGETGROUP_gizmo_refresh(const bContext *C, wmGizmoGroup *gzgroup)
RNA_float_set(axis->ptr, "length", len);
if (axis_idx >= MAN_AXIS_RANGE_TRANS_START && axis_idx < MAN_AXIS_RANGE_TRANS_END) {
- if (ggd->twtype & V3D_GIZMO_TYPE_MASK_ROTATE) {
+ if (ggd->twtype & V3D_GIZMO_SHOW_OBJECT_ROTATE) {
/* Avoid rotate and translate arrows overlap. */
start_co[2] += 0.215f;
}
@@ -1909,7 +1914,7 @@ static bool WIDGETGROUP_gizmo_poll_context(const struct bContext *C, struct wmGi
if (v3d->gizmo_flag & V3D_GIZMO_HIDE_CONTEXT) {
return false;
}
- if ((v3d->gizmo_type_mask & (V3D_GIZMO_TYPE_MASK_TRANSLATE | V3D_GIZMO_TYPE_MASK_ROTATE | V3D_GIZMO_TYPE_MASK_SCALE)) == 0) {
+ if ((v3d->gizmo_show_object & (V3D_GIZMO_SHOW_OBJECT_TRANSLATE | V3D_GIZMO_SHOW_OBJECT_ROTATE | V3D_GIZMO_SHOW_OBJECT_SCALE)) == 0) {
return false;
}
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index e0bf8be7722..53519de42a4 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -246,8 +246,7 @@ typedef struct View3D {
/** Display style for bundle. */
char bundle_drawtype;
- /** #V3D_GIZMO_SHOW_* */
- char gizmo_flag;
+ char drawtype DNA_DEPRECATED;
char _pad3[1];
@@ -270,7 +269,7 @@ typedef struct View3D {
char ob_centre_bone[64];
unsigned short local_view_uuid;
- short _pad6;
+ char _pad6[2];
int layact DNA_DEPRECATED;
/** Optional bool for 3d cursor to define center. */
@@ -284,15 +283,23 @@ typedef struct View3D {
float clip_start, clip_end;
float ofs[3] DNA_DEPRECATED;
- char _pad[6];
+ char _pad[1];
+
+ /** Transform gizmo info. */
+ /** #V3D_GIZMO_SHOW_* */
+ char gizmo_flag;
+
+ char gizmo_show_object;
+ char gizmo_show_armature;
+ char gizmo_show_empty;
+ char gizmo_show_light;
+ char gizmo_show_camera;
+
+ char gridflag;
short gridlines;
/** Number of subdivisions in the grid between each highlighted grid line. */
short gridsubdiv;
- char gridflag;
-
- /** Transform gizmo info. */
- char gizmo_type_mask;
/** Actually only used to define the opacity of the grease pencil vertex in edit mode. */
float vertex_opacity;
@@ -314,9 +321,6 @@ typedef struct View3D {
float stereo3d_convergence_alpha;
/** Display settings. */
- short drawtype DNA_DEPRECATED;
- char _pad5[6];
-
View3DShading shading;
View3DOverlay overlay;
@@ -548,11 +552,35 @@ enum {
V3D_GIZMO_HIDE_TOOL = (1 << 3),
};
-/** #View3d.gizmo_type_mask */
+/** #View3d.gizmo_show_object */
+enum {
+ V3D_GIZMO_SHOW_OBJECT_TRANSLATE = (1 << 0),
+ V3D_GIZMO_SHOW_OBJECT_ROTATE = (1 << 1),
+ V3D_GIZMO_SHOW_OBJECT_SCALE = (1 << 2),
+};
+/** #View3d.gizmo_show_armature */
+enum {
+ /** Currently unused (WIP gizmo). */
+ V3D_GIZMO_SHOW_ARMATURE_BBONE = (1 << 0),
+ /** Not yet implemented. */
+ V3D_GIZMO_SHOW_ARMATURE_ROLL = (1 << 1),
+};
+/** #View3d.gizmo_show_empty */
+enum {
+ V3D_GIZMO_SHOW_EMPTY_IMAGE = (1 << 0),
+ V3D_GIZMO_SHOW_EMPTY_FORCE_FIELD = (1 << 1),
+};
+/** #View3d.gizmo_show_light */
+enum {
+ /** Use for both spot & area size. */
+ V3D_GIZMO_SHOW_LIGHT_SIZE = (1 << 0),
+ V3D_GIZMO_SHOW_LIGHT_LOOK_AT = (1 << 1),
+};
+/** #View3d.gizmo_show_camera */
enum {
- V3D_GIZMO_TYPE_MASK_TRANSLATE = (1 << 0),
- V3D_GIZMO_TYPE_MASK_ROTATE = (1 << 1),
- V3D_GIZMO_TYPE_MASK_SCALE = (1 << 2),
+ /** Also used for ortho size. */
+ V3D_GIZMO_SHOW_CAMERA_LENS = (1 << 0),
+ V3D_GIZMO_SHOW_CAMERA_DOF_DIST = (1 << 2),
};
#define RV3D_CAMZOOM_MIN -30
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index aab07061997..fda1d71d9db 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -513,14 +513,6 @@ static void rna_GPencil_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UN
WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
}
-static void rna_SpaceView3D_gizmo_flag_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
-{
- View3D *v3d = ptr->data;
- if ((v3d->gizmo_type_mask & (V3D_GIZMO_TYPE_MASK_TRANSLATE | V3D_GIZMO_TYPE_MASK_ROTATE | V3D_GIZMO_TYPE_MASK_SCALE)) == 0) {
- v3d->gizmo_type_mask |= V3D_GIZMO_TYPE_MASK_TRANSLATE;
- }
-}
-
/* Space 3D View */
static void rna_SpaceView3D_camera_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
@@ -3101,13 +3093,6 @@ static void rna_def_space_view3d(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL},
};
- static const EnumPropertyItem rna_enum_gizmo_items[] = {
- {V3D_GIZMO_TYPE_MASK_TRANSLATE, "TRANSLATE", 0, "Move", ""},
- {V3D_GIZMO_TYPE_MASK_ROTATE, "ROTATE", 0, "Rotate", ""},
- {V3D_GIZMO_TYPE_MASK_SCALE, "SCALE", 0, "Scale", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
srna = RNA_def_struct(brna, "SpaceView3D", "Space");
RNA_def_struct_sdna(srna, "View3D");
RNA_def_struct_ui_text(srna, "3D View Space", "3D View space data");
@@ -3217,12 +3202,58 @@ 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, "show_gizmo_transform", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "gizmo_type_mask");
- RNA_def_property_enum_items(prop, rna_enum_gizmo_items);
- RNA_def_property_flag(prop, PROP_ENUM_FLAG);
- RNA_def_property_ui_text(prop, "Gizmo Mode", "");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_SpaceView3D_gizmo_flag_update");
+ /* Per object type gizmo display flags. */
+
+ prop = RNA_def_property(srna, "show_gizmo_object_translate", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_object", V3D_GIZMO_SHOW_OBJECT_TRANSLATE);
+ RNA_def_property_ui_text(prop, "Show Object Location", "Gizmo to adjust location");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_gizmo_object_rotate", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_object", V3D_GIZMO_SHOW_OBJECT_ROTATE);
+ RNA_def_property_ui_text(prop, "Show Object Rotation", "Gizmo to adjust rotation");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_gizmo_object_scale", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_object", V3D_GIZMO_SHOW_OBJECT_SCALE);
+ RNA_def_property_ui_text(prop, "Show Object Scale", "Gizmo to adjust scale");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ /* Empty Object Data. */
+ prop = RNA_def_property(srna, "show_gizmo_empty_image", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_empty", V3D_GIZMO_SHOW_EMPTY_IMAGE);
+ RNA_def_property_ui_text(prop, "Show Empty Image", "Gizmo to adjust image size and position");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_gizmo_empty_force_field", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_empty", V3D_GIZMO_SHOW_EMPTY_FORCE_FIELD);
+ RNA_def_property_ui_text(prop, "Show Empty Force Field", "Gizmo to adjust the force field");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ /* Light Object Data. */
+ prop = RNA_def_property(srna, "show_gizmo_light_size", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_light", V3D_GIZMO_SHOW_LIGHT_SIZE);
+ RNA_def_property_ui_text(prop, "Show Light Size", "Gizmo to adjust spot and area size");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_gizmo_light_look_at", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_light", V3D_GIZMO_SHOW_LIGHT_LOOK_AT);
+ RNA_def_property_ui_text(prop, "Show Light Look-At", "Gizmo to adjust spot and area size");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ /* Camera Object Data. */
+ prop = RNA_def_property(srna, "show_gizmo_camera_lens", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_camera", V3D_GIZMO_SHOW_CAMERA_LENS);
+ RNA_def_property_ui_text(prop, "Show Camera Lens", "Gizmo to adjust camera lens & ortho size");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_gizmo_camera_dof_distance", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_camera", V3D_GIZMO_SHOW_CAMERA_DOF_DIST);
+ RNA_def_property_ui_text(
+ prop, "Show Camera Focus Distance", "Gizmo to adjust camera focus distance "
+ "(depends on limits display)");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
prop = RNA_def_property(srna, "use_local_camera", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "scenelock", 1);