2.5 - Action Editor:
* Added set-extrapolation operator. For now, this uses the Shift-E hotkey. * Removed some unused code from keyframes_edit.c
This commit is contained in:
@@ -50,7 +50,7 @@
|
||||
#include "ED_keyframes_edit.h"
|
||||
#include "ED_markers.h"
|
||||
|
||||
/* This file defines an API and set of callback-operators for editing keyframe data.
|
||||
/* This file defines an API and set of callback-operators for non-destructive editing of keyframe data.
|
||||
*
|
||||
* Two API functions are defined for actually performing the operations on the data:
|
||||
* ipo_keys_bezier_loop() and icu_keys_bezier_loop()
|
||||
@@ -71,9 +71,6 @@
|
||||
/* ************************************************************************** */
|
||||
/* IPO Editing Loops - Exposed API */
|
||||
|
||||
// FIXME: it would be useful to be able to supply custom properties to the bezt function...
|
||||
// workaround for those callbacks that need this now, is to set globals...
|
||||
|
||||
/* --------------------------- Base Functions ------------------------------------ */
|
||||
|
||||
/* This function is used to loop over BezTriples in the given IpoCurve, applying a given
|
||||
@@ -524,28 +521,8 @@ BeztEditFunc ANIM_editkeyframes_ipo(short code)
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
void setipotype_ipo(Ipo *ipo, int code)
|
||||
{
|
||||
/* Sets the type of the selected bezts in each ipo curve in the
|
||||
* Ipo to a value based on the code
|
||||
*/
|
||||
switch (code) {
|
||||
case 1:
|
||||
ipo_keys_bezier_loop(ipo, set_bezt_constant, set_ipocurve_mixed);
|
||||
break;
|
||||
case 2:
|
||||
ipo_keys_bezier_loop(ipo, set_bezt_linear, set_ipocurve_mixed);
|
||||
break;
|
||||
case 3:
|
||||
ipo_keys_bezier_loop(ipo, set_bezt_bezier, set_ipocurve_mixed);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// XXX will we keep this?
|
||||
void setexprap_ipoloop(Ipo *ipo, int code)
|
||||
void setexprap_ipoloop(Ipo *ipo, short code)
|
||||
{
|
||||
IpoCurve *icu;
|
||||
|
||||
|
@@ -130,11 +130,13 @@ void ANIM_editkeyframes_ipocurve_ipotype(struct IpoCurve *icu);
|
||||
|
||||
/* ************************************************ */
|
||||
|
||||
// XXX all of these funcs will be depreceated!
|
||||
// XXX all of these funcs should be depreceated or at least renamed!
|
||||
|
||||
short is_ipo_key_selected(struct Ipo *ipo);
|
||||
void set_ipo_key_selection(struct Ipo *ipo, short sel);
|
||||
|
||||
void setexprap_ipoloop(struct Ipo *ipo, short code);
|
||||
|
||||
|
||||
/* ************************************************ */
|
||||
|
||||
|
@@ -88,9 +88,98 @@
|
||||
/* ************************************************************************** */
|
||||
/* GENERAL STUFF */
|
||||
|
||||
// TODO:
|
||||
// - clean
|
||||
// - sample
|
||||
// - delete
|
||||
// - insert key
|
||||
// - copy/paste
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* SETTINGS STUFF */
|
||||
|
||||
// TODO:
|
||||
// - wkey stuff
|
||||
|
||||
/* ******************** Set Extrapolation-Type Operator *********************** */
|
||||
|
||||
/* defines for set ipo-type for selected keyframes tool */
|
||||
EnumPropertyItem prop_actkeys_expo_types[] = {
|
||||
{IPO_HORIZ, "CONSTANT", "Constant", ""},
|
||||
{IPO_DIR, "DIRECTIONAL", "Extrapolation", ""},
|
||||
{IPO_CYCL, "CYCLIC", "Cyclic", ""},
|
||||
{IPO_CYCLX, "CYCLIC_EXTRAPOLATION", "Cyclic Extrapolation", ""},
|
||||
{0, NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
/* this function is responsible for setting extrapolation mode for keyframes */
|
||||
static void setexpo_action_keys(bAnimContext *ac, short mode)
|
||||
{
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
bAnimListElem *ale;
|
||||
int filter;
|
||||
|
||||
/* filter data */
|
||||
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_IPOKEYS);
|
||||
ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
|
||||
|
||||
/* loop through setting mode per ipo-curve */
|
||||
for (ale= anim_data.first; ale; ale= ale->next)
|
||||
setexprap_ipoloop(ale->key_data, mode);
|
||||
|
||||
/* cleanup */
|
||||
BLI_freelistN(&anim_data);
|
||||
}
|
||||
|
||||
/* ------------------- */
|
||||
|
||||
static int actkeys_expo_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
bAnimContext ac;
|
||||
short mode;
|
||||
|
||||
/* get editor data */
|
||||
if (ANIM_animdata_get_context(C, &ac) == 0)
|
||||
return OPERATOR_CANCELLED;
|
||||
if (ac.datatype == ANIMCONT_GPENCIL)
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
|
||||
/* get handle setting mode */
|
||||
mode= RNA_enum_get(op->ptr, "type");
|
||||
|
||||
/* set handle type */
|
||||
setexpo_action_keys(&ac, mode);
|
||||
|
||||
/* validate keyframes after editing */
|
||||
ANIM_editkeyframes_refresh(&ac);
|
||||
|
||||
/* set notifier tha things have changed */
|
||||
ED_area_tag_redraw(CTX_wm_area(C)); // FIXME... should be updating 'keyframes' data context or so instead!
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void ACT_OT_keyframes_expotype (wmOperatorType *ot)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
/* identifiers */
|
||||
ot->name= "Set Keyframe Extrapolation";
|
||||
ot->idname= "ACT_OT_keyframes_expotype";
|
||||
|
||||
/* api callbacks */
|
||||
ot->invoke= WM_menu_invoke;
|
||||
ot->exec= actkeys_expo_exec;
|
||||
ot->poll= ED_operator_areaactive;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
|
||||
|
||||
/* id-props */
|
||||
prop= RNA_def_property(ot->srna, "type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, prop_actkeys_expo_types);
|
||||
}
|
||||
|
||||
/* ******************** Set Interpolation-Type Operator *********************** */
|
||||
|
||||
/* defines for set ipo-type for selected keyframes tool */
|
||||
@@ -113,7 +202,7 @@ static void setipo_action_keys(bAnimContext *ac, short mode)
|
||||
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_IPOKEYS);
|
||||
ANIM_animdata_filter(&anim_data, filter, ac->data, ac->datatype);
|
||||
|
||||
/* loop through setting flags for handles
|
||||
/* loop through setting BezTriple interpolation
|
||||
* Note: we do not supply BeztEditData to the looper yet. Currently that's not necessary here...
|
||||
*/
|
||||
for (ale= anim_data.first; ale; ale= ale->next)
|
||||
|
@@ -75,6 +75,7 @@ enum {
|
||||
|
||||
void ACT_OT_keyframes_handletype(struct wmOperatorType *ot);
|
||||
void ACT_OT_keyframes_ipotype(struct wmOperatorType *ot);
|
||||
void ACT_OT_keyframes_expotype(struct wmOperatorType *ot);
|
||||
|
||||
void ACT_OT_keyframes_cfrasnap(struct wmOperatorType *ot);
|
||||
void ACT_OT_keyframes_snap(struct wmOperatorType *ot);
|
||||
|
@@ -74,6 +74,7 @@ void action_operatortypes(void)
|
||||
WM_operatortype_append(ACT_OT_keyframes_cfrasnap);
|
||||
WM_operatortype_append(ACT_OT_keyframes_handletype);
|
||||
WM_operatortype_append(ACT_OT_keyframes_ipotype);
|
||||
WM_operatortype_append(ACT_OT_keyframes_expotype);
|
||||
}
|
||||
|
||||
/* ************************** registration - keymaps **********************************/
|
||||
@@ -112,6 +113,7 @@ static void action_keymap_keyframes (ListBase *keymap)
|
||||
/* menu + set setting */
|
||||
WM_keymap_add_item(keymap, "ACT_OT_keyframes_handletype", HKEY, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_item(keymap, "ACT_OT_keyframes_ipotype", TKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
WM_keymap_add_item(keymap, "ACT_OT_keyframes_expotype", EKEY, KM_PRESS, KM_SHIFT, 0); // temp...
|
||||
}
|
||||
|
||||
/* --------------- */
|
||||
|
Reference in New Issue
Block a user