[Bf-blender-cvs] [5e4dcb8cf0a] master: Cleanup: use OB_MODE_ALL_PAINT_GPENCIL in more places

Philipp Oeser noreply at git.blender.org
Thu Dec 1 12:18:55 CET 2022


Commit: 5e4dcb8cf0a3baec068183a9a83d50d8390b8810
Author: Philipp Oeser
Date:   Wed Nov 30 12:01:06 2022 +0100
Branches: master
https://developer.blender.org/rB5e4dcb8cf0a3baec068183a9a83d50d8390b8810

Cleanup: use OB_MODE_ALL_PAINT_GPENCIL in more places

This just replaces the combined usage of OB_MODE_PAINT_GPENCIL
OB_MODE_SCULPT_GPENCIL
OB_MODE_WEIGHT_GPENCIL
OB_MODE_VERTEX_GPENCIL.

Differential Revision: https://developer.blender.org/D16652

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

M	source/blender/editors/gpencil/gpencil_utils.c
M	source/blender/editors/interface/interface_icons.cc
M	source/blender/editors/object/object_modes.c
M	source/blender/editors/transform/transform_convert.c
M	source/blender/editors/undo/ed_undo.c

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

diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index 40f33a888aa..61f8111008f 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -1664,11 +1664,7 @@ static bool gpencil_check_cursor_region(bContext *C, const int mval_i[2])
   ScrArea *area = CTX_wm_area(C);
   Object *ob = CTX_data_active_object(C);
 
-  if ((ob == NULL) || !ELEM(ob->mode,
-                            OB_MODE_PAINT_GPENCIL,
-                            OB_MODE_SCULPT_GPENCIL,
-                            OB_MODE_WEIGHT_GPENCIL,
-                            OB_MODE_VERTEX_GPENCIL)) {
+  if ((ob == NULL) || ((ob->mode & OB_MODE_ALL_PAINT_GPENCIL) == 0)) {
     return false;
   }
 
diff --git a/source/blender/editors/interface/interface_icons.cc b/source/blender/editors/interface/interface_icons.cc
index dab9d923428..e1f9ba897fe 100644
--- a/source/blender/editors/interface/interface_icons.cc
+++ b/source/blender/editors/interface/interface_icons.cc
@@ -2124,10 +2124,7 @@ static int ui_id_brush_get_icon(const bContext *C, ID *id)
     }
 
     /* reset the icon */
-    if ((ob != NULL) &&
-        (ob->mode & (OB_MODE_PAINT_GPENCIL | OB_MODE_VERTEX_GPENCIL | OB_MODE_SCULPT_GPENCIL |
-                     OB_MODE_WEIGHT_GPENCIL)) &&
-        (br->gpencil_settings != NULL)) {
+    if ((ob != NULL) && (ob->mode & OB_MODE_ALL_PAINT_GPENCIL) && (br->gpencil_settings != NULL)) {
       switch (br->gpencil_settings->icon_id) {
         case GP_BRUSH_ICON_PENCIL:
           br->id.icon_id = ICON_GPBRUSH_PENCIL;
diff --git a/source/blender/editors/object/object_modes.c b/source/blender/editors/object/object_modes.c
index 6525f2d6027..7e3a9dd7ccb 100644
--- a/source/blender/editors/object/object_modes.c
+++ b/source/blender/editors/object/object_modes.c
@@ -137,8 +137,7 @@ bool ED_object_mode_compat_test(const Object *ob, eObjectMode mode)
       }
       break;
     case OB_GPENCIL:
-      if (mode & (OB_MODE_EDIT_GPENCIL | OB_MODE_PAINT_GPENCIL | OB_MODE_SCULPT_GPENCIL |
-                  OB_MODE_WEIGHT_GPENCIL | OB_MODE_VERTEX_GPENCIL)) {
+      if (mode & (OB_MODE_EDIT_GPENCIL | OB_MODE_ALL_PAINT_GPENCIL)) {
         return true;
       }
       break;
diff --git a/source/blender/editors/transform/transform_convert.c b/source/blender/editors/transform/transform_convert.c
index d71a3897cbc..75627370a85 100644
--- a/source/blender/editors/transform/transform_convert.c
+++ b/source/blender/editors/transform/transform_convert.c
@@ -1115,11 +1115,7 @@ static TransConvertTypeInfo *convert_type_get(const TransInfo *t, Object **r_obj
     }
     return NULL;
   }
-  if (ob && ELEM(ob->mode,
-                 OB_MODE_PAINT_GPENCIL,
-                 OB_MODE_SCULPT_GPENCIL,
-                 OB_MODE_WEIGHT_GPENCIL,
-                 OB_MODE_VERTEX_GPENCIL)) {
+  if (ob && (ob->mode & OB_MODE_ALL_PAINT_GPENCIL)) {
     /* In grease pencil all transformations must be canceled if not Object or Edit. */
     return NULL;
   }
diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c
index 42563cb8f83..db0eaa36047 100644
--- a/source/blender/editors/undo/ed_undo.c
+++ b/source/blender/editors/undo/ed_undo.c
@@ -214,11 +214,7 @@ static void ed_undo_step_post(bContext *C,
     Object *obact = CTX_data_active_object(C);
     if (obact && (obact->type == OB_GPENCIL)) {
       /* set cursor */
-      if (ELEM(obact->mode,
-               OB_MODE_PAINT_GPENCIL,
-               OB_MODE_SCULPT_GPENCIL,
-               OB_MODE_WEIGHT_GPENCIL,
-               OB_MODE_VERTEX_GPENCIL)) {
+      if ((obact->mode & OB_MODE_ALL_PAINT_GPENCIL)) {
         ED_gpencil_toggle_brush_cursor(C, true, NULL);
       }
       else {



More information about the Bf-blender-cvs mailing list