Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/animation/fmodifier_ui.c
| Context not available. | |||||
| #define B_REDR 1 | #define B_REDR 1 | ||||
| #define B_FMODIFIER_REDRAW 20 | #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 */ | /* 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; | FModifier *fcm = (FModifier *)fcm_v; | ||||
| const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm); | const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm); | ||||
| Context not available. | |||||
| if (fmi && fmi->verify_data) { | if (fmi && fmi->verify_data) { | ||||
| fmi->verify_data(fcm); | fmi->verify_data(fcm); | ||||
| } | } | ||||
| if (owner_id) { | |||||
| deg_update(C, owner_id, NULL); | |||||
| } | |||||
| } | } | ||||
| /* callback to remove the given modifier */ | /* callback to remove the given modifier */ | ||||
| Context not available. | |||||
| ED_undo_push(C, "Delete F-Curve Modifier"); | ED_undo_push(C, "Delete F-Curve Modifier"); | ||||
| /* send notifiers */ | deg_update(C, ctx->fcurve_owner_id, NULL); | ||||
| /* 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); | |||||
| } | } | ||||
| /* --------------- */ | /* --------------- */ | ||||
| /* draw settings for generator modifier */ | /* draw settings for generator modifier */ | ||||
| Context not available. | |||||
| /* draw polynomial order selector */ | /* draw polynomial order selector */ | ||||
| row = uiLayoutRow(layout, false); | row = uiLayoutRow(layout, false); | ||||
| block = uiLayoutGetBlock(row); | block = uiLayoutGetBlock(row); | ||||
| but = uiDefButI( | but = uiDefButI( | ||||
| block, | block, | ||||
| UI_BTYPE_NUM, | UI_BTYPE_NUM, | ||||
| Context not available. | |||||
| 0, | 0, | ||||
| 0, | 0, | ||||
| TIP_("'Order' of the Polynomial (for a polynomial with n terms, 'order' is n-1)")); | 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 */ | /* calculate maximum width of label for "x^n" labels */ | ||||
| if (data->arraysize > 2) { | if (data->arraysize > 2) { | ||||
| Context not available. | |||||
| row = uiLayoutRow(layout, true); | row = uiLayoutRow(layout, true); | ||||
| block = uiLayoutGetBlock(row); | block = uiLayoutGetBlock(row); | ||||
| /* Update depsgraph when values change */ | |||||
| UI_block_func_set(block, deg_update, fcurve_owner_id, NULL); | |||||
| cp = data->coefficients; | cp = data->coefficients; | ||||
| for (i = 0; (i < data->arraysize) && (cp); i++, cp++) { | for (i = 0; (i < data->arraysize) && (cp); i++, cp++) { | ||||
| /* To align with first line... */ | /* To align with first line... */ | ||||
| Context not available. | |||||
| /* draw polynomial order selector */ | /* draw polynomial order selector */ | ||||
| row = uiLayoutRow(layout, false); | row = uiLayoutRow(layout, false); | ||||
| block = uiLayoutGetBlock(row); | block = uiLayoutGetBlock(row); | ||||
| but = uiDefButI( | but = uiDefButI( | ||||
| block, | block, | ||||
| UI_BTYPE_NUM, | UI_BTYPE_NUM, | ||||
| Context not available. | |||||
| 0, | 0, | ||||
| 0, | 0, | ||||
| TIP_("'Order' of the Polynomial (for a polynomial with n terms, 'order' is n-1)")); | 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 */ | /* draw controls for each pair of coefficients */ | ||||
| row = uiLayoutRow(layout, true); | row = uiLayoutRow(layout, true); | ||||
| block = uiLayoutGetBlock(row); | block = uiLayoutGetBlock(row); | ||||
| /* Update depsgraph when values change */ | |||||
| UI_block_func_set(block, deg_update, fcurve_owner_id, NULL); | |||||
| cp = data->coefficients; | cp = data->coefficients; | ||||
| for (i = 0; (i < data->poly_order) && (cp); i++, cp += 2) { | for (i = 0; (i < data->poly_order) && (cp); i++, cp += 2) { | ||||
| /* To align with first line */ | /* To align with first line */ | ||||
| Context not available. | |||||