[Bf-blender-cvs] [25380802d70] master: Cleanup: Use bool instead of int

Hans Goudey noreply at git.blender.org
Tue Sep 8 20:55:30 CEST 2020


Commit: 25380802d702e65bc232efb5cd7768d6ace165d4
Author: Hans Goudey
Date:   Tue Sep 8 13:54:39 2020 -0500
Branches: master
https://developer.blender.org/rB25380802d702e65bc232efb5cd7768d6ace165d4

Cleanup: Use bool instead of int

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

M	source/blender/editors/screen/screen_ops.c

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

diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index b79447273d6..32b91dbd327 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -105,55 +105,55 @@
 bool ED_operator_regionactive(bContext *C)
 {
   if (CTX_wm_window(C) == NULL) {
-    return 0;
+    return false;
   }
   if (CTX_wm_screen(C) == NULL) {
-    return 0;
+    return false;
   }
   if (CTX_wm_region(C) == NULL) {
-    return 0;
+    return false;
   }
-  return 1;
+  return true;
 }
 
 bool ED_operator_areaactive(bContext *C)
 {
   if (CTX_wm_window(C) == NULL) {
-    return 0;
+    return false;
   }
   if (CTX_wm_screen(C) == NULL) {
-    return 0;
+    return false;
   }
   if (CTX_wm_area(C) == NULL) {
-    return 0;
+    return false;
   }
-  return 1;
+  return true;
 }
 
 bool ED_operator_screenactive(bContext *C)
 {
   if (CTX_wm_window(C) == NULL) {
-    return 0;
+    return false;
   }
   if (CTX_wm_screen(C) == NULL) {
-    return 0;
+    return false;
   }
-  return 1;
+  return true;
 }
 
 /* XXX added this to prevent anim state to change during renders */
 static bool ED_operator_screenactive_norender(bContext *C)
 {
   if (G.is_rendering) {
-    return 0;
+    return false;
   }
   if (CTX_wm_window(C) == NULL) {
-    return 0;
+    return false;
   }
   if (CTX_wm_screen(C) == NULL) {
-    return 0;
+    return false;
   }
-  return 1;
+  return true;
 }
 
 /* when mouse is over area-edge */
@@ -161,25 +161,25 @@ bool ED_operator_screen_mainwinactive(bContext *C)
 {
   bScreen *screen;
   if (CTX_wm_window(C) == NULL) {
-    return 0;
+    return false;
   }
   screen = CTX_wm_screen(C);
   if (screen == NULL) {
-    return 0;
+    return false;
   }
   if (screen->active_region != NULL) {
-    return 0;
+    return false;
   }
-  return 1;
+  return true;
 }
 
 bool ED_operator_scene(bContext *C)
 {
   Scene *scene = CTX_data_scene(C);
   if (scene) {
-    return 1;
+    return true;
   }
-  return 0;
+  return false;
 }
 
 bool ED_operator_scene_editable(bContext *C)
@@ -197,18 +197,18 @@ bool ED_operator_objectmode(bContext *C)
   Object *obact = CTX_data_active_object(C);
 
   if (scene == NULL || ID_IS_LINKED(scene)) {
-    return 0;
+    return false;
   }
   if (CTX_data_edit_object(C)) {
-    return 0;
+    return false;
   }
 
   /* add a check for ob->mode too? */
   if (obact && (obact->mode != OB_MODE_OBJECT)) {
-    return 0;
+    return false;
   }
 
-  return 1;
+  return true;
 }
 
 static bool ed_spacetype_test(bContext *C, int type)
@@ -217,7 +217,7 @@ static bool ed_spacetype_test(bContext *C, int type)
     SpaceLink *sl = (SpaceLink *)CTX_wm_space_data(C);
     return sl && (sl->spacetype == type);
   }
-  return 0;
+  return false;
 }
 
 bool ED_operator_view3d_active(bContext *C)
@@ -246,7 +246,7 @@ bool ED_operator_animview_active(bContext *C)
   }
 
   CTX_wm_operator_poll_msg_set(C, "expected a timeline/animation area to be active");
-  return 0;
+  return false;
 }
 
 bool ED_operator_outliner_active(bContext *C)
@@ -260,11 +260,11 @@ bool ED_operator_outliner_active_no_editobject(bContext *C)
     Object *ob = ED_object_active_context(C);
     Object *obedit = CTX_data_edit_object(C);
     if (ob && ob == obedit) {
-      return 0;
+      return false;
     }
