3D View: move gizmo draw options out of overlays

Gizmo's now have their own popover in preparation
for making transform gizmos accessible without having to use tools

See: T63518
This commit is contained in:
2019-04-13 12:23:07 +02:00
parent cd60843aef
commit 65b0312904
11 changed files with 44 additions and 62 deletions

View File

@@ -1581,9 +1581,7 @@ void DRW_draw_render_loop_ex(
if (DST.draw_ctx.evil_C) {
/* needed so gizmo isn't obscured */
if (((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) &&
((v3d->gizmo_flag & V3D_GIZMO_HIDE) == 0))
{
if ((v3d->gizmo_flag & V3D_GIZMO_HIDE) == 0) {
glDisable(GL_DEPTH_TEST);
DRW_draw_gizmo_3d();
}
@@ -1601,7 +1599,7 @@ void DRW_draw_render_loop_ex(
GPU_depth_test(true);
}
if ((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) {
if ((v3d->gizmo_flag & V3D_GIZMO_HIDE) == 0) {
/* Draw 2D after region info so we can draw on top of the camera passepartout overlay.
* 'DRW_draw_region_info' sets the projection in pixel-space. */
GPU_depth_test(false);

View File

@@ -91,9 +91,7 @@ static bool edbm_preselect_or_active(
BMElem **r_ele)
{
ARegion *ar = CTX_wm_region(C);
const bool show_gizmo = !(
(v3d->flag2 & V3D_HIDE_OVERLAYS) ||
(v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_TOOL)));
const bool show_gizmo = !((v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_TOOL)));
wmGizmoMap *gzmap = show_gizmo ? ar->gizmo_map : NULL;
wmGizmoGroup *gzgroup = gzmap ? WM_gizmomap_group_find(gzmap, "VIEW3D_GGT_mesh_preselect_elem") : NULL;

View File

@@ -1324,7 +1324,6 @@ void view3d_draw_region_info(const bContext *C, ARegion *ar)
BLF_batch_draw_begin();
if ((U.uiflag & USER_SHOW_GIZMO_AXIS) ||
(v3d->flag2 & V3D_HIDE_OVERLAYS) ||
/* No need to display gizmo and this info. */
(v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_NAVIGATE)))
{

View File

@@ -125,9 +125,7 @@ static void gizmo_bbone_offset_set(
static bool WIDGETGROUP_armature_spline_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt))
{
View3D *v3d = CTX_wm_view3d(C);
if ((v3d->flag2 & V3D_HIDE_OVERLAYS) ||
(v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)))
{
if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)) {
return false;
}

View File

@@ -61,9 +61,7 @@ struct CameraWidgetGroup {
static bool WIDGETGROUP_camera_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt))
{
View3D *v3d = CTX_wm_view3d(C);
if ((v3d->flag2 & V3D_HIDE_OVERLAYS) ||
(v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)))
{
if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)) {
return false;
}
@@ -374,9 +372,7 @@ static bool WIDGETGROUP_camera_view_poll(const bContext *C, wmGizmoGroupType *UN
}
View3D *v3d = CTX_wm_view3d(C);
if ((v3d->flag2 & V3D_HIDE_OVERLAYS) ||
(v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)))
{
if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)) {
return false;
}

View File

@@ -106,9 +106,7 @@ static bool WIDGETGROUP_empty_image_poll(const bContext *C, wmGizmoGroupType *UN
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d = CTX_wm_region_view3d(C);
if ((v3d->flag2 & V3D_HIDE_OVERLAYS) ||
(v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)))
{
if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)) {
return false;
}

View File

@@ -49,9 +49,7 @@ static bool WIDGETGROUP_forcefield_poll(const bContext *C, wmGizmoGroupType *UNU
{
View3D *v3d = CTX_wm_view3d(C);
if ((v3d->flag2 & V3D_HIDE_OVERLAYS) ||
(v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)))
{
if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)) {
return false;
}

View File

@@ -51,9 +51,7 @@
static bool WIDGETGROUP_light_spot_poll(const bContext *C, wmGizmoGroupType *UNUSED(gzgt))
{
View3D *v3d = CTX_wm_view3d(C);
if ((v3d->flag2 & V3D_HIDE_OVERLAYS) ||
(v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)))
{
if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT)) {
return false;
}

View File

@@ -121,13 +121,11 @@ static bool WIDGETGROUP_navigate_poll(const bContext *C, wmGizmoGroupType *UNUSE
{
View3D *v3d = CTX_wm_view3d(C);
if (((U.uiflag & USER_SHOW_GIZMO_AXIS) == 0) ||
(v3d->flag2 & V3D_HIDE_OVERLAYS) ||
(v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_NAVIGATE)))
{
return false;
}
return true;
}
static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)

View File

@@ -1042,9 +1042,7 @@ static int view3d_ruler_add_invoke(bContext *C, wmOperator *op, const wmEvent *e
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d = ar->regiondata;
if ((v3d->flag2 & V3D_HIDE_OVERLAYS) ||
(v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_TOOL)))
{
if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_TOOL)) {
BKE_report(op->reports, RPT_WARNING, "Gizmos hidden in this view");
return OPERATOR_CANCELLED;
}
@@ -1107,9 +1105,7 @@ static int view3d_ruler_remove_invoke(bContext *C, wmOperator *op, const wmEvent
ARegion *ar = CTX_wm_region(C);
View3D *v3d = CTX_wm_view3d(C);
if ((v3d->flag2 & V3D_HIDE_OVERLAYS) ||
(v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_TOOL)))
{
if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_TOOL)) {
BKE_report(op->reports, RPT_WARNING, "Gizmos hidden in this view");
return OPERATOR_CANCELLED;
}