Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2020-08-04 01:12:24 +0300
committerHans Goudey <h.goudey@me.com>2020-08-04 01:12:24 +0300
commitfbc3c1b24ddc6d48ec45e1919113db25e54d6de7 (patch)
treed2cab4a68e4236838a62b7b11fa2eedc7b5fae9c /source/blender/bmesh
parente9bcf0981929ca43318c0c5e3dd076c29820286f (diff)
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.
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r--source/blender/bmesh/tools/bmesh_bevel.c42
1 files changed, 21 insertions, 21 deletions
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;