-    return 1;
+    return true;
   }
-  return 0;
+  return false;
 }
 
 bool ED_operator_file_active(bContext *C)
@@ -287,10 +287,10 @@ bool ED_operator_node_active(bContext *C)
   SpaceNode *snode = CTX_wm_space_node(C);
 
   if (snode && snode->edittree) {
-    return 1;
+    return true;
   }
 
-  return 0;
+  return false;
 }
 
 bool ED_operator_node_editable(bContext *C)
@@ -298,10 +298,10 @@ bool ED_operator_node_editable(bContext *C)
   SpaceNode *snode = CTX_wm_space_node(C);
 
   if (snode && snode->edittree && !ID_IS_LINKED(snode->edittree)) {
-    return 1;
+    return true;
   }
 
-  return 0;
+  return false;
 }
 
 bool ED_operator_graphedit_active(bContext *C)
@@ -400,7 +400,7 @@ bool ED_operator_editmesh(bContext *C)
   if (obedit && obedit->type == OB_MESH) {
     return NULL != BKE_editmesh_from_object(obedit);
   }
-  return 0;
+  return false;
 }
 
 bool ED_operator_editmesh_view3d(bContext *C)
@@ -411,11 +411,11 @@ bool ED_operator_editmesh_view3d(bContext *C)
 bool ED_operator_editmesh_region_view3d(bContext *C)
 {
   if (ED_operator_editmesh(C) && CTX_wm_region_view3d(C)) {
-    return 1;
+    return true;
   }
 
   CTX_wm_operator_poll_msg_set(C, "expected a view3d region & editmesh");
-  return 0;
+  return false;
 }
 
 bool ED_operator_editmesh_auto_smooth(bContext *C)
@@ -424,7 +424,7 @@ bool ED_operator_editmesh_auto_smooth(bContext *C)
   if (obedit && obedit->type == OB_MESH && (((Mesh *)(obedit->data))->flag & ME_AUTOSMOOTH)) {
     return NULL != BKE_editmesh_from_object(obedit);
   }
-  return 0;
+  return false;
 }
 
 bool ED_operator_editarmature(bContext *C)
@@ -433,7 +433,7 @@ bool ED_operator_editarmature(bContext *C)
   if (obedit && obedit->type == OB_ARMATURE) {
     return NULL != ((bArmature *)obedit->data)->edbo;
   }
