[Bf-blender-cvs] [5c6cc931b22] master: Gizmo: add flag to hide the gizmo group during interaction

Campbell Barton noreply at git.blender.org
Wed Sep 15 14:38:35 CEST 2021


Commit: 5c6cc931b2203d97aa9d570ff3b353c2a3dfebed
Author: Campbell Barton
Date:   Wed Sep 15 22:34:21 2021 +1000
Branches: master
https://developer.blender.org/rB5c6cc931b2203d97aa9d570ff3b353c2a3dfebed

Gizmo: add flag to hide the gizmo group during interaction

This allows a hack to be removed that temporarily overwrote
the 3D views gizmo display flag.

Also reverse change from fb27a9bb983ce74b8d8f5f871cf0706dd1e25051
that runs poll on modal gizmo groups as there is some risk
that the poll function unlinks the gizmo.

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

M	source/blender/editors/mesh/editmesh_bevel.c
M	source/blender/editors/mesh/editmesh_bisect.c
M	source/blender/editors/mesh/editmesh_inset.c
M	source/blender/editors/space_image/space_image.c
M	source/blender/editors/transform/transform.h
M	source/blender/editors/transform/transform_generics.c
M	source/blender/editors/transform/transform_gizmo_3d.c
M	source/blender/makesdna/DNA_view3d_types.h
M	source/blender/makesrna/intern/rna_wm_gizmo.c
M	source/blender/windowmanager/gizmo/WM_gizmo_types.h
M	source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c

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

diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c
index cdbbdd820b7..0d74187b50e 100644
--- a/source/blender/editors/mesh/editmesh_bevel.c
+++ b/source/blender/editors/mesh/editmesh_bevel.c
@@ -97,7 +97,6 @@ typedef struct {
   int launch_event;
   float mcenter[2];
   void *draw_handle_pixel;
-  short gizmo_flag;
   short value_mode; /* Which value does mouse movement and numeric input affect? */
   float segments;   /* Segments as float so smooth mouse pan works in small increments */
 
@@ -307,11 +306,6 @@ static bool edbm_bevel_init(bContext *C, wmOperator *op, const bool is_modal)
     opdata->draw_handle_pixel = ED_region_draw_cb_activate(
         region->type, ED_region_draw_mouse_line_cb, opdata->mcenter, REGION_DRAW_POST_PIXEL);
     G.moving = G_TRANSFORM_EDIT;
-
-    if (v3d) {
-      opdata->gizmo_flag = v3d->gizmo_flag;
-      v3d->gizmo_flag |= V3D_GIZMO_HIDE_DEFAULT_MODAL;
-    }
   }
 
   return true;
@@ -433,15 +427,11 @@ static void edbm_bevel_exit(bContext *C, wmOperator *op)
   }
 
   if (opdata->is_modal) {
-    View3D *v3d = CTX_wm_view3d(C);
     ARegion *region = CTX_wm_region(C);
     for (uint ob_index = 0; ob_index < opdata->ob_store_len; ob_index++) {
       EDBM_redo_state_free(&opdata->ob_store[ob_index].mesh_backup);
     }
     ED_region_draw_cb_exit(region->type, opdata->draw_handle_pixel);
-    if (v3d) {
-      v3d->gizmo_flag = opdata->gizmo_flag;
-    }
     G.moving = 0;
   }
   MEM_SAFE_FREE(opdata->ob_store);
diff --git a/source/blender/editors/mesh/editmesh_bisect.c b/source/blender/editors/mesh/editmesh_bisect.c
index f525f2c2e91..5cb57594ec3 100644
--- a/source/blender/editors/mesh/editmesh_bisect.c
+++ b/source/blender/editors/mesh/editmesh_bisect.c
@@ -72,7 +72,6 @@ typedef struct {
     bool is_dirty;
   } * backup;
   int backup_len;
-  short gizmo_flag;
 } BisectData;
 
 static void mesh_bisect_interactive_calc(bContext *C,
@@ -157,8 +156,6 @@ static int mesh_bisect_invoke(bContext *C, wmOperator *op, const wmEvent *event)
   }
 
   if (ret & OPERATOR_RUNNING_MODAL) {
-    View3D *v3d = CTX_wm_view3d(C);
-
     wmGesture *gesture = op->customdata;
     BisectData *opdata;
 
@@ -181,8 +178,6 @@ static int mesh_bisect_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 
     /* Misc other vars. */
     G.moving = G_TRANSFORM_EDIT;
-    opdata->gizmo_flag = v3d->gizmo_flag;
-    v3d->gizmo_flag |= V3D_GIZMO_HIDE_DEFAULT_MODAL;
 
     /* Initialize modal callout. */
     ED_workspace_status_text(C, TIP_("LMB: Click and drag to draw cut line"));
@@ -191,10 +186,8 @@ static int mesh_bisect_invoke(bContext *C, wmOperator *op, const wmEvent *event)
   return ret;
 }
 
