mask mode
authorCampbell Barton <ideasman42@gmail.com>
Wed, 6 Jun 2012 14:38:47 +0000 (14:38 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 6 Jun 2012 14:38:47 +0000 (14:38 +0000)
- only keyframe selected mask layers
- fix for crash in deleting animated mask layers (other than the first)

source/blender/editors/include/ED_mask.h
source/blender/editors/mask/mask_ops.c
source/blender/editors/mask/mask_shapekey.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/transform/transform_conversions.c

index 0c4c2f4788c526a03caac85f70e70181ca09e18c..0c2f68076323a38469a23a12a96d325459990295 100644 (file)
@@ -32,6 +32,7 @@
 #define __ED_MASK_H__
 
 struct wmKeyConfig;
+struct MaskLayer;
 
 /* mask_editor.c */
 void ED_operatortypes_mask(void);
@@ -42,6 +43,8 @@ void ED_operatormacros_mask(void);
 void ED_mask_draw(const bContext *C, const char draw_flag, const char draw_type);
 
 /* mask_shapekey.c */
+void ED_mask_layer_shape_auto_key(struct MaskLayer *masklay, const int frame);
 int ED_mask_layer_shape_auto_key_all(struct Mask *mask, const int frame);
+int ED_mask_layer_shape_auto_key_select(struct Mask *mask, const int frame);
 
 #endif /* ED_TEXT_H */
index c9f2450afc3f7cbbf7b6d0e9262c085ce7206f44..599f3371cac27c26db6d9e9a92390e2d00dacc29 100644 (file)
@@ -753,8 +753,11 @@ static int slide_point_modal(bContext *C, wmOperator *op, wmEvent *event)
 
                                free_slide_point_data(op->customdata);
 
-                               if (IS_AUTOKEY_ON(scene)) {
-                                       ED_mask_layer_shape_auto_key_all(data->mask, CFRA);
+                               /* dont key sliding feather uw's */
+                               if ((data->action == SLIDE_ACTION_FEATHER && data->uw) == FALSE) {
+                                       if (IS_AUTOKEY_ON(scene)) {
+                                               ED_mask_layer_shape_auto_key(data->masklay, CFRA);
+                                       }
                                }
 
                                WM_event_add_notifier(C, NC_MASK | NA_EDITED, data->mask);
@@ -880,10 +883,10 @@ static int delete_exec(bContext *C, wmOperator *UNUSED(op))
 {
        Mask *mask = CTX_data_edit_mask(C);
        MaskLayer *masklay;
-       int mask_layer_shape_ofs = 0;
 
        for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
                MaskSpline *spline;
+               int mask_layer_shape_ofs = 0;
 
                if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
                        continue;
index 38e8ed627f22fc7583f1973fab5be9ad9be54a34..8da083ab400b6c7c73e6e6adb88d71f754431eaf 100644 (file)
@@ -141,23 +141,6 @@ void MASK_OT_shape_key_clear(wmOperatorType *ot)
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
-int ED_mask_layer_shape_auto_key_all(Mask *mask, const int frame)
-{
-       MaskLayer *masklay;
-       int change = FALSE;
-
-       for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
-               MaskLayerShape *masklay_shape;
-
-               masklay_shape = BKE_mask_layer_shape_varify_frame(masklay, frame);
-               BKE_mask_layer_shape_from_mask(masklay, masklay_shape);
-               change = TRUE;
-       }
-
-       return change;
-}
-
-
 static int mask_shape_key_feather_reset_exec(bContext *C, wmOperator *UNUSED(op))
 {
        Scene *scene = CTX_data_scene(C);
@@ -249,3 +232,45 @@ void MASK_OT_shape_key_feather_reset(wmOperatorType *ot)
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
+
+
+/* *** Shape Key Utils *** */
+
+void ED_mask_layer_shape_auto_key(MaskLayer *masklay, const int frame)
+{
+       MaskLayerShape *masklay_shape;
+
+       masklay_shape = BKE_mask_layer_shape_varify_frame(masklay, frame);
+       BKE_mask_layer_shape_from_mask(masklay, masklay_shape);
+}
+
+int ED_mask_layer_shape_auto_key_all(Mask *mask, const int frame)
+{
+       MaskLayer *masklay;
+       int change = FALSE;
+
+       for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
+               ED_mask_layer_shape_auto_key(masklay, frame);
+               change = TRUE;
+       }
+
+       return change;
+}
+
+int ED_mask_layer_shape_auto_key_select(Mask *mask, const int frame)
+{
+       MaskLayer *masklay;
+       int change = FALSE;
+
+       for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
+
+               if (!ED_mask_layer_select_check(masklay)) {
+                       continue;
+               }
+
+               ED_mask_layer_shape_auto_key(masklay, frame);
+               change = TRUE;
+       }
+
+       return change;
+}
index 4b484b60ad3a2ae6074a0eccb40333837aecb283..c42264e4dac8e9e34309f2ac21838e4d29e6576b 100644 (file)
@@ -508,8 +508,7 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
                        }
 
                        /* set variable axis */
-                       vert[0][1] = vert[1][1] =
-                       vert[2][0] = vert[3][0] = line;
+                       vert[0][1] = vert[1][1] = vert[2][0] = vert[3][0] = line;
 
                        glDrawArrays(GL_LINES, 0, 4);
                }
@@ -1606,10 +1605,10 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d,
                                        y2 = vb.ymax;
                                }
                                else {
-                                        x1 = ar->winrct.xmin;
-                                        y1 = ar->winrct.ymin;
-                                        x2 = ar->winrct.xmax;
-                                        y2 = ar->winrct.ymax;
+                                       x1 = ar->winrct.xmin;
+                                       y1 = ar->winrct.ymin;
+                                       x2 = ar->winrct.xmax;
+                                       y2 = ar->winrct.ymax;
                                }
                        }
                        else {
index 4e78138dd1beb359b8f2bc350665cc09c7269af9..fbbb5bdfae8a128dd59ef6cb1357a4bb5d609be0 100644 (file)
@@ -4915,7 +4915,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
                        if (IS_AUTOKEY_ON(t->scene)) {
                                Scene *scene = t->scene;
 
-                               ED_mask_layer_shape_auto_key_all(mask, CFRA);
+                               ED_mask_layer_shape_auto_key_select(mask, CFRA);
                        }
                }
        }