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
This commit is contained in:
Philipp Oeser 2020-05-14 13:59:19 +02:00
parent abcb23f5a3
commit e5ace51295

@ -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,