-static void edbm_bisect_exit(bContext *C, BisectData *opdata)
+static void edbm_bisect_exit(BisectData *opdata)
 {
-  View3D *v3d = CTX_wm_view3d(C);
-  v3d->gizmo_flag = opdata->gizmo_flag;
   G.moving = 0;
 
   for (int ob_index = 0; ob_index < opdata->backup_len; ob_index++) {
@@ -225,7 +218,7 @@ static int mesh_bisect_modal(bContext *C, wmOperator *op, const wmEvent *event)
   }
 
   if (ret & (OPERATOR_FINISHED | OPERATOR_CANCELLED)) {
-    edbm_bisect_exit(C, &opdata_back);
+    edbm_bisect_exit(&opdata_back);
 
 #ifdef USE_GIZMO
     /* Setup gizmos */
diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c
index 159e84db4ef..7be169f70f4 100644
--- a/source/blender/editors/mesh/editmesh_inset.c
+++ b/source/blender/editors/mesh/editmesh_inset.c
@@ -76,7 +76,6 @@ typedef struct {
   int launch_event;
   float mcenter[2];
   void *draw_handle_pixel;
-  short gizmo_flag;
 } InsetData;
 
 static void edbm_inset_update_header(wmOperator *op, bContext *C)
@@ -177,7 +176,6 @@ static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal)
   opdata->num_input.unit_type[1] = B_UNIT_LENGTH;
 
   if (is_modal) {
-    View3D *v3d = CTX_wm_view3d(C);
     ARegion *region = CTX_wm_region(C);
 
     for (uint ob_index = 0; ob_index < opdata->ob_store_len; ob_index++) {
@@ -189,10 +187,6 @@ static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal)
     opdata->draw_handle_pixel = ED_region_draw_cb_activate(
         region->type, ED_region_draw_mouse_line_cb, opdata->mcenter, REGION_DRAW_POST_PIXEL);
     G.moving = G_TRANSFORM_EDIT;
-    if (v3d) {
-      opdata->gizmo_flag = v3d->gizmo_flag;
-      v3d->gizmo_flag |= V3D_GIZMO_HIDE_DEFAULT_MODAL;
-    }
   }
 
   return true;
@@ -206,15 +200,11 @@ static void edbm_inset_exit(bContext *C, wmOperator *op)
   opdata = op->customdata;
 
   if (opdata->is_modal) {
-    View3D *v3d = CTX_wm_view3d(C);
     ARegion *region = CTX_wm_region(C);
     for (uint ob_index = 0; ob_index < opdata->ob_store_len; ob_index++) {
       EDBM_redo_state_free(&opdata->ob_store[ob_index].mesh_backup);
     }
     ED_region_draw_cb_exit(region->type, opdata->draw_handle_pixel);
-    if (v3d) {
-      v3d->gizmo_flag = opdata->gizmo_flag;
-    }
     G.moving = 0;
   }
 
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 4107fd619aa..de8e4684d45 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -461,7 +461,7 @@ static void IMAGE_GGT_gizmo2d(wmGizmoGroupType *gzgt)
   gzgt->name = "UV Transform Gizmo";
   gzgt->idname = "IMAGE_GGT_gizmo2d";
 
-  gzgt->flag |= (WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP |
+  gzgt->flag |= (WM_GIZMOGROUPTYPE_DRAW_MODAL_EXCLUDE | WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP |
                  WM_GIZMOGROUPTYPE_DELAY_REFRESH_FOR_TWEAK);
 
   gzgt->gzmap_params.spaceid = SPACE_IMAGE;
@@ -475,7 +475,7 @@ static void IMAGE_GGT_gizmo2d_translate(wmGizmoGroupType *gzgt)
   gzgt->name = "UV Translate Gizmo";
   gzgt->idname = "IMAGE_GGT_gizmo2d_translate";
 
-  gzgt->flag |= (WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP |
+  gzgt->flag |= (WM_GIZMOGROUPTYPE_DRAW_MODAL_EXCLUDE | WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP |
                  WM_GIZMOGROUPTYPE_DELAY_REFRESH_FOR_TWEAK);
 
   gzgt->gzmap_params.spaceid = SPACE_IMAGE;
@@ -489,7 +489,7 @@ static void IMAGE_GGT_gizmo2d_resize(wmGizmoGroupType *gzgt)
   gzgt->name = "UV Transform Gizmo Resize";
   gzgt->idname = "IMAGE_GGT_gizmo2d_resize";
 
-  gzgt->flag |= (WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP |
+  gzgt->flag |= (WM_GIZMOGROUPTYPE_DRAW_MODAL_EXCLUDE | WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP |
                  WM_GIZMOGROUPTYPE_DELAY_REFRESH_FOR_TWEAK);
 
   gzgt->gzmap_params.spaceid = SPACE_IMAGE;
@@ -503,7 +503,7 @@ static void IMAGE_GGT_gizmo2d_rotate(wmGizmoGroupType *gzgt)
   gzgt->name = "UV Transform Gizmo Resize";
   gzgt->idname = "IMAGE_GGT_gizmo2d_rotate";
 
-  gzgt->flag |= (WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP |
+  gzgt->flag |= (WM_GIZMOGROUPTYPE_DRAW_MODAL_EXCLUDE | WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP |
                  WM_GIZMOGROUPTYPE_DELAY_REFRESH_FOR_TWEAK);
 
   gzgt->gzmap_params.spaceid = SPACE_IMAGE;
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index 013c5faa54a..d1a1937cef1 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -618,9 +618,6 @@ typedef struct TransInfo {
     O_SET,
   } orient_curr;
 
-  /** backup from view3d, to restore on end. */
-  short gizmo_flag;
-
   short prop_mode;
 
   /** Value taken as input, either through mouse coordinates or entered as a parameter. */
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index b7f579cc12f..c493b9bd102 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -249,12 +249,6 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
     t->view = v3d;
     t->animtimer = (animscreen) ? animscreen->animtimer : NULL;
 
-    /* turn gizmo off during transform */
-    if (t->flag & T_MODAL) {
-      t->gizmo_flag = v3d->gizmo_flag;
-      v3d->gizmo_flag |= V3D_GIZMO_HIDE_DEFAULT_MODAL;
-    }
-
     if (t->scene->toolsettings->transform_flag & SCE_XFORM_AXIS_ALIGN) {
       t->flag |= T_V3D_ALIGN;
     }
@@ -742,13 +736,6 @@ void postTrans(bContext *C, TransInfo *t)
       }
     }
   }
-  else if (t->spacetype == SPACE_VIEW3D) {
-    View3D *v3d = t->area->spacedata.first;
-    /* restore gizmo */
-    if (t->flag & T_MODAL) {
-      v3d->gizmo_flag = t->gizmo_flag;
-    }
-  }
 
   if (t->mouse.data) {
     MEM_freeN(t->mouse.data);
diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c
index 8dc4f107837..0fa179c4f74 100644
--- a/source/blender/editors/transform/transform_gizmo_3d.c
+++ b/source/blender/editors/transform/transform_gizmo_3d.c
@@ -1974,8 +1974,8 @@ void VIEW3D_GGT_xform_gizmo(wmGizmoGroupType *gzgt)
   gzgt->name = "3D View: Transform Gizmo";
   gzgt->idname = "VIEW3D_GGT_xform_gizmo";
 
-  gzgt->flag = WM_GIZMOGROUPTYPE_3D | WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP |
-               WM_GIZMOGROUPTYPE_DELAY_REFRESH_FOR_TWEAK;
+  gzgt->flag = WM_GIZMOGROUPTYPE_3D | WM_GIZMOGROUPTYPE_DRAW_MODAL_EXCLUDE |
+               WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP | WM_GIZMOGROUPTYPE_DELAY_REFRESH_FOR_TWEAK;
 
   gzgt->gzmap_params.spaceid = SPACE_VIEW3D;
   gzgt->gzmap_params.regionid = RGN_TYPE_WINDOW;
@@ -2216,8 +2216,8 @@ void VIEW3D_GGT_xform_cage(wmGizmoGroupType *gzgt)
   gzgt->name = "Transform Cage";
   gzgt->idname = "VIEW3D_GGT_xform_cage";
 
-  gzgt->flag |= WM_GIZMOGROUPTYPE_3D | WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP |
-                WM_GIZMOGROUPTYPE_DELAY_REFRESH_FOR_TWEAK;
+  gzgt->flag |= WM_GIZMOGROUPTYPE_3D | WM_GIZMOGROUPTYPE_DRAW_MODAL_EXCLUDE |
+                WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP | WM_GIZMOGROUPTYPE_DELAY_REFRESH_FOR_TWEAK;
 
   gzgt->gzmap_params.spaceid = SPACE_VIEW3D;
   gzgt->gzmap_params.regionid = RGN_TYPE_WINDOW;
@@ -2459,8 +2459,8 @@ void VIEW3D_GGT_xform_shear(wmGizmoGroupType *gzgt)
   gzgt->name = "Transform Shear";
   gzgt->idname = "VIEW3D_GGT_xform_shear";
 
-  gzgt->flag |=

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list