[Bf-blender-cvs] [75aac463e79] master: Cleanup: comments, use bool return value

Campbell Barton noreply at git.blender.org
Sat Jun 13 08:21:58 CEST 2020


Commit: 75aac463e795d7b8b5b19d55b5620618b176c211
Author: Campbell Barton
Date:   Sat Jun 13 15:16:18 2020 +1000
Branches: master
https://developer.blender.org/rB75aac463e795d7b8b5b19d55b5620618b176c211

Cleanup: comments, use bool return value

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

M	source/blender/blenkernel/BKE_anim_path.h
M	source/blender/blenkernel/BKE_curve.h
M	source/blender/blenkernel/intern/anim_path.c
M	source/blender/blenkernel/intern/curve_deform.c

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

diff --git a/source/blender/blenkernel/BKE_anim_path.h b/source/blender/blenkernel/BKE_anim_path.h
index 64bcedefa58..15af144986f 100644
--- a/source/blender/blenkernel/BKE_anim_path.h
+++ b/source/blender/blenkernel/BKE_anim_path.h
@@ -36,13 +36,13 @@ struct Path;
 
 void free_path(struct Path *path);
 void calc_curvepath(struct Object *ob, struct ListBase *nurbs);
-int where_on_path(struct Object *ob,
-                  float ctime,
-                  float vec[4],
-                  float dir[3],
-                  float quat[4],
-                  float *radius,
-                  float *weight);
+bool where_on_path(struct Object *ob,
+                   float ctime,
+                   float vec[4],
+                   float dir[3],
+                   float quat[4],
+                   float *radius,
+                   float *weight);
 
 #ifdef __cplusplus
 }
diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h
index 81e595aa94d..5ea77058520 100644
--- a/source/blender/blenkernel/BKE_curve.h
+++ b/source/blender/blenkernel/BKE_curve.h
@@ -331,8 +331,8 @@ void BKE_curve_deform_co(struct Object *ob_curve,
                          struct Object *ob_target,
                          const float orco[3],
                          float vec[3],
-                         float mat[3][3],
-                         const int no_rot_axis);
+                         const int no_rot_axis,
+                         float r_mat[3][3]);
 
 /** \} */
 
diff --git a/source/blender/blenkernel/intern/anim_path.c b/source/blender/blenkernel/intern/anim_path.c
index e94f0d6ff85..92b5bd345cf 100644
--- a/source/blender/blenkernel/intern/anim_path.c
+++ b/source/blender/blenkernel/intern/anim_path.c
@@ -42,9 +42,11 @@ static CLG_LogRef LOG = {"bke.anim"};
 /* ******************************************************************** */
 /* Curve Paths - for curve deforms and/or curve following */
 
-/* free curve path data
- * NOTE: frees the path itself!
- * NOTE: this is increasingly inaccurate with non-uniform BevPoint subdivisions [#24633]
+/**
+ * Free curve path data
+ *
+ * \note Frees the path itself!
+ * \note This is increasingly inaccurate with non-uniform #BevPoint subdivisions T24633.
  */
 void free_path(Path *path)
 {
@@ -54,8 +56,9 @@ void free_path(Path *path)
   MEM_freeN(path);
 }
 
-/* calculate a curve-deform path for a curve
- * - only called from displist.c -> do_makeDispListCurveTypes
+/**
+ * Calculate a curve-deform path for a curve
+ * - Only called from displist.c -> #do_makeDispListCurveTypes
  */
 void calc_curvepath(Object *ob, ListBase *nurbs)
 {
@@ -192,20 +195,21 @@ static int interval_test(const int min, const int max, int p1, const int cycl)
   return p1;
 }
 
-/* calculate the deformation implied by the curve path at a given parametric position,
+/**
+ * Calculate the deformation implied by the curve path at a given parametric position,
  * and returns whether this operation succeeded.
  *
- * note: ctime is normalized range <0-1>
+ * \param ctime: Time is normalized range <0-1>.
  *
- * returns OK: 1/0
+ * \return success.
  */
