[Bf-blender-cvs] [6279042d215] master: Cleanup: use const, doc-string for BevList.poly & rename args

Campbell Barton noreply at git.blender.org
Tue Jan 24 06:44:15 CET 2023


Commit: 6279042d215eaf4b5b2b09df1224349980f48b21
Author: Campbell Barton
Date:   Tue Jan 24 16:38:04 2023 +1100
Branches: master
https://developer.blender.org/rB6279042d215eaf4b5b2b09df1224349980f48b21

Cleanup: use const, doc-string for BevList.poly & rename args

It wasn't clear that BevList.poly was used to check cyclic BevList's.

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

M	source/blender/blenkernel/intern/curve.cc
M	source/blender/makesdna/DNA_curve_types.h

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

diff --git a/source/blender/blenkernel/intern/curve.cc b/source/blender/blenkernel/intern/curve.cc
index 7fe8174d864..51902169366 100644
--- a/source/blender/blenkernel/intern/curve.cc
+++ b/source/blender/blenkernel/intern/curve.cc
@@ -2063,7 +2063,7 @@ static void bevel_list_calc_bisect(BevList *bl)
 {
   BevPoint *bevp2, *bevp1, *bevp0;
   int nr;
-  bool is_cyclic = bl->poly != -1;
+  const bool is_cyclic = bl->poly != -1;
 
   if (is_cyclic) {
     bevp2 = bl->bevpoints;
@@ -2229,19 +2229,19 @@ static void make_bevel_list_3D_zup(BevList *bl)
   }
 }
 
-static void minimum_twist_between_two_points(BevPoint *current_point, BevPoint *previous_point)
+static void minimum_twist_between_two_points(BevPoint *bevp_curr, const BevPoint *bevp_prev)
 {
-  float angle = angle_normalized_v3v3(previous_point->dir, current_point->dir);
-  float q[4];
+  float angle = angle_normalized_v3v3(bevp_prev->dir, bevp_curr->dir);
 
   if (angle > 0.0f) { /* otherwise we can keep as is */
+    float q[4];
     float cross_tmp[3];
-    cross_v3_v3v3(cross_tmp, previous_point->dir, current_point->dir);
+    cross_v3_v3v3(cross_tmp, bevp_prev->dir, bevp_curr->dir);
     axis_angle_to_quat(q, cross_tmp, angle);
-    mul_qt_qtqt(current_point->quat, q, previous_point->quat);
+    mul_qt_qtqt(bevp_curr->quat, q, bevp_prev->quat);
   }
   else {
-    copy_qt_qt(current_point->quat, previous_point->quat);
+    copy_qt_qt(bevp_curr->quat, bevp_prev->quat);
   }
 }
 
@@ -2894,7 +2894,7 @@ void BKE_curve_bevelList_make(Object *ob, const ListBase *nurbs, const bool for_
 
     /* Scale the threshold so high resolution shapes don't get over reduced, see: T49850. */
     const float threshold_resolu = 0.00001f / resolu;
-    bool is_cyclic = bl->poly != -1;
+    const bool is_cyclic = bl->poly != -1;
     nr = bl->nr;
     if (is_cyclic) {
       bevp1 = bl->bevpoints;
diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h
index d8fdcd4e6e5..2203f7778bc 100644
--- a/source/blender/makesdna/DNA_curve_types.h
+++ b/source/blender/makesdna/DNA_curve_types.h
@@ -47,7 +47,9 @@ typedef struct BevPoint {
 typedef struct BevList {
   struct BevList *next, *prev;
   int nr, dupe_nr;
-  int poly, hole;
+  /** Cyclic when set to any value besides -1. */
+  int poly;
+  int hole;
   int charidx;
   int *segbevcount;
   float *seglen;



More information about the Bf-blender-cvs mailing list