mango request

- highlight active mask layers.
- remove keyframes when all layer data is removed.
This commit is contained in:
2012-06-13 08:35:50 +00:00
parent 4cf66322f3
commit c83d37ccc0
3 changed files with 26 additions and 10 deletions

View File

@@ -48,6 +48,7 @@ struct MaskLayer *BKE_mask_layer_active(struct Mask *mask);
void BKE_mask_layer_active_set(struct Mask *mask, struct MaskLayer *masklay);
void BKE_mask_layer_remove(struct Mask *mask, struct MaskLayer *masklay);
void BKE_mask_layer_free_shapes(struct MaskLayer *masklay);
void BKE_mask_layer_free(struct MaskLayer *masklay);
void BKE_mask_spline_free(struct MaskSpline *spline);
struct MaskSpline *BKE_mask_spline_copy(struct MaskSpline *spline);

View File

@@ -1029,10 +1029,27 @@ void BKE_mask_layer_shape_free(MaskLayerShape *masklay_shape)
MEM_freeN(masklay_shape);
}
/** \brief Free all animation keys for a mask layer
*/
void BKE_mask_layer_free_shapes(MaskLayer *masklay)
{
MaskLayerShape *masklay_shape;
/* free animation data */
masklay_shape = masklay->splines_shapes.first;
while (masklay_shape) {
MaskLayerShape *next_masklay_shape = masklay_shape->next;
BLI_remlink(&masklay->splines_shapes, masklay_shape);
BKE_mask_layer_shape_free(masklay_shape);
masklay_shape = next_masklay_shape;
}
}
void BKE_mask_layer_free(MaskLayer *masklay)
{
MaskSpline *spline;
MaskLayerShape *masklay_shape;
/* free splines */
spline = masklay->splines.first;
@@ -1046,15 +1063,7 @@ void BKE_mask_layer_free(MaskLayer *masklay)
}
/* free animation data */
masklay_shape = masklay->splines_shapes.first;
while (masklay_shape) {
MaskLayerShape *next_masklay_shape = masklay_shape->next;
BLI_remlink(&masklay->splines_shapes, masklay_shape);
BKE_mask_layer_shape_free(masklay_shape);
masklay_shape = next_masklay_shape;
}
BKE_mask_layer_free_shapes(masklay);
MEM_freeN(masklay);
}

View File

@@ -957,6 +957,12 @@ static int delete_exec(bContext *C, wmOperator *UNUSED(op))
spline = next_spline;
}
/* not essential but confuses users when there are keys with no data!
* assume if they delete all data from the layer they also dont care about keys */
if (masklay->splines.first == NULL) {
BKE_mask_layer_free_shapes(masklay);
}
}
/* TODO: only update edited splines */