diff options
-rw-r--r-- | source/blender/editors/space_graph/graph_edit.c | 29 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_edit.c | 34 |
2 files changed, 33 insertions, 30 deletions
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 4ebb9ceddb3..5854cb53c99 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -2374,27 +2374,27 @@ static EnumPropertyItem *graph_fmodifier_itemf(bContext *C, PointerRNA *UNUSED(p EnumPropertyItem *item = NULL; int totitem = 0; int i = 0; - + if (C == NULL) { return rna_enum_fmodifier_type_items; } - + /* start from 1 to skip the 'Invalid' modifier type */ for (i = 1; i < FMODIFIER_NUM_TYPES; i++) { const FModifierTypeInfo *fmi = get_fmodifier_typeinfo(i); int index; - + /* check if modifier is valid for this context */ if (fmi == NULL) continue; - + index = RNA_enum_from_value(rna_enum_fmodifier_type_items, fmi->type); RNA_enum_item_add(&item, &totitem, &rna_enum_fmodifier_type_items[index]); } - + RNA_enum_item_end(&item, &totitem); *r_free = true; - + return item; } @@ -2435,16 +2435,15 @@ static int graph_fmodifier_add_exec(bContext *C, wmOperator *op) BKE_report(op->reports, RPT_ERROR, "Modifier could not be added (see console for details)"); break; } - + ale->update |= ANIM_UPDATE_DEPS; } - + ANIM_animdata_update(&ac, &anim_data); ANIM_animdata_freelist(&anim_data); /* set notifier that things have changed */ - // FIXME: this really isn't the best description for it... - WM_event_add_notifier(C, NC_ANIMATION, NULL); + WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); return OPERATOR_FINISHED; } @@ -2452,11 +2451,11 @@ static int graph_fmodifier_add_exec(bContext *C, wmOperator *op) void GRAPH_OT_fmodifier_add(wmOperatorType *ot) { PropertyRNA *prop; - + /* identifiers */ ot->name = "Add F-Curve Modifier"; ot->idname = "GRAPH_OT_fmodifier_add"; - ot->description = "Add F-Modifiers to the selected F-Curves"; + ot->description = "Add F-Modifier to the active/selected F-Curves"; /* api callbacks */ ot->invoke = WM_menu_invoke; @@ -2470,7 +2469,7 @@ void GRAPH_OT_fmodifier_add(wmOperatorType *ot) prop = RNA_def_enum(ot->srna, "type", rna_enum_fmodifier_type_items, 0, "Type", ""); RNA_def_enum_funcs(prop, graph_fmodifier_itemf); ot->prop = prop; - + RNA_def_boolean(ot->srna, "only_active", 1, "Only Active", "Only add F-Modifier to active F-Curve"); } @@ -2495,10 +2494,10 @@ static int graph_fmodifier_copy_exec(bContext *C, wmOperator *op) /* if this exists, call the copy F-Modifiers API function */ if (ale && ale->data) { FCurve *fcu = (FCurve *)ale->data; - + /* TODO: when 'active' vs 'all' boolean is added, change last param! */ ok = ANIM_fmodifiers_copy_to_buf(&fcu->modifiers, 0); - + /* free temp data now */ MEM_freeN(ale); } diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index fd772aa13b3..2892e8d030d 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -2213,19 +2213,20 @@ void NLA_OT_snap(wmOperatorType *ot) /* ******************** Add F-Modifier Operator *********************** */ -/* present a special customised popup menu for this, with some filtering */ -static int nla_fmodifier_add_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event)) +static EnumPropertyItem *nla_fmodifier_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { - uiPopupMenu *pup; - uiLayout *layout; - int i; + EnumPropertyItem *item = NULL; + int totitem = 0; + int i = 0; - pup = UI_popup_menu_begin(C, IFACE_("Add F-Modifier"), ICON_NONE); - layout = UI_popup_menu_layout(pup); + if (C == NULL) { + return rna_enum_fmodifier_type_items; + } /* start from 1 to skip the 'Invalid' modifier type */ for (i = 1; i < FMODIFIER_NUM_TYPES; i++) { const FModifierTypeInfo *fmi = get_fmodifier_typeinfo(i); + int index; /* check if modifier is valid for this context */ if (fmi == NULL) @@ -2233,16 +2234,17 @@ static int nla_fmodifier_add_invoke(bContext *C, wmOperator *UNUSED(op), const w if (i == FMODIFIER_TYPE_CYCLES) /* we already have repeat... */ continue; - /* add entry to add this type of modifier */ - uiItemEnumO(layout, "NLA_OT_fmodifier_add", fmi->name, 0, "type", i); + index = RNA_enum_from_value(rna_enum_fmodifier_type_items, fmi->type); + RNA_enum_item_add(&item, &totitem, &rna_enum_fmodifier_type_items[index]); } - uiItemS(layout); - UI_popup_menu_end(C, pup); + RNA_enum_item_end(&item, &totitem); + *r_free = true; - return OPERATOR_INTERFACE; + return item; } + static int nla_fmodifier_add_exec(bContext *C, wmOperator *op) { bAnimContext ac; @@ -2316,10 +2318,10 @@ void NLA_OT_fmodifier_add(wmOperatorType *ot) /* identifiers */ ot->name = "Add F-Modifier"; ot->idname = "NLA_OT_fmodifier_add"; - ot->description = "Add a F-Modifier of the specified type to the selected NLA-Strips"; + ot->description = "Add F-Modifier to the active/selected NLA-Strips"; /* api callbacks */ - ot->invoke = nla_fmodifier_add_invoke; + ot->invoke = WM_menu_invoke; ot->exec = nla_fmodifier_add_exec; ot->poll = nlaop_poll_tweakmode_off; @@ -2328,7 +2330,9 @@ void NLA_OT_fmodifier_add(wmOperatorType *ot) /* id-props */ ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_fmodifier_type_items, 0, "Type", ""); - RNA_def_boolean(ot->srna, "only_active", 0, "Only Active", "Only add a F-Modifier of the specified type to the active strip"); + RNA_def_enum_funcs(ot->prop, nla_fmodifier_itemf); + + RNA_def_boolean(ot->srna, "only_active", true, "Only Active", "Only add a F-Modifier of the specified type to the active strip"); } /* ******************** Copy F-Modifiers Operator *********************** */ |