-int where_on_path(Object *ob,
-                  float ctime,
-                  float vec[4],
-                  float dir[3],
-                  float quat[4],
-                  float *radius,
-                  float *weight)
+bool where_on_path(Object *ob,
+                   float ctime,
+                   float vec[4],
+                   float dir[3],
+                   float quat[4],
+                   float *radius,
+                   float *weight)
 {
   Curve *cu;
   Nurb *nu;
@@ -218,13 +222,13 @@ int where_on_path(Object *ob,
   ListBase *nurbs;
 
   if (ob == NULL || ob->type != OB_CURVE) {
-    return 0;
+    return false;
   }
   cu = ob->data;
   if (ob->runtime.curve_cache == NULL || ob->runtime.curve_cache->path == NULL ||
       ob->runtime.curve_cache->path->data == NULL) {
     CLOG_WARN(&LOG, "no path!");
-    return 0;
+    return false;
   }
   path = ob->runtime.curve_cache->path;
   pp = path->data;
@@ -232,10 +236,10 @@ int where_on_path(Object *ob,
   /* test for cyclic */
   bl = ob->runtime.curve_cache->bev.first;
   if (!bl) {
-    return 0;
+    return false;
   }
   if (!bl->nr) {
-    return 0;
+    return false;
   }
   if (bl->poly > -1) {
     cycl = 1;
@@ -343,5 +347,5 @@ int where_on_path(Object *ob,
               data[3] * p3->weight;
   }
 
-  return 1;
+  return true;
 }
diff --git a/source/blender/blenkernel/intern/curve_deform.c b/source/blender/blenkernel/intern/curve_deform.c
index e0a6c5b958c..d2653ff477b 100644
--- a/source/blender/blenkernel/intern/curve_deform.c
+++ b/source/blender/blenkernel/intern/curve_deform.c
@@ -66,9 +66,10 @@ static void init_curve_deform(Object *ob_curve, Object *ob_target, CurveDeform *
   cd->no_rot_axis = 0;
 }
 
-/* this makes sure we can extend for non-cyclic.
+/**
+ * This makes sure we can extend for non-cyclic.
  *
- * returns OK: 1/0
+ * \return Success.
  */
 static bool where_on_path_deform(
     Object *ob_curve, float ctime, float vec[4], float dir[3], float quat[4], float *radius)
@@ -129,11 +130,13 @@ static bool where_on_path_deform(
   return false;
 }
 
-/* for each point, rotate & translate to curve */
-/* use path, since it has constant distances */
-/* co: local coord, result local too */
-/* returns quaternion for rotation, using cd->no_rot_axis */
-/* axis is using another define!!! */
+/**
+ * For each point, rotate & translate to curve use path, since it has constant distances.
+ *
+ * \param co: local coord, result local too.
+ * \param r_quat: returns quaternion for rotation,
+ * using #CurveDeform.no_rot_axis axis is using another define.
+ */
 static bool calc_curve_deform(
     Object *ob_curve, float co[3], const short axis, CurveDeform *cd, float r_quat[4])
 {
@@ -451,21 +454,24 @@ void BKE_curve_deform_coords_with_editmesh(Object *ob_curve,
                            em_target);
 }
 
-/* input vec and orco = local coord in armature space */
-/* orco is original not-animated or deformed reference point */
-/* result written in vec and mat */
+/**
+ * \param orco: Input vec and orco = local coord in curve space
+ * orco is original not-animated or deformed reference point.
+ *
+ * The result written in vec and r_mat.
+ */
 void BKE_curve_deform_co(Object *ob_curve,
                          Object *ob_target,
                          const float orco[3],
                          float vec[3],
-                         float mat[3][3],
-                         const int no_rot_axis)
+                         const int no_rot_axis,
+                         float r_mat[3][3])
 {
   CurveDeform cd;
   float quat[4];
 
   if (ob_curve->type != OB_CURVE) {
-    unit_m3(mat);
+    unit_m3(r_mat);
     return;
   }
 
@@ -481,10 +487,10 @@ void BKE_curve_deform_co(Object *ob_curve,
     float qmat[3][3];
 
     quat_to_mat3(qmat, quat);
-    mul_m3_m3m3(mat, qmat, cd.objectspace3);
+    mul_m3_m3m3(r_mat, qmat, cd.objectspace3);
   }
   else {
-    unit_m3(mat);
+    unit_m3(r_mat);
   }
 
   mul_m4_v3(cd.objectspace, vec);



More information about the Bf-blender-cvs mailing list