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/animation
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/animation')
-rw-r--r--source/blender/editors/animation/keyframes_draw.c37
-rw-r--r--source/blender/editors/animation/keyframes_edit.c31
2 files changed, 59 insertions, 9 deletions
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index 2107e6e4252..abea38e129e 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -98,9 +98,7 @@ static ActKeyColumn *bezt_to_new_actkeycolumn(BezTriple *bezt)
/* store settings based on state of BezTriple */
ak->cfra= bezt->vec[1][0];
ak->sel= BEZSELECTED(bezt) ? SELECT : 0;
-
- // TODO: handle type = bezt->h1 or bezt->h2
- ak->handle_type= 0;
+ ak->key_type= BEZKEYTYPE(bezt);
/* set 'modified', since this is used to identify long keyframes */
ak->modified = 1;
@@ -134,6 +132,10 @@ static void add_bezt_to_keycolumns_list(DLRBT_Tree *keys, BezTriple *bezt)
if (BEZSELECTED(bezt)) ak->sel = SELECT;
ak->modified += 1;
+ /* for keyframe type, 'proper' keyframes have priority over breakdowns (and other types for now) */
+ if (BEZKEYTYPE(bezt) == BEZT_KEYTYPE_KEYFRAME)
+ ak->key_type= BEZT_KEYTYPE_KEYFRAME;
+
/* done... no need to insert */
return;
}
@@ -340,7 +342,7 @@ static const float _unit_diamond_shape[4][2] = {
};
/* draw a simple diamond shape with OpenGL */
-void draw_keyframe_shape (float x, float y, float xscale, float hsize, short sel, short mode)
+void draw_keyframe_shape (float x, float y, float xscale, float hsize, short sel, short key_type, short mode)
{
static GLuint displist1=0;
static GLuint displist2=0;
@@ -371,6 +373,11 @@ void draw_keyframe_shape (float x, float y, float xscale, float hsize, short sel
glEndList();
}
+ /* tweak size of keyframe shape according to type of keyframe
+ * - 'proper' keyframes have key_type=0, so get drawn at full size
+ */
+ hsize -= 0.5f*key_type;
+
/* adjust view transform before starting */
glTranslatef(x, y, 0.0f);
glScalef(1.0f/xscale*hsize, hsize, 1.0f);
@@ -381,8 +388,22 @@ void draw_keyframe_shape (float x, float y, float xscale, float hsize, short sel
/* draw! */
if ELEM(mode, KEYFRAME_SHAPE_INSIDE, KEYFRAME_SHAPE_BOTH) {
/* interior - hardcoded colors (for selected and unselected only) */
- if (sel) UI_ThemeColorShade(TH_STRIP_SELECT, 50);
- else glColor3ub(0xE9, 0xE9, 0xE9);
+ switch (key_type) {
+ case BEZT_KEYTYPE_BREAKDOWN: /* bluish frames for now */
+ {
+ if (sel) glColor3f(0.33f, 0.75f, 0.93f);
+ else glColor3f(0.70f, 0.86f, 0.91f);
+ }
+ break;
+
+ case BEZT_KEYTYPE_KEYFRAME: /* traditional yellowish frames for now */
+ default:
+ {
+ if (sel) UI_ThemeColorShade(TH_STRIP_SELECT, 50);
+ else glColor3f(0.91f, 0.91f, 0.91f);
+ }
+ break;
+ }
glCallList(displist2);
}
@@ -454,7 +475,7 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa
/* draw using OpenGL - uglier but faster */
// NOTE1: a previous version of this didn't work nice for some intel cards
// NOTE2: if we wanted to go back to icons, these are icon = (ak->sel & SELECT) ? ICON_SPACE2 : ICON_SPACE3;
- draw_keyframe_shape(ak->cfra, ypos, xscale, 5.0f, (ak->sel & SELECT), KEYFRAME_SHAPE_BOTH);
+ draw_keyframe_shape(ak->cfra, ypos, xscale, 5.0f, (ak->sel & SELECT), ak->key_type, KEYFRAME_SHAPE_BOTH);
}
}
@@ -695,7 +716,7 @@ void gpl_to_keylist(bDopeSheet *ads, bGPDlayer *gpl, DLRBT_Tree *keys, DLRBT_Tre
ak->cfra= (float)gpf->framenum;
ak->modified = 1;
- ak->handle_type= 0;
+ ak->key_type= 0;
if (gpf->flag & GP_FRAME_SELECT)
ak->sel = SELECT;
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index 77826eca87a..ac04dc7d1a8 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -655,7 +655,7 @@ static short set_bezt_bezier(BeztEditData *bed, BezTriple *bezt)
return 0;
}
-/* Set the interpolation type of the selected BezTriples in each IPO curve to the specified one */
+/* Set the interpolation type of the selected BezTriples in each F-Curve to the specified one */
// ANIM_editkeyframes_ipocurve_ipotype() !
BeztEditFunc ANIM_editkeyframes_ipo(short code)
{
@@ -669,6 +669,35 @@ BeztEditFunc ANIM_editkeyframes_ipo(short code)
}
}
+/* ------- */
+
+static short set_keytype_keyframe(BeztEditData *bed, BezTriple *bezt)
+{
+ if (bezt->f2 & SELECT)
+ BEZKEYTYPE(bezt)= BEZT_KEYTYPE_KEYFRAME;
+ return 0;
+}
+
+static short set_keytype_breakdown(BeztEditData *bed, BezTriple *bezt)
+{
+ if (bezt->f2 & SELECT)
+ BEZKEYTYPE(bezt)= BEZT_KEYTYPE_BREAKDOWN;
+ return 0;
+}
+
+/* Set the interpolation type of the selected BezTriples in each F-Curve to the specified one */
+BeztEditFunc ANIM_editkeyframes_keytype(short code)
+{
+ switch (code) {
+ case BEZT_KEYTYPE_BREAKDOWN: /* breakdown */
+ return set_keytype_breakdown;
+
+ case BEZT_KEYTYPE_KEYFRAME: /* proper keyframe */
+ default:
+ return set_keytype_keyframe;
+ }
+}
+
/* ******************************************* */
/* Selection */