diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-11-30 14:37:27 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-11-30 14:37:27 +0300 |
commit | 679da5eb50651f9000333df424fbcdd73d129fc0 (patch) | |
tree | c800ca460388eea2ebc4ccfe68d339c87088eea6 /source/blender/editors | |
parent | e1ba5517e65a702bfabac00e5981cf1b103d971a (diff) |
Durian Graph Editor Request: Only show handles of selected keyframes
This option for the Graph Editor means that only the handles for selected keyframes get shown in the view, eliminating clutter.
Currently, the selection code isn't aware of this option, so clicking anywhere near where a handle might be may often trigger it to show up. This may/may not be desireable, but we'll see how Lee goes with this first :)
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_graph/graph_draw.c | 46 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_header.c | 1 |
2 files changed, 34 insertions, 13 deletions
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 3a7f9024510..9681d20c13b 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -235,7 +235,7 @@ static void draw_fcurve_handle_control (float x, float y, float xscale, float ys } /* helper func - draw handle vertices only for an F-Curve (if it is not protected) */ -static void draw_fcurve_vertices_handles (FCurve *fcu, View2D *v2d, short sel) +static void draw_fcurve_vertices_handles (SpaceIpo *sipo, FCurve *fcu, View2D *v2d, short sel) { BezTriple *bezt= fcu->bezt; BezTriple *prevbezt = NULL; @@ -255,19 +255,24 @@ static void draw_fcurve_vertices_handles (FCurve *fcu, View2D *v2d, short sel) glEnable(GL_BLEND); for (i=0; i < fcu->totvert; i++, prevbezt=bezt, bezt++) { - /* Draw the editmode handels for a bezier curve (others don't have handles) + /* Draw the editmode handles for a bezier curve (others don't have handles) * if their selection status matches the selection status we're drawing for * - first handle only if previous beztriple was bezier-mode * - second handle only if current beztriple is bezier-mode + * + * Also, need to take into account whether the keyframe was selected + * if a Graph Editor option to only show handles of selected keys is on. */ - if ( (!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) ) { - if ((bezt->f1 & SELECT) == sel)/* && v2d->cur.xmin < bezt->vec[0][0] < v2d->cur.xmax)*/ - draw_fcurve_handle_control(bezt->vec[0][0], bezt->vec[0][1], xscale, yscale, hsize); - } - - if (bezt->ipo==BEZT_IPO_BEZ) { - if ((bezt->f3 & SELECT) == sel)/* && v2d->cur.xmin < bezt->vec[2][0] < v2d->cur.xmax)*/ - draw_fcurve_handle_control(bezt->vec[2][0], bezt->vec[2][1], xscale, yscale, hsize); + if ( !(sipo->flag & SIPO_SELVHANDLESONLY) || BEZSELECTED(bezt) ) { + if ( (!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) ) { + if ((bezt->f1 & SELECT) == sel)/* && v2d->cur.xmin < bezt->vec[0][0] < v2d->cur.xmax)*/ + draw_fcurve_handle_control(bezt->vec[0][0], bezt->vec[0][1], xscale, yscale, hsize); + } + + if (bezt->ipo==BEZT_IPO_BEZ) { + if ((bezt->f3 & SELECT) == sel)/* && v2d->cur.xmin < bezt->vec[2][0] < v2d->cur.xmax)*/ + draw_fcurve_handle_control(bezt->vec[2][0], bezt->vec[2][1], xscale, yscale, hsize); + } } } @@ -313,10 +318,10 @@ void draw_fcurve_vertices (SpaceIpo *sipo, ARegion *ar, FCurve *fcu) (sipo->flag & SIPO_NOHANDLES)==0 && (fcu->totvert > 1)) { set_fcurve_vertex_color(sipo, fcu, 0); - draw_fcurve_vertices_handles(fcu, v2d, 0); + draw_fcurve_vertices_handles(sipo, fcu, v2d, 0); set_fcurve_vertex_color(sipo, fcu, 1); - draw_fcurve_vertices_handles(fcu, v2d, 1); + draw_fcurve_vertices_handles(sipo, fcu, v2d, 1); } /* draw keyframes over the handles */ @@ -347,13 +352,28 @@ static void draw_fcurve_handles (SpaceIpo *sipo, ARegion *ar, FCurve *fcu) */ glBegin(GL_LINES); - /* slightly hacky, but we want to draw unselected points before selected ones */ + /* slightly hacky, but we want to draw unselected points before selected ones + * so that selected points are clearly visible + */ for (sel= 0; sel < 2; sel++) { BezTriple *bezt=fcu->bezt, *prevbezt=NULL; unsigned int *col= (sel)? (nurbcol+4) : (nurbcol); float *fp; + /* if only selected keyframes have handles shown, skip the first round */ + if ((sel == 0) && (sipo->flag & SIPO_SELVHANDLESONLY)) + continue; + for (b= 0; b < fcu->totvert; b++, prevbezt=bezt, bezt++) { + /* if only selected keyframes can get their handles shown, + * check that keyframe is selected + */ + if (sipo->flag & SIPO_SELVHANDLESONLY) { + if (BEZSELECTED(bezt) == 0) + continue; + } + + /* draw handle with appropriate set of colors if selection is ok */ if ((bezt->f2 & SELECT)==sel) { fp= bezt->vec[0]; diff --git a/source/blender/editors/space_graph/graph_header.c b/source/blender/editors/space_graph/graph_header.c index e05e41f1b66..bf8777164c5 100644 --- a/source/blender/editors/space_graph/graph_header.c +++ b/source/blender/editors/space_graph/graph_header.c @@ -91,6 +91,7 @@ static void graph_viewmenu(bContext *C, uiLayout *layout, void *arg_unused) uiItemO(layout, "Show Handles", ICON_CHECKBOX_HLT, "GRAPH_OT_handles_view_toggle"); uiItemR(layout, NULL, 0, &spaceptr, "only_selected_curves_handles", 0); + uiItemR(layout, NULL, 0, &spaceptr, "only_selected_keyframe_handles", 0); if (sipo->flag & SIPO_DRAWTIME) |