diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-01-10 17:56:02 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-01-10 18:05:16 +0300 |
commit | 92a081ff83ba551dd061f233af6239e1dbfb1241 (patch) | |
tree | c72f4edb3aa6aac88d63fdeee5aaf0584bd3f67c /source/blender/editors | |
parent | fc24d1a9744773ee03d1197a702696ba24527d20 (diff) |
Fix T60340: Removing f-curve modifier doesn't update animation
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/animation/fmodifier_ui.c | 21 | ||||
-rw-r--r-- | source/blender/editors/include/ED_anim_api.h | 3 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_buttons.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_buttons.c | 2 |
4 files changed, 21 insertions, 7 deletions
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index 3136b3e7137..5d0a2fa4d86 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -50,6 +50,7 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" +#include "BKE_animsys.h" #include "BKE_context.h" #include "BKE_fcurve.h" @@ -64,6 +65,8 @@ #include "ED_anim_api.h" #include "ED_undo.h" +#include "DEG_depsgraph.h" + /* ********************************************** */ /* UI STUFF */ @@ -86,9 +89,14 @@ static void validate_fmodifier_cb(bContext *UNUSED(C), void *fcm_v, void *UNUSED } /* callback to remove the given modifier */ -static void delete_fmodifier_cb(bContext *C, void *fmods_v, void *fcm_v) +typedef struct FModifierDeleteContext { + ID *fcurve_owner_id; + ListBase *modifiers; +} FModifierDeleteContext; +static void delete_fmodifier_cb(bContext *C, void *ctx_v, void *fcm_v) { - ListBase *modifiers = (ListBase *)fmods_v; + FModifierDeleteContext *ctx = (FModifierDeleteContext *)ctx_v; + ListBase *modifiers = ctx->modifiers; FModifier *fcm = (FModifier *)fcm_v; /* remove the given F-Modifier from the active modifier-stack */ @@ -99,6 +107,7 @@ static void delete_fmodifier_cb(bContext *C, void *fmods_v, void *fcm_v) /* send notifiers */ // XXX for now, this is the only way to get updates in all the right places... but would be nice to have a special one in this case WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); + DEG_id_tag_update(ctx->fcurve_owner_id, ID_RECALC_COPY_ON_WRITE); } /* --------------- */ @@ -553,7 +562,8 @@ static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, sho /* --------------- */ -void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *id, ListBase *modifiers, FModifier *fcm) +void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *id, ID *fcurve_owner_id, + ListBase *modifiers, FModifier *fcm) { const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm); uiLayout *box, *row, *sub, *col; @@ -604,7 +614,10 @@ void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *id, ListBase *modifier /* delete button */ but = uiDefIconBut(block, UI_BTYPE_BUT, B_REDR, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete F-Curve Modifier")); - UI_but_func_set(but, delete_fmodifier_cb, modifiers, fcm); + FModifierDeleteContext *ctx = MEM_mallocN(sizeof(FModifierDeleteContext), "fmodifier ctx"); + ctx->fcurve_owner_id = fcurve_owner_id; + ctx->modifiers = modifiers; + UI_but_funcN_set(but, delete_fmodifier_cb, ctx, fcm); UI_block_emboss_set(block, UI_EMBOSS); } diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 4bb9960ba21..f2cf5a3ead9 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -584,7 +584,8 @@ void ANIM_draw_framerange(struct Scene *scene, struct View2D *v2d); /* ------------- UI Panel Drawing -------------- */ /* draw a given F-Modifier for some layout/UI-Block */ -void ANIM_uiTemplate_fmodifier_draw(struct uiLayout *layout, struct ID *id, ListBase *modifiers, struct FModifier *fcm); +void ANIM_uiTemplate_fmodifier_draw(struct uiLayout *layout, struct ID *id, struct ID *fcurve_owner_id, + ListBase *modifiers, struct FModifier *fcm); /* ------------- Copy/Paste Buffer -------------- */ diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index c3d6c1f6435..ef0e4f7d6f3 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -1142,7 +1142,7 @@ static void graph_panel_modifiers(const bContext *C, Panel *pa) col = uiLayoutColumn(pa->layout, true); uiLayoutSetActive(col, active); - ANIM_uiTemplate_fmodifier_draw(col, ale->id, &fcu->modifiers, fcm); + ANIM_uiTemplate_fmodifier_draw(col, ale->id, ale->fcurve_owner_id, &fcu->modifiers, fcm); } MEM_freeN(ale); diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index d5d50c86851..76d2c2851c1 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -495,7 +495,7 @@ static void nla_panel_modifiers(const bContext *C, Panel *pa) for (fcm = strip->modifiers.first; fcm; fcm = fcm->next) { col = uiLayoutColumn(pa->layout, true); - ANIM_uiTemplate_fmodifier_draw(col, strip_ptr.id.data, &strip->modifiers, fcm); + ANIM_uiTemplate_fmodifier_draw(col, strip_ptr.id.data, strip_ptr.id.data, &strip->modifiers, fcm); } } |