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:
authorCampbell Barton <ideasman42@gmail.com>2012-06-07 19:33:32 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-06-07 19:33:32 +0400
commit3916414709d1baace6bd9d1e802be2730048da66 (patch)
tree48a88ea0b17fd416c35a672d31d12ef0a7c448a5 /source/blender/editors/mask
parent742171f60943e78f148fe6be15e4eaaf0c5f85ec (diff)
adding mask points now adds in the correct place relative to shape keys (updating other keys for the new points still needs work though)
Diffstat (limited to 'source/blender/editors/mask')
-rw-r--r--source/blender/editors/mask/mask_add.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/source/blender/editors/mask/mask_add.c b/source/blender/editors/mask/mask_add.c
index 7ffff2b06e5..f81496c377a 100644
--- a/source/blender/editors/mask/mask_add.c
+++ b/source/blender/editors/mask/mask_add.c
@@ -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);