adding mask points now adds in the correct place relative to shape keys (updating other keys for the new points still needs work though)

This commit is contained in:
Campbell Barton
2012-06-07 15:33:32 +00:00
parent 742171f609
commit 3916414709

View File

@@ -54,7 +54,8 @@
static int find_nearest_diff_point(bContext *C, Mask *mask, const float normal_co[2], int threshold, int feather,
MaskLayer **masklay_r, MaskSpline **spline_r, MaskSplinePoint **point_r,
float *u_r, float tangent[2])
float *u_r, float tangent[2],
const short use_deform)
{
MaskLayer *masklay, *point_masklay;
MaskSpline *point_spline;
@@ -80,9 +81,12 @@ static int find_nearest_diff_point(bContext *C, Mask *mask, const float normal_c
for (spline = masklay->splines.first; spline; spline = spline->next) {
int i;
MaskSplinePoint *cur_point;
for (i = 0; i < spline->tot_point; i++) {
MaskSplinePoint *cur_point = &spline->points[i];
for (i = 0, cur_point = use_deform ? spline->points_deform : spline->points;
i < spline->tot_point;
i++, cur_point++)
{
float *diff_points;
int tot_diff_point;
@@ -123,7 +127,7 @@ static int find_nearest_diff_point(bContext *C, Mask *mask, const float normal_c
point_masklay = masklay;
point_spline = spline;
point = cur_point;
point = use_deform ? &spline->points[(cur_point - spline->points_deform)] : cur_point;
dist = cur_dist;
u = (float)i / tot_point;
@@ -370,7 +374,7 @@ static int add_vertex_subdivide(bContext *C, Mask *mask, const float co[2])
float tangent[2];
float u;
if (find_nearest_diff_point(C, mask, co, threshold, FALSE, &masklay, &spline, &point, &u, tangent)) {
if (find_nearest_diff_point(C, mask, co, threshold, FALSE, &masklay, &spline, &point, &u, tangent, TRUE)) {
MaskSplinePoint *new_point;
int point_index = point - spline->points;
@@ -651,7 +655,7 @@ static int add_feather_vertex_exec(bContext *C, wmOperator *op)
if (point)
return OPERATOR_FINISHED;
if (find_nearest_diff_point(C, mask, co, threshold, TRUE, &masklay, &spline, &point, &u, NULL)) {
if (find_nearest_diff_point(C, mask, co, threshold, TRUE, &masklay, &spline, &point, &u, NULL, TRUE)) {
Scene *scene = CTX_data_scene(C);
float w = BKE_mask_point_weight(spline, point, u);
float weight_scalar = BKE_mask_point_weight_scalar(spline, point, u);