Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Parborg <darkdefende@gmail.com>2019-06-20 18:46:57 +0300
committerSebastian Parborg <darkdefende@gmail.com>2019-06-20 18:48:36 +0300
commit9a88bd55903a5c7df0365007bef8dd182f6eb481 (patch)
tree7e915634bac4613ea942c2563dcea511e60ed5b3 /source/blender
parent2f77175fecc7fa444d351d47000209e248611ee6 (diff)
Fix T65802: F-curves modifiers in nodes doesn't updates properly
The other built in modifiers, except the generator modifier, seems to update the depsgraph thought some RNA magic. However the generator seem to be a bit special and doesn't get included into this. Now we manually update the depsgraph on value changes to the generator modifier.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/animation/fmodifier_ui.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c
index f4e1268ab77..b42e8102c5b 100644
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@ -70,8 +70,18 @@
#define B_REDR 1
#define B_FMODIFIER_REDRAW 20
+/* callback to update depsgraph on value changes */
+static void deg_update(bContext *C, void *owner_id, void *UNUSED(var2))
+{
+ /* 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(owner_id, ID_RECALC_ANIMATION);
+}
+
/* callback to verify modifier data */
-static void validate_fmodifier_cb(bContext *UNUSED(C), void *fcm_v, void *UNUSED(arg))
+static void validate_fmodifier_cb(bContext *C, void *fcm_v, void *owner_id)
{
FModifier *fcm = (FModifier *)fcm_v;
const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm);
@@ -80,6 +90,9 @@ static void validate_fmodifier_cb(bContext *UNUSED(C), void *fcm_v, void *UNUSED
if (fmi && fmi->verify_data) {
fmi->verify_data(fcm);
}
+ if (owner_id) {
+ deg_update(C, owner_id, NULL);
+ }
}
/* callback to remove the given modifier */
@@ -98,13 +111,8 @@ static void delete_fmodifier_cb(bContext *C, void *ctx_v, void *fcm_v)
ED_undo_push(C, "Delete F-Curve Modifier");
- /* 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_ANIMATION);
+ deg_update(C, ctx->fcurve_owner_id, NULL);
}
-
/* --------------- */
/* draw settings for generator modifier */
@@ -176,6 +184,7 @@ static void draw_modifier__generator(uiLayout *layout,
/* draw polynomial order selector */
row = uiLayoutRow(layout, false);
block = uiLayoutGetBlock(row);
+
but = uiDefButI(
block,
UI_BTYPE_NUM,
@@ -191,7 +200,7 @@ static void draw_modifier__generator(uiLayout *layout,
0,
0,
TIP_("'Order' of the Polynomial (for a polynomial with n terms, 'order' is n-1)"));
- UI_but_func_set(but, validate_fmodifier_cb, fcm, NULL);
+ UI_but_func_set(but, validate_fmodifier_cb, fcm, fcurve_owner_id);
/* calculate maximum width of label for "x^n" labels */
if (data->arraysize > 2) {
@@ -208,6 +217,9 @@ static void draw_modifier__generator(uiLayout *layout,
row = uiLayoutRow(layout, true);
block = uiLayoutGetBlock(row);
+ /* Update depsgraph when values change */
+ UI_block_func_set(block, deg_update, fcurve_owner_id, NULL);
+
cp = data->coefficients;
for (i = 0; (i < data->arraysize) && (cp); i++, cp++) {
/* To align with first line... */
@@ -310,6 +322,7 @@ static void draw_modifier__generator(uiLayout *layout,
/* draw polynomial order selector */
row = uiLayoutRow(layout, false);
block = uiLayoutGetBlock(row);
+
but = uiDefButI(
block,
UI_BTYPE_NUM,
@@ -325,12 +338,15 @@ static void draw_modifier__generator(uiLayout *layout,
0,
0,
TIP_("'Order' of the Polynomial (for a polynomial with n terms, 'order' is n-1)"));
- UI_but_func_set(but, validate_fmodifier_cb, fcm, NULL);
+ UI_but_func_set(but, validate_fmodifier_cb, fcm, fcurve_owner_id);
/* draw controls for each pair of coefficients */
row = uiLayoutRow(layout, true);
block = uiLayoutGetBlock(row);
+ /* Update depsgraph when values change */
+ UI_block_func_set(block, deg_update, fcurve_owner_id, NULL);
+
cp = data->coefficients;
for (i = 0; (i < data->poly_order) && (cp); i++, cp += 2) {
/* To align with first line */