[Bf-blender-cvs] [b29ad7c91aa] master: WM: clean up cursors constants and code

Brecht Van Lommel noreply at git.blender.org
Thu Sep 26 14:33:16 CEST 2019


Commit: b29ad7c91aac1398377000c24a56038a73a3e597
Author: Brecht Van Lommel
Date:   Thu Sep 26 14:31:48 2019 +0200
Branches: master
https://developer.blender.org/rBb29ad7c91aac1398377000c24a56038a73a3e597

WM: clean up cursors constants and code

There was a mix of old and new constants. Now have one list of WM_CURSOR_*
cursor types, using GHOST standard cursors when available and otherwise falling
back to our custom cursors.

Ref D5197

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

M	source/blender/editors/armature/pose_slide.c
M	source/blender/editors/curve/editcurve_paint.c
M	source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c
M	source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
M	source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c
M	source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c
M	source/blender/editors/gpencil/annotate_paint.c
M	source/blender/editors/gpencil/gpencil_brush.c
M	source/blender/editors/gpencil/gpencil_fill.c
M	source/blender/editors/gpencil/gpencil_interpolate.c
M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/editors/gpencil/gpencil_primitive.c
M	source/blender/editors/interface/interface_eyedropper_color.c
M	source/blender/editors/interface/interface_eyedropper_colorband.c
M	source/blender/editors/interface/interface_eyedropper_datablock.c
M	source/blender/editors/interface/interface_eyedropper_depth.c
M	source/blender/editors/interface/interface_eyedropper_driver.c
M	source/blender/editors/interface/interface_handlers.c
M	source/blender/editors/interface/interface_region_popup.c
M	source/blender/editors/interface/view2d_ops.c
M	source/blender/editors/mesh/editmesh_bisect.c
M	source/blender/editors/mesh/editmesh_knife.c
M	source/blender/editors/mesh/editmesh_tools.c
M	source/blender/editors/screen/area.c
M	source/blender/editors/screen/screen_edit.c
M	source/blender/editors/screen/screen_ops.c
M	source/blender/editors/sculpt_paint/paint_cursor.c
M	source/blender/editors/sculpt_paint/paint_image.c
M	source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/editors/space_clip/clip_ops.c
M	source/blender/editors/space_clip/tracking_ops_utils.c
M	source/blender/editors/space_console/space_console.c
M	source/blender/editors/space_image/image_ops.c
M	source/blender/editors/space_node/node_add.c
M	source/blender/editors/space_node/node_draw.c
M	source/blender/editors/space_node/node_relationships.c
M	source/blender/editors/space_text/space_text.c
M	source/blender/editors/space_view3d/space_view3d.c
M	source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c
M	source/blender/editors/space_view3d/view3d_gizmo_ruler.c
M	source/blender/editors/space_view3d/view3d_walk.c
M	source/blender/editors/transform/transform_input.c
M	source/blender/makesrna/intern/rna_wm_api.c
M	source/blender/windowmanager/intern/wm_cursors.c
M	source/blender/windowmanager/intern/wm_dragdrop.c
M	source/blender/windowmanager/intern/wm_window.c
M	source/blender/windowmanager/wm_cursors.h

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

diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c
index 6274eb549da..616daf94e57 100644
--- a/source/blender/editors/armature/pose_slide.c
+++ b/source/blender/editors/armature/pose_slide.c
@@ -1003,7 +1003,7 @@ static int pose_slide_invoke_common(bContext *C, wmOperator *op, tPoseSlideOp *p
   pose_slide_refresh(C, pso);
 
   /* set cursor to indicate modal */
-  WM_cursor_modal_set(win, BC_EW_SCROLLCURSOR);
+  WM_cursor_modal_set(win, WM_CURSOR_EW_SCROLL);
 
   /* header print */
   pose_slide_draw_status(pso);
diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c
index fffb62019b4..4c4bac6a249 100644
--- a/source/blender/editors/curve/editcurve_paint.c
+++ b/source/blender/editors/curve/editcurve_paint.c
@@ -1064,7 +1064,7 @@ static int curve_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 
   cdd->draw_handle_view = ED_region_draw_cb_activate(
       cdd->vc.ar->type, curve_draw_stroke_3d, op, REGION_DRAW_POST_VIEW);
-  WM_cursor_modal_set(cdd->vc.win, BC_PAINTBRUSHCURSOR);
+  WM_cursor_modal_set(cdd->vc.win, WM_CURSOR_PAINT_BRUSH);
 
   {
     View3D *v3d = cdd->vc.v3d;
diff --git a/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c
index 1a132c2957a..ecbc503e084 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c
@@ -258,9 +258,9 @@ static int gizmo_button2d_test_select(bContext *C, wmGizmo *gz, const int mval[2
 static int gizmo_button2d_cursor_get(wmGizmo *gz)
 {
   if (RNA_boolean_get(gz->ptr, "show_drag")) {
-    return BC_NSEW_SCROLLCURSOR;
+    return WM_CURSOR_NSEW_SCROLL;
   }
-  return CURSOR_STD;
+  return WM_CURSOR_DEFAULT;
 }
 
 static void gizmo_button2d_free(wmGizmo *gz)
diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
index ba3b8c2602e..ef4fd23b64d 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
@@ -752,30 +752,30 @@ static int gizmo_cage2d_get_cursor(wmGizmo *gz)
   int highlight_part = gz->highlight_part;
 
   if (gz->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_3D) {
-    return BC_NSEW_SCROLLCURSOR;
+    return WM_CURSOR_NSEW_SCROLL;
   }
 
   switch (highlight_part) {
     case ED_GIZMO_CAGE2D_PART_TRANSLATE:
-      return BC_NSEW_SCROLLCURSOR;
+      return WM_CURSOR_NSEW_SCROLL;
     case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X:
     case ED_GIZMO_CAGE2D_PART_SCALE_MAX_X:
-      return CURSOR_X_MOVE;
+      return WM_CURSOR_X_MOVE;
     case ED_GIZMO_CAGE2D_PART_SCALE_MIN_Y:
     case ED_GIZMO_CAGE2D_PART_SCALE_MAX_Y:
-      return CURSOR_Y_MOVE;
+      return WM_CURSOR_Y_MOVE;
 
       /* TODO diagonal cursor */
     case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MIN_Y:
     case ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MIN_Y:
-      return BC_NSEW_SCROLLCURSOR;
+      return WM_CURSOR_NSEW_SCROLL;
     case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MAX_Y:
     case ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MAX_Y:
-      return BC_NSEW_SCROLLCURSOR;
+      return WM_CURSOR_NSEW_SCROLL;
     case ED_GIZMO_CAGE2D_PART_ROTATE:
-      return BC_CROSSCURSOR;
+      return WM_CURSOR_CROSS;
     default:
-      return CURSOR_STD;
+      return WM_CURSOR_DEFAULT;
   }
 }
 
diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c
index 406f76bc65e..723be3cfe6b 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c
@@ -424,10 +424,10 @@ static void gizmo_cage3d_draw(const bContext *C, wmGizmo *gz)
 static int gizmo_cage3d_get_cursor(wmGizmo *gz)
 {
   if (gz->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_3D) {
-    return BC_NSEW_SCROLLCURSOR;
+    return WM_CURSOR_NSEW_SCROLL;
   }
 
-  return CURSOR_STD;
+  return WM_CURSOR_DEFAULT;
 }
 
 typedef struct RectTransformInteraction {
diff --git a/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c
index 37ee95d5058..5342f8695b2 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c
@@ -412,7 +412,7 @@ static void gizmo_move_property_update(wmGizmo *gz, wmGizmoProperty *gz_prop)
 
 static int gizmo_move_cursor_get(wmGizmo *UNUSED(gz))
 {
-  return BC_NSEW_SCROLLCURSOR;
+  return WM_CURSOR_NSEW_SCROLL;
 }
 
 /* -------------------------------------------------------------------- */
diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c
index 22f1753a810..f2d039bb47c 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -1560,10 +1560,10 @@ static int gpencil_draw_init(bContext *C, wmOperator *op, const wmEvent *event)
 static void gpencil_draw_cursor_set(tGPsdata *p)
 {
   if (p->paintmode == GP_PAINTMODE_ERASER) {
-    WM_cursor_modal_set(p->win, BC_CROSSCURSOR); /* XXX need a better cursor */
+    WM_cursor_modal_set(p->win, WM_CURSOR_CROSS); /* XXX need a better cursor */
   }
   else {
-    WM_cursor_modal_set(p->win, BC_PAINTBRUSHCURSOR);
+    WM_cursor_modal_set(p->win, WM_CURSOR_PAINT_BRUSH);
   }
 }
 
diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c
index 0f76d1421cf..af9cadfb938 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -1402,7 +1402,7 @@ static bool gpsculpt_brush_init(bContext *C, wmOperator *op)
   gpsculpt_brush_header_set(C, gso);
 
   /* setup cursor drawing */
-  // WM_cursor_modal_set(CTX_wm_window(C), BC_CROSSCURSOR);
+  // WM_cursor_modal_set(CTX_wm_window(C), WM_CURSOR_CROSS);
   if (gso->sa->spacetype != SPACE_VIEW3D) {
     ED_gpencil_toggle_brush_cursor(C, true, NULL);
   }
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index ea93f861c6e..993ec15248f 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -1394,7 +1394,7 @@ static int gpencil_fill_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
         tgpf->ar->type, gpencil_fill_draw_3d, tgpf, REGION_DRAW_POST_VIEW);
   }
 
-  WM_cursor_modal_set(CTX_wm_window(C), BC_PAINTBRUSHCURSOR);
+  WM_cursor_modal_set(CTX_wm_window(C), WM_CURSOR_PAINT_BRUSH);
 
   gpencil_fill_status_indicators(C, tgpf);
 
diff --git a/source/blender/editors/gpencil/gpencil_interpolate.c b/source/blender/editors/gpencil/gpencil_interpolate.c
index 86de9a75a56..1438c33a972 100644
--- a/source/blender/editors/gpencil/gpencil_interpolate.c
+++ b/source/blender/editors/gpencil/gpencil_interpolate.c
@@ -560,7 +560,7 @@ static int gpencil_interpolate_invoke(bContext *C, wmOperator *op, const wmEvent
       tgpi->ar->type, gpencil_interpolate_draw_3d, tgpi, REGION_DRAW_POST_VIEW);
 
   /* set cursor to indicate modal */
-  WM_cursor_modal_set(win, BC_EW_SCROLLCURSOR);
+  WM_cursor_modal_set(win, WM_CURSOR_EW_SCROLL);
 
   /* update shift indicator in header */
   gpencil_interpolate_status_indicators(C, tgpi);
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 50da804a911..917c883909c 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -2551,10 +2551,10 @@ static void gpencil_draw_cursor_set(tGPsdata *p)
 #if 0
   Brush *brush = p->brush;
   if ((p->paintmode == GP_PAINTMODE_ERASER) || (brush->gpencil_tool == GPAINT_TOOL_ERASE)) {
-    WM_cursor_modal_set(p->win, BC_CROSSCURSOR); /* XXX need a better cursor */
+    WM_cursor_modal_set(p->win, WM_CURSOR_CROSS); /* XXX need a better cursor */
   }
   else {
-    WM_cursor_modal_set(p->win, CURSOR_NONE);
+    WM_cursor_modal_set(p->win, WM_CURSOR_NONE);
   }
 #endif
 }
@@ -3565,7 +3565,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
   /* special mode for editing control points */
   if (p->paintmode == GP_PAINTMODE_SET_CP) {
     wmWindow *win = p->win;
-    WM_cursor_modal_set(win, BC_NSEW_SCROLLCURSOR);
+    WM_cursor_modal_set(win, WM_CURSOR_NSEW_SCROLL);
     bool drawmode = false;
 
     switch (event->type) {
diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c
index 8d4c75d2e8c..e5b1a82630b 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -1214,7 +1214,7 @@ static int gpencil_primitive_invoke(bContext *C, wmOperator *op, const wmEvent *
   op->flag |= OP_IS_MODAL_CURSOR_REGION;
 
   /* set cursor to indicate modal */
-  WM_cursor_modal_set(win, BC_CROSSCURSOR);
+  WM_cursor_modal_set(win, WM_CURSOR_CROSS);
 
   /* update sindicator in header */
   gpencil_primitive_status_indicators(C, tgpi);
@@ -1319,18 +1319,18 @@ static void gpencil_primitive_edit_event_handling(
   if (tgpi->flag == IN_CURVE_EDIT) {
     if ((a < BIG_SIZE_CTL && tgpi->tot_stored_edges == 0) || b < BIG_SIZE_CTL) {
       move = MOVE_ENDS;
-      WM_cursor_modal_set(win, BC_NSEW_SCROLLCURSOR);
+      WM_cursor_modal_set(win, WM_CURSOR_NSEW_SCROLL);
     }
     else if (tgpi->curve) {
       move = MOVE_CP;
-      WM_cursor_modal_set(win, BC_HANDCURSOR);
+      WM_cursor_modal_set(win, WM_CURSOR_HAND);
     }
     else {
-      WM_cursor_modal_set(win, BC_CROSSCURSOR);
+      WM_cursor_modal_set(win, WM_CURSOR_CROSS);
     }
   }
   else if (tgpi->flag == IN_PROGRESS) {
-    WM_cursor_modal_set(win, BC_NSEW_SCROLLCURSOR);
+    WM_cursor_modal_set(win, WM_CURSOR_NSEW_SCROLL);
   }
 
   switch (event->type) {
@@ -1402,7 +1402,7 @@ static void gpencil_primitive_edit_event_handling(
     case EKEY: {
       if (tgpi->flag == IN_CURVE_EDIT && !ELEM(tgpi

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list