[Bf-blender-cvs] [6483dee1412] master: Cleanup: replace int with bool type

Campbell Barton noreply at git.blender.org
Tue Dec 7 08:47:44 CET 2021


Commit: 6483dee1412e1da79e84f5ae791ea94c7aff15bf
Author: Campbell Barton
Date:   Tue Dec 7 18:14:39 2021 +1100
Branches: master
https://developer.blender.org/rB6483dee1412e1da79e84f5ae791ea94c7aff15bf

Cleanup: replace int with bool type

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

M	source/blender/blenkernel/BKE_colortools.h
M	source/blender/blenkernel/BKE_effect.h
M	source/blender/blenkernel/BKE_particle.h
M	source/blender/blenkernel/intern/colortools.c
M	source/blender/blenkernel/intern/effect.c
M	source/blender/blenkernel/intern/particle.c

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

diff --git a/source/blender/blenkernel/BKE_colortools.h b/source/blender/blenkernel/BKE_colortools.h
index 62d0afa4901..17fb48cdd27 100644
--- a/source/blender/blenkernel/BKE_colortools.h
+++ b/source/blender/blenkernel/BKE_colortools.h
@@ -149,7 +149,7 @@ void BKE_curvemapping_table_RGBA(const struct CurveMapping *cumap, float **array
  * Call when you do images etc, needs restore too. also verifies tables.
  * non-const (these modify the curve).
  */
-void BKE_curvemapping_premultiply(struct CurveMapping *cumap, int restore);
+void BKE_curvemapping_premultiply(struct CurveMapping *cumap, bool restore);
 
 void BKE_curvemapping_blend_write(struct BlendWriter *writer, const struct CurveMapping *cumap);
 void BKE_curvemapping_curves_blend_write(struct BlendWriter *writer,
diff --git a/source/blender/blenkernel/BKE_effect.h b/source/blender/blenkernel/BKE_effect.h
index 030b351f926..f33ca2f03d1 100644
--- a/source/blender/blenkernel/BKE_effect.h
+++ b/source/blender/blenkernel/BKE_effect.h
@@ -157,15 +157,15 @@ float effector_falloff(struct EffectorCache *eff,
                        struct EffectorData *efd,
                        struct EffectedPoint *point,
                        struct EffectorWeights *weights);
-int closest_point_on_surface(struct SurfaceModifierData *surmd,
-                             const float co[3],
-                             float surface_co[3],
-                             float surface_nor[3],
-                             float surface_vel[3]);
-int get_effector_data(struct EffectorCache *eff,
-                      struct EffectorData *efd,
-                      struct EffectedPoint *point,
-                      int real_velocity);
+bool closest_point_on_surface(struct SurfaceModifierData *surmd,
+                              const float co[3],
+                              float surface_co[3],
+                              float surface_nor[3],
+                              float surface_vel[3]);
+bool get_effector_data(struct EffectorCache *eff,
+                       struct EffectorData *efd,
+                       struct EffectedPoint *point,
+                       int real_velocity);
 
 /* required for particle_system.c */
 #if 0
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h
index 9b262fa6131..e3d59599ab3 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -441,12 +441,12 @@ void psys_get_particle_on_path(struct ParticleSimulationData *sim,
                                const bool vel);
 /**
  * Gets particle's state at a time.
- * \return 1 if particle exists and can be seen and 0 if not.
+ * \return true if particle exists and can be seen and false if not.
  */
-int psys_get_particle_state(struct ParticleSimulationData *sim,
-                            int p,
-                            struct ParticleKey *state,
-                            int always);
+bool psys_get_particle_state(struct ParticleSimulationData *sim,
+                             int p,
+                             struct ParticleKey *state,
+                             const bool always);
 
 /* Child paths. */
 
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 6703315a9de..b12b19453ae 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -795,7 +795,7 @@ static void curvemap_make_table(const CurveMapping *cumap, CurveMap *cuma)
   cuma->table = cmp;
 }
 
-void BKE_curvemapping_premultiply(CurveMapping *cumap, int restore)
+void BKE_curvemapping_premultiply(CurveMapping *cumap, bool restore)
 {
   /* It uses a flag to prevent pre-multiply or free to happen twice. */
 
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 0a863c7e465..8229228976c 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -652,11 +652,11 @@ float effector_falloff(EffectorCache *eff,
   return falloff;
 }
 
-int closest_point_on_surface(SurfaceModifierData *surmd,
-                             const float co[3],
-                             float surface_co[3],
-                             float surface_nor[3],
-                             float surface_vel[3])
+bool closest_point_on_surface(SurfaceModifierData *surmd,
+                              const float co[3],
+                              float surface_co[3],
+                              float surface_nor[3],
+                              float surface_vel[3])
 {
   BVHTreeNearest nearest;
 
@@ -683,18 +683,18 @@ int closest_point_on_surface(SurfaceModifierData *surmd,
 
       mul_v3_fl(surface_vel, (1.0f / 3.0f));
     }
-    return 1;
+    return true;
   }
 
-  return 0;
+  return false;
 }
-int get_effector_data(EffectorCache *eff,
-                      EffectorData *efd,
-                      EffectedPoint *point,
-                      int real_velocity)
+bool get_effector_data(EffectorCache *eff,
+                       EffectorData *efd,
+                       EffectedPoint *point,
+                       int real_velocity)
 {
   float cfra = DEG_get_ctime(eff->depsgraph);
-  int ret = 0;
+  bool ret = false;
 
   /* In case surface object is in Edit mode when loading the .blend,
    * surface modifier is never executed and bvhtree never built, see T48415. */
@@ -726,7 +726,7 @@ int get_effector_data(EffectorCache *eff,
 
       efd->size = 0.0f;
 
-      ret = 1;
+      ret = true;
     }
   }
   else if (eff->psys) {
@@ -794,7 +794,7 @@ int get_effector_data(EffectorCache *eff,
     zero_v3(efd->vel);
     efd->size = 0.0f;
 
-    ret = 1;
+    ret = true;
   }
 
   if (ret) {
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 18b3d69d59f..674f264feb7 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -4848,7 +4848,10 @@ void psys_get_particle_on_path(ParticleSimulationData *sim,
     }
   }
 }
-int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *state, int always)
+bool psys_get_particle_state(ParticleSimulationData *sim,
+                             int p,
+                             ParticleKey *state,
+                             const bool always)
 {
   ParticleSystem *psys = sim->psys;
   ParticleSettings *part = psys->part;
@@ -4863,12 +4866,12 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
 
   if (p >= totpart) {
     if (!psys->totchild) {
-      return 0;
+      return false;
     }
 
     if (part->childtype == PART_CHILD_FACES) {
       if (!(psys->flag & PSYS_KEYED)) {
-        return 0;
+        return false;
       }
 
       cpa = psys->child + p - totpart;
@@ -4878,7 +4881,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
       if (!always) {
         if ((state->time < 0.0f && !(part->flag & PART_UNBORN)) ||
             (state->time > 1.0f && !(part->flag & PART_DIED))) {
-          return 0;
+          return false;
         }
       }
 
@@ -4886,7 +4889,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
                     (part->lifetime * psys_frand(psys, p + 24));
 
       psys_get_particle_on_path(sim, p, state, 1);
-      return 1;
+      return true;
     }
 
     cpa = sim->psys->child + p - totpart;
@@ -4900,7 +4903,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
     if (!always) {
       if ((cfra < pa->time && (part->flag & PART_UNBORN) == 0) ||
           (cfra >= pa->dietime && (part->flag & PART_DIED) == 0)) {
-        return 0;
+        return false;
       }
     }
 
@@ -4910,7 +4913,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
   if (sim->psys->flag & PSYS_KEYED) {
     state->time = -cfra;
     psys_get_particle_on_path(sim, p, state, 1);
-    return 1;
+    return true;
   }
 
   if (cpa) {
@@ -5010,7 +5013,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
     }
   }
 
-  return 1;
+  return true;
 }
 
 void psys_get_dupli_texture(ParticleSystem *psys,



More information about the Bf-blender-cvs mailing list