[Bf-blender-cvs] [f5e55c33378] master: Cleanup: use bool instead of int in various places

Jacques Lucke noreply at git.blender.org
Wed Sep 2 19:13:14 CEST 2020


Commit: f5e55c33378b96e614710006121860eb880e6820
Author: Jacques Lucke
Date:   Wed Sep 2 19:10:18 2020 +0200
Branches: master
https://developer.blender.org/rBf5e55c33378b96e614710006121860eb880e6820

Cleanup: use bool instead of int in various places

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

M	source/blender/blenkernel/BKE_DerivedMesh.h
M	source/blender/blenkernel/BKE_colorband.h
M	source/blender/blenkernel/BKE_colortools.h
M	source/blender/blenkernel/BKE_fcurve.h
M	source/blender/blenkernel/BKE_image.h
M	source/blender/blenkernel/BKE_object.h
M	source/blender/blenkernel/intern/DerivedMesh.c
M	source/blender/blenkernel/intern/cloth.c
M	source/blender/blenkernel/intern/colorband.c
M	source/blender/blenkernel/intern/colortools.c
M	source/blender/blenkernel/intern/customdata.c
M	source/blender/blenkernel/intern/customdata_file.c
M	source/blender/blenkernel/intern/dynamicpaint.c
M	source/blender/blenkernel/intern/effect.c
M	source/blender/blenkernel/intern/fcurve.c
M	source/blender/blenkernel/intern/image.c
M	source/blender/blenkernel/intern/object.c
M	source/blender/blenkernel/intern/softbody.c
M	source/blender/editors/gpencil/gpencil_primitive.c
M	source/blender/editors/include/ED_object.h
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_ops.c
M	source/blender/editors/interface/view2d_ops.c
M	source/blender/editors/lattice/editlattice_tools.c
M	source/blender/editors/mask/mask_editaction.c
M	source/blender/editors/object/object_gpencil_modifier.c
M	source/blender/editors/object/object_hook.c
M	source/blender/editors/object/object_modifier.c
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/editors/sculpt_paint/sculpt_uv.c
M	source/blender/editors/sound/sound_ops.c
M	source/blender/editors/space_file/space_file.c
M	source/blender/editors/space_graph/graph_buttons.c
M	source/blender/editors/space_graph/graph_select.c
M	source/blender/editors/space_image/image_ops.c
M	source/blender/editors/space_node/drawnode.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_edit.c
M	source/blender/editors/space_node/node_intern.h
M	source/blender/editors/space_view3d/view3d_utils.c
M	source/blender/editors/space_view3d/view3d_view.c
M	source/blender/makesrna/intern/rna_color.c
M	source/blender/modifiers/intern/MOD_weightvgproximity.c
M	source/blender/python/mathutils/mathutils_Matrix.c

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

diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h
index 76c610fb5bd..9752185bc40 100644
--- a/source/blender/blenkernel/BKE_DerivedMesh.h
+++ b/source/blender/blenkernel/BKE_DerivedMesh.h
@@ -281,9 +281,9 @@ void DM_from_template(DerivedMesh *dm,
 
 /**
  * Utility function to release a DerivedMesh's layers
- * returns 1 if DerivedMesh has to be released by the backend, 0 otherwise.
+ * returns true if DerivedMesh has to be released by the backend, false otherwise.
  */
-int DM_release(DerivedMesh *dm);
+bool DM_release(DerivedMesh *dm);
 
 void DM_set_only_copy(DerivedMesh *dm, const struct CustomData_MeshMasks *mask);
 
diff --git a/source/blender/blenkernel/BKE_colorband.h b/source/blender/blenkernel/BKE_colorband.h
index 6ac96a1ed36..0f46ced8b06 100644
--- a/source/blender/blenkernel/BKE_colorband.h
+++ b/source/blender/blenkernel/BKE_colorband.h
@@ -40,7 +40,7 @@ struct ColorBand *BKE_colorband_add(bool rangetype);
 bool BKE_colorband_evaluate(const struct ColorBand *coba, float in, float out[4]);
 void BKE_colorband_evaluate_table_rgba(const struct ColorBand *coba, float **array, int *size);
 struct CBData *BKE_colorband_element_add(struct ColorBand *coba, float position);
-int BKE_colorband_element_remove(struct ColorBand *coba, int index);
+bool BKE_colorband_element_remove(struct ColorBand *coba, int index);
 void BKE_colorband_update_sort(struct ColorBand *coba);
 
 #ifdef __cplusplus
diff --git a/source/blender/blenkernel/BKE_colortools.h b/source/blender/blenkernel/BKE_colortools.h
index 1ada83c0163..73fe50c0c4f 100644
--- a/source/blender/blenkernel/BKE_colortools.h
+++ b/source/blender/blenkernel/BKE_colortools.h
@@ -95,7 +95,7 @@ void BKE_curvemapping_evaluate_premulRGBF_ex(const struct CurveMapping *cumap,
 void BKE_curvemapping_evaluate_premulRGBF(const struct CurveMapping *cumap,
                                           float vecout[3],
                                           const float vecin[3]);
-int BKE_curvemapping_RGBA_does_something(const struct CurveMapping *cumap);
+bool BKE_curvemapping_RGBA_does_something(const struct CurveMapping *cumap);
 void BKE_curvemapping_table_RGBA(const struct CurveMapping *cumap, float **array, int *size);
 
 /* non-const, these modify the curve */
diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h
index b316fc28726..98702279706 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -273,7 +273,7 @@ void calchandles_fcurve(struct FCurve *fcu);
 void calchandles_fcurve_ex(struct FCurve *fcu, eBezTriple_Flag handle_sel_flag);
 void testhandles_fcurve(struct FCurve *fcu, eBezTriple_Flag sel_flag, const bool use_handle);
 void sort_time_fcurve(struct FCurve *fcu);
-short test_time_fcurve(struct FCurve *fcu);
+bool test_time_fcurve(struct FCurve *fcu);
 
 void correct_bezpart(const float v1[2], float v2[2], float v3[2], const float v4[2]);
 
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index f052ba400fc..a04f6438170 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -121,10 +121,10 @@ char BKE_image_ftype_to_imtype(const int ftype, const struct ImbFormatOptions *o
 int BKE_image_imtype_to_ftype(const char imtype, struct ImbFormatOptions *r_options);
 
 bool BKE_imtype_is_movie(const char imtype);
-int BKE_imtype_supports_zbuf(const char imtype);
-int BKE_imtype_supports_compress(const char imtype);
-int BKE_imtype_supports_quality(const char imtype);
-int BKE_imtype_requires_linear_float(const char imtype);
+bool BKE_imtype_supports_zbuf(const char imtype);
+bool BKE_imtype_supports_compress(const char imtype);
+bool BKE_imtype_supports_quality(const char imtype);
+bool BKE_imtype_requires_linear_float(const char imtype);
 char BKE_imtype_valid_channels(const char imtype, bool write_file);
 char BKE_imtype_valid_depths(const char imtype);
 
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 2029f4d38a1..020225d2794 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -311,10 +311,10 @@ void BKE_object_handle_update_ex(struct Depsgraph *depsgraph,
 
 void BKE_object_sculpt_data_create(struct Object *ob);
 
-int BKE_object_obdata_texspace_get(struct Object *ob,
-                                   short **r_texflag,
-                                   float **r_loc,
-                                   float **r_size);
+bool BKE_object_obdata_texspace_get(struct Object *ob,
+                                    short **r_texflag,
+                                    float **r_loc,
+                                    float **r_size);
 
 struct Mesh *BKE_object_get_evaluated_mesh(struct Object *object);
 struct Mesh *BKE_object_get_pre_modified_mesh(struct Object *object);
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 263f63cb6da..681e46ed24e 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -407,7 +407,7 @@ void DM_from_template(DerivedMesh *dm,
                       &CD_MASK_DERIVEDMESH);
 }
 
-int DM_release(DerivedMesh *dm)
+bool DM_release(DerivedMesh *dm)
 {
   if (dm->needsFree) {
     CustomData_free(&dm->vertData, dm->numVertData);
@@ -420,7 +420,7 @@ int DM_release(DerivedMesh *dm)
     dm->looptris.num = 0;
     dm->looptris.num_alloc = 0;
 
-    return 1;
+    return true;
   }
 
   CustomData_free_temporary(&dm->vertData, dm->numVertData);
@@ -429,7 +429,7 @@ int DM_release(DerivedMesh *dm)
   CustomData_free_temporary(&dm->loopData, dm->numLoopData);
   CustomData_free_temporary(&dm->polyData, dm->numPolyData);
 
-  return 0;
+  return false;
 }
 
 void DM_DupPolys(DerivedMesh *source, DerivedMesh *target)
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index 24b4b85d0d4..62e2294345d 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -56,12 +56,12 @@
  */
 static void cloth_to_object(Object *ob, ClothModifierData *clmd, float (*vertexCos)[3]);
 static void cloth_from_mesh(ClothModifierData *clmd, Mesh *mesh);
-static int cloth_from_object(
+static bool cloth_from_object(
     Object *ob, ClothModifierData *clmd, Mesh *mesh, float framenr, int first);
 static void cloth_update_springs(ClothModifierData *clmd);
 static void cloth_update_verts(Object *ob, ClothModifierData *clmd, Mesh *mesh);
 static void cloth_update_spring_lengths(ClothModifierData *clmd, Mesh *mesh);
-static int cloth_build_springs(ClothModifierData *clmd, Mesh *mesh);
+static bool cloth_build_springs(ClothModifierData *clmd, Mesh *mesh);
 static void cloth_apply_vgroup(ClothModifierData *clmd, Mesh *mesh);
 
 typedef struct BendSpringRef {
@@ -324,7 +324,7 @@ void cloth_clear_cache(Object *ob, ClothModifierData *clmd, float framenr)
   BKE_ptcache_id_clear(&pid, PTCACHE_CLEAR_AFTER, framenr);
 }
 
-static int do_init_cloth(Object *ob, ClothModifierData *clmd, Mesh *result, int framenr)
+static bool do_init_cloth(Object *ob, ClothModifierData *clmd, Mesh *result, int framenr)
 {
   PointCache *cache;
 
@@ -335,13 +335,13 @@ static int do_init_cloth(Object *ob, ClothModifierData *clmd, Mesh *result, int
     if (!cloth_from_object(ob, clmd, result, framenr, 1)) {
       BKE_ptcache_invalidate(cache);
       BKE_modifier_set_error(&(clmd->modifier), "Can't initialize cloth");
-      return 0;
+      return false;
     }
 
     if (clmd->clothObject == NULL) {
       BKE_ptcache_invalidate(cache);
       BKE_modifier_set_error(&(clmd->modifier), "Null cloth object");
-      return 0;
+      return false;
     }
 
     SIM_cloth_solver_set_positions(clmd);
@@ -356,7 +356,7 @@ static int do_init_cloth(Object *ob, ClothModifierData *clmd, Mesh *result, int
     clmd->sim_parms->dt = 1.0f / clmd->sim_parms->stepsPerFrame;
   }
 
-  return 1;
+  return true;
 }
 
 static int do_step_cloth(
@@ -818,7 +818,7 @@ static float cloth_shrink_factor(ClothModifierData *clmd, ClothVertex *verts, in
   return sqrtf(k1 * k2);
 }
 
-static int cloth_from_object(
+static bool cloth_from_object(
     Object *ob, ClothModifierData *clmd, Mesh *mesh, float UNUSED(framenr), int first)
 {
   int i = 0;
@@ -843,12 +843,12 @@ static int cloth_from_object(
   }
   else {
     BKE_modifier_set_error(&(clmd->modifier), "Out of memory on allocating clmd->clothObject");
-    return 0;
+    return false;
   }
 
   // mesh input objects need Mesh
   if (!mesh) {
-    return 0;
+    return false;
   }
 
   cloth_from_mesh(clmd, mesh);
@@ -915,7 +915,7 @@ static int cloth_from_object(
   if (!cloth_build_springs(clmd, mesh)) {
     cloth_free_modifier(clmd);
     BKE_modifier_set_error(&(clmd->modifier), "Cannot build springs");
-    return 0;
+    return false;
   }
 
   // init our solver
@@ -928,7 +928,7 @@ static int cloth_from_object(
   clmd->clothObject->bvhtree = bvhtree_build_from_cloth(clmd, clmd->coll_parms->epsilon);
   clmd->clothObject->bvhselftree = bvhtree_build_from_cloth(clmd, clmd->coll_parms->selfepsilon);
 
-  return 1;
+  return true;
 }
 
 static void cloth_from_mesh(ClothModifierData *clmd, Mesh *mesh)
@@ -1560,7 +1560,7 @@ static bool find_internal_spring_target_vertex(BVHTreeFromMesh *treedata,
   return false;
 }
 
-static int cloth_build_springs(ClothModifierData *clmd, Mesh *mesh)
+static bool cloth_build_springs(ClothModifierData *clmd, Mesh *mesh)
 {
   Cloth *cloth = clmd->clothObject;
   ClothSpring *spring = NULL, *tspring = NULL, *tspring2 = NULL;
@@ -1580,7 +1580,7 @@ static int cloth_build_springs(ClothModifierData *clmd, Mesh *mesh)
 
   // error handling
   if (numedges == 0) {
-    return 0;
+    return false;
   }
 
   /* NOTE: handling ownership of springs and edgeset is quite sloppy
@@ -1595,14 +1595,14 @@ static int cloth_build_springs(ClothModifierData *clmd, Mesh *mesh)
     spring_ref = MEM_callocN(sizeof(*spring_ref) * numedges, "temp bend spring reference");
 
     if (!spring_ref) {
-      return 0;
+      return false;
     }
   }
   else {
     e

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list