[Bf-blender-cvs] [fbc3c1b24dd] blender-v2.90-release: Fix (unreported): Bevel tool custom profile uses wrong segments number

Hans Goudey noreply at git.blender.org
Tue Aug 4 00:12:58 CEST 2020


Commit: fbc3c1b24ddc6d48ec45e1919113db25e54d6de7
Author: Hans Goudey
Date:   Mon Aug 3 18:12:24 2020 -0400
Branches: blender-v2.90-release
https://developer.blender.org/rBfbc3c1b24ddc6d48ec45e1919113db25e54d6de7

Fix (unreported): Bevel tool custom profile uses wrong segments number

The bevel code initialized the CurveProfile with the "higher power of 2"
segments after the normal number of segments, leaving the widget in an
incorrect state after the calculation. A simple fix is to re-order the
initializations, doing the input number second.

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

M	source/blender/bmesh/tools/bmesh_bevel.c

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

diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c
index 588f716142d..6c666183755 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -7148,27 +7148,6 @@ static void set_profile_spacing(BevelParams *bp, ProfileSpacing *pro_spacing, bo
   seg = bp->seg;
   seg_2 = power_of_2_max_i(bp->seg);
   if (seg > 1) {
-    /* Sample the input number of segments. */
-    pro_spacing->xvals = (double *)BLI_memarena_alloc(bp->mem_arena,
-                                                      (size_t)(seg + 1) * sizeof(double));
-    pro_spacing->yvals = (double *)BLI_memarena_alloc(bp->mem_arena,
-                                                      (size_t)(seg + 1) * sizeof(double));
-    if (custom) {
-      /* Make sure the curve profile's sample table is full. */
-      if (bp->custom_profile->segments_len != seg || !bp->custom_profile->segments) {
-        BKE_curveprofile_initialize((CurveProfile *)bp->custom_profile, (short)seg);
-      }
-
-      /* Copy segment locations into the profile spacing struct. */
-      for (int i = 0; i < seg + 1; i++) {
-        pro_spacing->xvals[i] = (double)bp->custom_profile->segments[i].y;
-        pro_spacing->yvals[i] = (double)bp->custom_profile->segments[i].x;
-      }
-    }
-    else {
-      find_even_superellipse_chords(seg, bp->pro_super_r, pro_spacing->xvals, pro_spacing->yvals);
-    }
-
     /* Sample the seg_2 segments used for subdividing the vertex meshes. */
     if (seg_2 == 2) {
       seg_2 = 4;
@@ -7198,6 +7177,27 @@ static void set_profile_spacing(BevelParams *bp, ProfileSpacing *pro_spacing, bo
             seg_2, bp->pro_super_r, pro_spacing->xvals_2, pro_spacing->yvals_2);
       }
     }
+
+    /* Sample the input number of segments. */
+    pro_spacing->xvals = (double *)BLI_memarena_alloc(bp->mem_arena,
+                                                      (size_t)(seg + 1) * sizeof(double));
+    pro_spacing->yvals = (double *)BLI_memarena_alloc(bp->mem_arena,
+                                                      (size_t)(seg + 1) * sizeof(double));
+    if (custom) {
+      /* Make sure the curve profile's sample table is full. */
+      if (bp->custom_profile->segments_len != seg || !bp->custom_profile->segments) {
+        BKE_curveprofile_initialize((CurveProfile *)bp->custom_profile, (short)seg);
+      }
+
+      /* Copy segment locations into the profile spacing struct. */
+      for (int i = 0; i < seg + 1; i++) {
+        pro_spacing->xvals[i] = (double)bp->custom_profile->segments[i].y;
+        pro_spacing->yvals[i] = (double)bp->custom_profile->segments[i].x;
+      }
+    }
+    else {
+      find_even_superellipse_chords(seg, bp->pro_super_r, pro_spacing->xvals, pro_spacing->yvals);
+    }
   }
   else { /* Only 1 segment, we don't need any profile information. */
     pro_spacing->xvals = NULL;



More information about the Bf-blender-cvs mailing list