Changes to mask evaluation
- BKE_mask_update_scene was only used with do_newframe=FALSE, removed this argument. - Made it so BKE_mask_update_scene is able to handle LIB_ID_RECALC_DATA case. Namely, if mask ID is tagged for data update it means shapekeys will be re-evaluated (as if do_newframe=true). If mask id only tagged for LIB_ID_RECALC, then no shapekey evaluation happens (same as it used to behave before). This means, doing DAG_id_tag_update(&mask->id, OB_RECALC_DATA) will lead to shapekeys re-evaluation which is really needed in such operators as clearing shapekeys (and cleaning shapekeys which is in tomato branch yet). This is a bit silly to use OB_RECALC_DATA sine mask is not an OB, but could not see better way to do it now. This fixes missing mask re-evaluation after clearing shapekey, would expect no other functional changes.
This commit is contained in:
@@ -120,7 +120,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_update_scene(struct Main *bmain, struct Scene *scene);
|
||||
void BKE_mask_parent_init(struct MaskParent *parent);
|
||||
void BKE_mask_calc_handle_adjacent_interp(struct MaskSpline *spline, struct MaskSplinePoint *point, const float u);
|
||||
void BKE_mask_calc_tangent_polyline(struct MaskSpline *spline, struct MaskSplinePoint *point, float t[2]);
|
||||
|
||||
@@ -1525,13 +1525,14 @@ void BKE_mask_evaluate_all_masks(Main *bmain, float ctime, const int do_newframe
|
||||
}
|
||||
}
|
||||
|
||||
void BKE_mask_update_scene(Main *bmain, Scene *scene, const int do_newframe)
|
||||
void BKE_mask_update_scene(Main *bmain, Scene *scene)
|
||||
{
|
||||
Mask *mask;
|
||||
|
||||
for (mask = bmain->mask.first; mask; mask = mask->id.next) {
|
||||
if (mask->id.flag & LIB_ID_RECALC) {
|
||||
BKE_mask_evaluate_all_masks(bmain, CFRA, do_newframe);
|
||||
if (mask->id.flag & (LIB_ID_RECALC | LIB_ID_RECALC_DATA)) {
|
||||
bool do_new_frame = (mask->id.flag & LIB_ID_RECALC_DATA) != 0;
|
||||
BKE_mask_evaluate_all_masks(bmain, CFRA, do_new_frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1181,7 +1181,7 @@ static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scen
|
||||
sound_update_scene(scene);
|
||||
|
||||
/* update masking curves */
|
||||
BKE_mask_update_scene(bmain, scene, FALSE);
|
||||
BKE_mask_update_scene(bmain, scene);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ static int mask_shape_key_clear_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
|
||||
if (change) {
|
||||
WM_event_add_notifier(C, NC_MASK | ND_DATA, mask);
|
||||
DAG_id_tag_update(&mask->id, 0);
|
||||
DAG_id_tag_update(&mask->id, OB_RECALC_DATA);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user