Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2009-09-04 06:44:56 +0400
committerJoshua Leung <aligorith@gmail.com>2009-09-04 06:44:56 +0400
commitfa01703ac3caf08c42509e17be94559efd69bd2b (patch)
tree4223b41fcb09043543ffcdae93baf8330d4eea4d /source/blender/editors/space_action
parent640e39206b25bcd433223d85298961a860fc5cd7 (diff)
2.5 - Keyframe Types for DopeSheet
It is now possible to tag certain keyframes as being 'breakdowns' in the DopeSheet. Breakdown keyframes are drawn as slightly smaller blue diamonds. Simply select the relevant keyframes and use the RKEY hotkey (or from the menus, Key->Keyframe Type) to choose between tagging the keyframe as a 'proper' keyframe and a 'breakdown' keyframe. Notes: * Please note that this feature does not currently imply anything about breakdowns moving around keyframes or behaving any differently from any other type of keyframe * In future, if there is any such need, more keyframe types could be added, though this is not really likely at all
Diffstat (limited to 'source/blender/editors/space_action')
-rw-r--r--source/blender/editors/space_action/action_edit.c71
-rw-r--r--source/blender/editors/space_action/action_header.c18
-rw-r--r--source/blender/editors/space_action/action_intern.h1
-rw-r--r--source/blender/editors/space_action/action_ops.c2
4 files changed, 87 insertions, 5 deletions
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index d4709e94e5e..b087736a368 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -1038,6 +1038,77 @@ void ACT_OT_handle_type (wmOperatorType *ot)
RNA_def_enum(ot->srna, "type", beztriple_handle_type_items, 0, "Type", "");
}
+/* ******************** Set Keyframe-Type Operator *********************** */
+
+/* this function is responsible for setting interpolation mode for keyframes */
+static void setkeytype_action_keys(bAnimContext *ac, short mode)
+{
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ int filter;
+ BeztEditFunc set_cb= ANIM_editkeyframes_keytype(mode);
+
+ /* filter data */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+
+ /* 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)
+ ANIM_fcurve_keys_bezier_loop(NULL, ale->key_data, NULL, set_cb, NULL);
+
+ /* cleanup */
+ BLI_freelistN(&anim_data);
+}
+
+/* ------------------- */
+
+static int actkeys_keytype_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 */
+ setkeytype_action_keys(&ac, mode);
+
+ /* validate keyframes after editing */
+ ANIM_editkeyframes_refresh(&ac);
+
+ /* set notifier that keyframe properties have changed */
+ WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
+
+ return OPERATOR_FINISHED;
+}
+
+void ACT_OT_keyframe_type (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Set Keyframe Type";
+ ot->idname= "ACT_OT_keyframe_type";
+ ot->description= "Set type of keyframe for the seleced keyframes.";
+
+ /* api callbacks */
+ ot->invoke= WM_menu_invoke;
+ ot->exec= actkeys_keytype_exec;
+ ot->poll= ED_operator_action_active;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ /* id-props */
+ RNA_def_enum(ot->srna, "type", beztriple_keyframe_type_items, 0, "Type", "");
+}
+
/* ************************************************************************** */
/* TRANSFORM STUFF */
diff --git a/source/blender/editors/space_action/action_header.c b/source/blender/editors/space_action/action_header.c
index e2a725164c9..f18d31915f9 100644
--- a/source/blender/editors/space_action/action_header.c
+++ b/source/blender/editors/space_action/action_header.c
@@ -168,7 +168,7 @@ static void act_edit_transformmenu(bContext *C, uiLayout *layout, void *arg_unus
static void act_edit_snapmenu(bContext *C, uiLayout *layout, void *arg_unused)
{
- uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); // xxx?
+ uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
uiItemEnumO(layout, NULL, 0, "ACT_OT_snap", "type", ACTKEYS_SNAP_CFRA);
uiItemEnumO(layout, NULL, 0, "ACT_OT_snap", "type", ACTKEYS_SNAP_NEAREST_FRAME);
uiItemEnumO(layout, NULL, 0, "ACT_OT_snap", "type", ACTKEYS_SNAP_NEAREST_SECOND);
@@ -177,16 +177,23 @@ static void act_edit_snapmenu(bContext *C, uiLayout *layout, void *arg_unused)
static void act_edit_mirrormenu(bContext *C, uiLayout *layout, void *arg_unused)
{
- uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); // xxx?
+ uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
uiItemEnumO(layout, NULL, 0, "ACT_OT_mirror", "type", ACTKEYS_MIRROR_CFRA);
uiItemEnumO(layout, NULL, 0, "ACT_OT_mirror", "type", ACTKEYS_MIRROR_YAXIS);
uiItemEnumO(layout, NULL, 0, "ACT_OT_mirror", "type", ACTKEYS_MIRROR_XAXIS);
uiItemEnumO(layout, NULL, 0, "ACT_OT_mirror", "type", ACTKEYS_MIRROR_MARKER);
}
+static void act_edit_keytypesmenu(bContext *C, uiLayout *layout, void *arg_unused)
+{
+ uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
+ uiItemEnumO(layout, NULL, 0, "ACT_OT_keyframe_type", "type", BEZT_KEYTYPE_KEYFRAME);
+ uiItemEnumO(layout, NULL, 0, "ACT_OT_keyframe_type", "type", BEZT_KEYTYPE_BREAKDOWN);
+}
+
static void act_edit_handlesmenu(bContext *C, uiLayout *layout, void *arg_unused)
{
- uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); // xxx?
+ uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
uiItemEnumO(layout, NULL, 0, "ACT_OT_handle_type", "type", HD_FREE);
uiItemEnumO(layout, NULL, 0, "ACT_OT_handle_type", "type", HD_AUTO);
uiItemEnumO(layout, NULL, 0, "ACT_OT_handle_type", "type", HD_VECT);
@@ -196,7 +203,7 @@ static void act_edit_handlesmenu(bContext *C, uiLayout *layout, void *arg_unused
static void act_edit_ipomenu(bContext *C, uiLayout *layout, void *arg_unused)
{
- uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); // xxx?
+ uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
uiItemEnumO(layout, NULL, 0, "ACT_OT_interpolation_type", "type", BEZT_IPO_CONST);
uiItemEnumO(layout, NULL, 0, "ACT_OT_interpolation_type", "type", BEZT_IPO_LIN);
uiItemEnumO(layout, NULL, 0, "ACT_OT_interpolation_type", "type", BEZT_IPO_BEZ);
@@ -204,7 +211,7 @@ static void act_edit_ipomenu(bContext *C, uiLayout *layout, void *arg_unused)
static void act_edit_expomenu(bContext *C, uiLayout *layout, void *arg_unused)
{
- uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); // xxx?
+ uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
uiItemEnumO(layout, NULL, 0, "ACT_OT_extrapolation_type", "type", FCURVE_EXTRAPOLATE_CONSTANT);
uiItemEnumO(layout, NULL, 0, "ACT_OT_extrapolation_type", "type", FCURVE_EXTRAPOLATE_LINEAR);
}
@@ -226,6 +233,7 @@ static void act_editmenu(bContext *C, uiLayout *layout, void *arg_unused)
uiItemS(layout);
+ uiItemMenuF(layout, "Keyframe Type", 0, act_edit_keytypesmenu, NULL);
uiItemMenuF(layout, "Handle Type", 0, act_edit_handlesmenu, NULL);
uiItemMenuF(layout, "Interpolation Mode", 0, act_edit_ipomenu, NULL);
uiItemMenuF(layout, "Extrapolation Mode", 0, act_edit_expomenu, NULL);
diff --git a/source/blender/editors/space_action/action_intern.h b/source/blender/editors/space_action/action_intern.h
index 1aeeeff0c80..e5f0ab8994e 100644
--- a/source/blender/editors/space_action/action_intern.h
+++ b/source/blender/editors/space_action/action_intern.h
@@ -89,6 +89,7 @@ void ACT_OT_delete(struct wmOperatorType *ot);
void ACT_OT_clean(struct wmOperatorType *ot);
void ACT_OT_sample(struct wmOperatorType *ot);
+void ACT_OT_keyframe_type(struct wmOperatorType *ot);
void ACT_OT_handle_type(struct wmOperatorType *ot);
void ACT_OT_interpolation_type(struct wmOperatorType *ot);
void ACT_OT_extrapolation_type(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_action/action_ops.c b/source/blender/editors/space_action/action_ops.c
index f18b6197eb3..42b033040b1 100644
--- a/source/blender/editors/space_action/action_ops.c
+++ b/source/blender/editors/space_action/action_ops.c
@@ -75,6 +75,7 @@ void action_operatortypes(void)
WM_operatortype_append(ACT_OT_handle_type);
WM_operatortype_append(ACT_OT_interpolation_type);
WM_operatortype_append(ACT_OT_extrapolation_type);
+ WM_operatortype_append(ACT_OT_keyframe_type);
WM_operatortype_append(ACT_OT_sample);
WM_operatortype_append(ACT_OT_clean);
WM_operatortype_append(ACT_OT_delete);
@@ -133,6 +134,7 @@ static void action_keymap_keyframes (wmWindowManager *wm, ListBase *keymap)
WM_keymap_add_item(keymap, "ACT_OT_handle_type", HKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "ACT_OT_interpolation_type", TKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "ACT_OT_extrapolation_type", EKEY, KM_PRESS, KM_SHIFT, 0);
+ WM_keymap_add_item(keymap, "ACT_OT_keyframe_type", RKEY, KM_PRESS, 0, 0);
/* destructive */
WM_keymap_add_item(keymap, "ACT_OT_clean", OKEY, KM_PRESS, 0, 0);