mask mode

- only keyframe selected mask layers
- fix for crash in deleting animated mask layers (other than the first)
This commit is contained in:
Campbell Barton
2012-06-06 14:38:47 +00:00
parent 0499200e39
commit 2cb671591b
5 changed files with 57 additions and 27 deletions

View 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 */

View 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;

View 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;
}

View 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 {

View 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);
}
}
}