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-22 15:53:49 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-06-22 15:53:49 +0400
commit238d3fa4bbd63e58538b67ff00fd655fbebc8b49 (patch)
tree7dfabc85e46778413b910700861b48b813ca1b9d /source/blender/blenkernel
parent226c86ae58cdf292fd415db05c05fba46375738d (diff)
mask re-key feature - mango request. ability to reset selected points shape key data.
useful if you add many keys to one part of a curve, then later want to key another part - but dont want to continuously make the same corrections.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_mask.h1
-rw-r--r--source/blender/blenkernel/intern/mask.c70
2 files changed, 38 insertions, 33 deletions
diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h
index ea50d0fac39..0682b16536c 100644
--- a/source/blender/blenkernel/BKE_mask.h
+++ b/source/blender/blenkernel/BKE_mask.h
@@ -122,6 +122,7 @@ void BKE_mask_update_display(struct Mask *mask, float ctime);
void BKE_mask_evaluate_all_masks(struct Main *bmain, float ctime, const int do_newframe);
void BKE_mask_evaluate(struct Mask *mask, const float ctime, const int do_newframe);
+void BKE_mask_layer_evaluate(struct MaskLayer *masklay, const float ctime, const int do_newframe);
void BKE_mask_update_scene(struct Main *bmain, struct Scene *scene, const int do_newframe);
void BKE_mask_parent_init(struct MaskParent *parent);
void BKE_mask_calc_handle_adjacent_interp(struct MaskSpline *spline, struct MaskSplinePoint *point, const float u);
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index 3dc584c374e..d85722931a7 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -1473,51 +1473,46 @@ void BKE_mask_spline_ensure_deform(MaskSpline *spline)
}
}
-void BKE_mask_evaluate(Mask *mask, const float ctime, const int do_newframe)
+void BKE_mask_layer_evaluate(MaskLayer *masklay, const float ctime, const int do_newframe)
{
- MaskLayer *masklay;
-
- for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
+ /* animation if available */
+ if (do_newframe) {
+ MaskLayerShape *masklay_shape_a;
+ MaskLayerShape *masklay_shape_b;
+ int found;
- /* animation if available */
- if (do_newframe) {
- MaskLayerShape *masklay_shape_a;
- MaskLayerShape *masklay_shape_b;
- int found;
-
- if ((found = BKE_mask_layer_shape_find_frame_range(masklay, ctime,
- &masklay_shape_a, &masklay_shape_b)))
- {
- if (found == 1) {
+ if ((found = BKE_mask_layer_shape_find_frame_range(masklay, ctime,
+ &masklay_shape_a, &masklay_shape_b)))
+ {
+ if (found == 1) {
#if 0
- printf("%s: exact %d %d (%d)\n", __func__, (int)ctime, BLI_countlist(&masklay->splines_shapes),
- masklay_shape_a->frame);
+ printf("%s: exact %d %d (%d)\n", __func__, (int)ctime, BLI_countlist(&masklay->splines_shapes),
+ masklay_shape_a->frame);
#endif
- BKE_mask_layer_shape_to_mask(masklay, masklay_shape_a);
- }
- else if (found == 2) {
- float w = masklay_shape_b->frame - masklay_shape_a->frame;
+ BKE_mask_layer_shape_to_mask(masklay, masklay_shape_a);
+ }
+ else if (found == 2) {
+ float w = masklay_shape_b->frame - masklay_shape_a->frame;
#if 0
- printf("%s: tween %d %d (%d %d)\n", __func__, (int)ctime, BLI_countlist(&masklay->splines_shapes),
- masklay_shape_a->frame, masklay_shape_b->frame);
+ printf("%s: tween %d %d (%d %d)\n", __func__, (int)ctime, BLI_countlist(&masklay->splines_shapes),
+ masklay_shape_a->frame, masklay_shape_b->frame);
#endif
- BKE_mask_layer_shape_to_mask_interp(masklay, masklay_shape_a, masklay_shape_b,
- (ctime - masklay_shape_a->frame) / w);
- }
- else {
- /* always fail, should never happen */
- BLI_assert(found == 2);
- }
+ BKE_mask_layer_shape_to_mask_interp(masklay, masklay_shape_a, masklay_shape_b,
+ (ctime - masklay_shape_a->frame) / w);
+ }
+ else {
+ /* always fail, should never happen */
+ BLI_assert(found == 2);
}
}
- /* animation done... */
}
+ /* animation done... */
- BKE_mask_calc_handles(mask);
-
+ BKE_mask_layer_calc_handles(masklay);
- for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
+ /* update deform */
+ {
MaskSpline *spline;
for (spline = masklay->splines.first; spline; spline = spline->next) {
@@ -1561,6 +1556,15 @@ void BKE_mask_evaluate(Mask *mask, const float ctime, const int do_newframe)
}
}
+void BKE_mask_evaluate(Mask *mask, const float ctime, const int do_newframe)
+{
+ MaskLayer *masklay;
+
+ for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
+ BKE_mask_layer_evaluate(masklay, ctime, do_newframe);
+ }
+}
+
/* the purpose of this function is to ensure spline->points_deform is never out of date.
* for now re-evaluate all. eventually this might work differently */
void BKE_mask_update_display(Mask *mask, float ctime)