-  return 0;
+  return false;
 }
 
 /**
@@ -451,12 +451,12 @@ bool ED_operator_posemode_exclusive(bContext *C)
     Object *obpose;
     if ((obpose = BKE_object_pose_armature_get(obact))) {
       if (obact == obpose) {
-        return 1;
+        return true;
       }
     }
   }
 
-  return 0;
+  return false;
 }
 
 /* allows for pinned pose objects to be used in the object buttons
@@ -467,11 +467,11 @@ bool ED_operator_posemode_context(bContext *C)
 
   if (obpose && !(obpose->mode & OB_MODE_EDIT)) {
     if (BKE_object_pose_context_check(obpose)) {
-      return 1;
+      return true;
     }
   }
 
-  return 0;
+  return false;
 }
 
 bool ED_operator_posemode(bContext *C)
@@ -482,12 +482,12 @@ bool ED_operator_posemode(bContext *C)
     Object *obpose;
     if ((obpose = BKE_object_pose_armature_get(obact))) {
       if ((obact == obpose) || (obact->mode & OB_MODE_ALL_WEIGHT_PAINT)) {
-        return 1;
+        return true;
       }
     }
   }
 
-  return 0;
+  return false;
 }
 
 bool ED_operator_posemode_local(bContext *C)
@@ -537,17 +537,17 @@ bool ED_operator_editsurfcurve(bContext *C)
   if (obedit && ELEM(obedit->type, OB_CURVE, OB_SURF)) {
     return NULL != ((Curve *)obedit->data)->editnurb;
   }
-  return 0;
+  return false;
 }
 
 bool ED_operator_editsurfcurve_region_view3d(bContext *C)
 {
   if (ED_operator_editsurfcurve(C) && CTX_wm_region_view3d(C)) {
-    return 1;
+    return true;
   }
 
   CTX_wm_operator_poll_msg_set(C, "expected a view3d region & editcurve");
-  return 0;
+  return false;
 }
 
 bool ED_operator_editcurve(bContext *C)
@@ -556,7 +556,7 @@ bool ED_operator_editcurve(bContext *C)
   if (obedit && obedit->type == OB_CURVE) {
     return NULL != ((Curve *)obedit->data)->editnurb;
   }
-  return 0;
+  return false;
 }
 
 bool ED_operator_editcurve_3d(bContext *C)
@@ -567,7 +567,7 @@ bool ED_operator_editcurve_3d(bContext *C)
 
     return (cu->flag & CU_3D) && (NULL != cu->editnurb);
   }
-  return 0;
+  return false;
 }
 
 bool ED_operator_editsurf(bContext *C)
@@ -576,7 +576,7 @@ bool ED_operator_editsurf(bContext *C)
   if (obedit && obedit->type == OB_SURF) {
     return NULL != ((Curve *)obedit->data)->editnurb;
   }
-  return 0;
+  return false;
 }
 
 bool ED_operator_editfont(bContext *C)
@@ -585,7 +585,7 @@ bool ED_operator_editfont(bContext *C)
   if (obedit && obedit->type == OB_FONT) {
     return NULL != ((Curve *)obedit->data)->editfont;
   }
-  return 0;
+  return false;
 }
 
 bool ED_operator_editlattice(bContext *C)
@@ -594,7 +594,7 @@ bool ED_operator_editlattice(bContext *C)
   if (obedit && obedit->type == OB_LATTICE) {
     return NULL != ((Lattice *)obedit->data)->editlatt;
   }
-  return 0;
+  return false;
 }
 
 bool ED_operator_editmball(bContext *C)
@@ -603,7 +603,7 @@ bool ED_operator_editmball(bContext *C)
   if (obedit && obedit->type == OB_MBALL) {
     return NULL != ((MetaBall *)obedit->data)->editelems;
   }
-  return 0;
+  return false;
 }
 
 bool ED_operator_mask(bContext *C)
@@ -649,11 +649,11 @@ static bool screen_active_editable(bContext *C)
   if (ED_operator_screenactive(C)) {
     /* no full window splitting allowed */
     if (CTX_wm_screen(C)->state != SCREENNORMAL) {
-      return 0;
+      return false;
     }
-    return 1;
+    return true;
   }
-  return 0;
+  return false;
 }
 
 /** \} */
@@ -702,12 +702,12 @@ static bool actionzone_area_poll(bContext *C)
     LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
       LISTBASE_FOREACH (AZone *, az, &area->actionzones) {
         if (BLI_rcti_isect_pt_v(&az->rect, xy)) {
-          return 1;
+          return true;
         }
       }
     }
   }
-  return 0;
+  return false;
 }
 
 /* the debug drawing of the click_rect is in area_draw_azone_fullscreen, keep both in sync */
@@ -901,7 +901,7 @@ static AZone *area_actionzone_refresh_xy(ScrArea *area, const int xy[2], const b
           ED_region_tag_redraw_no_rebuild(az->region);
         }
         else {
-          BLI_assert(0);
+          BLI_assert(false);
         }
       }
     }
@@ -1213,13 +1213,13 @@ typedef struct sAreaSwapData {
   ScrArea *sa1, *sa2;
 } sAreaSwapData;
 
-static int area_swap_init(wmOperator *op, const wmEvent *event)
+static bool area_swap_init(wmOperator *op, const wmEvent *event)
 {
   sAreaSwapData *sd = NULL;
   sActionzoneData *sad = event->customdata;
 
   if (sad == NULL || sad->sa1 == NULL) {
-    return 0;
+    return false;
   }
 
   sd = MEM_callocN(sizeof(sAreaSwapData), "sAreaSwapData");
@@ -1227,7 +1227,7 @@ static int area_swap_init(wmOperator *op, const wmEvent *event)
   sd->sa2 = sad->sa2;
   op->customdata = sd;
 
-  return 1;
+  return true;
 }
 
 static void area_swap_exit(bContext *C, wmOperator *op)
@@ -1246,7 +1246,6 @@ static void area_swap_cancel(bContext *C, wmOperator *op)
 
 static int area_swap_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 {
-
   if (!area_swap_init(op, event)) {
     return OPERATOR_PASS_THROUGH;
   }
@@ -1573,8 +1572,8 @@ static void area_move_set_limits(wmWindow *win,
 }
 
 /* validate selection inside screen, set variables OK */
-/* return

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list