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:
authorYimingWu <xp8110@outlook.com>2022-05-23 11:15:15 +0300
committerYimingWu <xp8110@outlook.com>2022-05-23 11:17:00 +0300
commitc4e5a7d59a06e833d9e4de45d4eb3cf632a1e9e4 (patch)
tree2652d8bfdf0ec6671d66bdf22233522f2f18658c /source/blender
parentb81f1b8cf17196122a7203dc79f4c20c1cd9d5bf (diff)
Fix T98258: Duplicated last vertex after GPencil sample.
Also fixed an unreported issue of incorrect interpolation of thickness. Reviewed By: Aleš Jelovčan (frogstomp), Antonio Vazquez (antoniov) Differential Revision: https://developer.blender.org/D15005
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/gpencil_geom.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/gpencil_geom.cc b/source/blender/blenkernel/intern/gpencil_geom.cc
index 041696fa8d3..dd22d64aee1 100644
--- a/source/blender/blenkernel/intern/gpencil_geom.cc
+++ b/source/blender/blenkernel/intern/gpencil_geom.cc
@@ -236,6 +236,7 @@ static int stroke_march_next_point(const bGPDstroke *gps,
}
else {
next_point_index = gps->totpoints - 1;
+ remaining_till_next = 0;
break;
}
}
@@ -263,15 +264,18 @@ static int stroke_march_next_point(const bGPDstroke *gps,
float ratio = remaining_march / remaining_till_next;
interp_v3_v3v3(result, step_start, point, ratio);
*ratio_result = ratio;
+ float d1 = len_v3v3(result, &gps->points[*index_from].x);
+ float d2 = len_v3v3(result, &gps->points[next_point_index].x);
+ float vratio = d1 / (d1 + d2);
*pressure = interpf(
- gps->points[next_point_index].pressure, gps->points[*index_from].pressure, ratio);
+ gps->points[next_point_index].pressure, gps->points[*index_from].pressure, vratio);
*strength = interpf(
- gps->points[next_point_index].strength, gps->points[*index_from].strength, ratio);
+ gps->points[next_point_index].strength, gps->points[*index_from].strength, vratio);
interp_v4_v4v4(vert_color,
gps->points[*index_from].vert_color,
gps->points[next_point_index].vert_color,
- ratio);
+ vratio);
return next_point_index == 0 ? gps->totpoints : next_point_index;
}
@@ -320,6 +324,7 @@ static int stroke_march_next_point_no_interp(const bGPDstroke *gps,
}
else {
next_point_index = gps->totpoints - 1;
+ remaining_till_next = 0;
break;
}
}