From e5ace51295b90161c59220ace4347735d8fecef7 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Thu, 14 May 2020 13:59:19 +0200 Subject: Fix T76734: Changing Envelope FModifier controlpoints missing update Issue is that update functions defined in `rna_def_fmodifier_envelope_ctrl` (namely `rna_FModifier_update`) are actually never called. This is because UI code for FCurve modifiers often does not use RNA buttons but uses custom update functions (or non at all). For example, rB9a88bd55903a did this for the generators, envelope control points did not have this at all. This is now changed to use RNA buttons for the envelope control points, this could done for other non-RNA buttons as well to get rid of 'validate_fmodifier_cb()'. Maniphest Tasks: T76734 Differential Revision: https://developer.blender.org/D7732 --- source/blender/editors/animation/fmodifier_ui.c | 51 ++++++++++++++----------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index e795cb6e3ef..eadaa449b92 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -717,28 +717,31 @@ static void draw_modifier__envelope(uiLayout *layout, /* control points list */ for (i = 0, fed = env->data; i < env->totvert; i++, fed++) { + PointerRNA ctrl_ptr; + RNA_pointer_create(fcurve_owner_id, &RNA_FModifierEnvelopeControlPoint, fed, &ctrl_ptr); + /* get a new row to operate on */ row = uiLayoutRow(layout, true); block = uiLayoutGetBlock(row); UI_block_align_begin(block); - but = uiDefButF(block, - UI_BTYPE_NUM, - B_FMODIFIER_REDRAW, - IFACE_("Fra:"), - 0, - 0, - 4.5 * UI_UNIT_X, - UI_UNIT_Y, - &fed->time, - -MAXFRAMEF, - MAXFRAMEF, - 10, - 1, - TIP_("Frame that envelope point occurs")); - UI_but_func_set(but, validate_fmodifier_cb, fcm, NULL); - - uiDefButF(block, + uiDefButR(block, + UI_BTYPE_NUM, + B_FMODIFIER_REDRAW, + IFACE_("Fra:"), + 0, + 0, + 4.5 * UI_UNIT_X, + UI_UNIT_Y, + &ctrl_ptr, + "frame", + -1, + -MAXFRAMEF, + MAXFRAMEF, + 10, + 1, + NULL); + uiDefButR(block, UI_BTYPE_NUM, B_FMODIFIER_REDRAW, IFACE_("Min:"), @@ -746,13 +749,15 @@ static void draw_modifier__envelope(uiLayout *layout, 0, 5 * UI_UNIT_X, UI_UNIT_Y, - &fed->min, + &ctrl_ptr, + "min", + -1, -UI_FLT_MAX, UI_FLT_MAX, 10, 2, - TIP_("Minimum bound of envelope at this point")); - uiDefButF(block, + NULL); + uiDefButR(block, UI_BTYPE_NUM, B_FMODIFIER_REDRAW, IFACE_("Max:"), @@ -760,12 +765,14 @@ static void draw_modifier__envelope(uiLayout *layout, 0, 5 * UI_UNIT_X, UI_UNIT_Y, - &fed->max, + &ctrl_ptr, + "max", + -1, -UI_FLT_MAX, UI_FLT_MAX, 10, 2, - TIP_("Maximum bound of envelope at this point")); + NULL); but = uiDefIconBut(block, UI_BTYPE_BUT, -- cgit v1.2.3