diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-07-28 10:50:30 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-07-28 10:50:30 +0400 |
commit | 61178b19eabdc3e3833c167cdc8128db8994f9ca (patch) | |
tree | 3f1e666d11155d74b83fa427d6233f63dd22db24 /source/blender/editors/space_graph | |
parent | 9cbdf73cf0ce53bdf256b1b28efbb066a71e43b9 (diff) |
2.5 - Anim Editor cleanups + Graph Editor Clutter Reduction
* Cleaned up some parts of the code that were unused/could be done a bit nicer
* Added a new option for only showing the keyframes of the selected F-Curves in the Graph Editor, as another way of reducing the clutter.
Diffstat (limited to 'source/blender/editors/space_graph')
-rw-r--r-- | source/blender/editors/space_graph/graph_draw.c | 58 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_edit.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_header.c | 1 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_select.c | 9 |
4 files changed, 31 insertions, 39 deletions
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 67a93b2e786..105ecf23c3e 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -723,24 +723,6 @@ static void draw_fcurve_curve_bezts (FCurve *fcu, View2D *v2d, View2DGrid *grid) glEnd(); } -#if 0 -static void draw_ipokey(SpaceIpo *sipo, ARegion *ar) -{ - View2D *v2d= &ar->v2d; - IpoKey *ik; - - glBegin(GL_LINES); - for (ik= sipo->ipokey.first; ik; ik= ik->next) { - if (ik->flag & SELECT) glColor3ub(0xFF, 0xFF, 0x99); - else glColor3ub(0xAA, 0xAA, 0x55); - - glVertex2f(ik->val, v2d->cur.ymin); - glVertex2f(ik->val, v2d->cur.ymax); - } - glEnd(); -} -#endif - /* Public Curve-Drawing API ---------------- */ /* Draw the 'ghost' F-Curves (i.e. snapshots of the curve) */ @@ -855,26 +837,30 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri glDisable(GL_BLEND); } - /* 2) draw handles and vertices as appropriate based on active */ - if (fcurve_needs_draw_fmodifier_controls(fcu, fcm)) { - /* only draw controls if this is the active modifier */ - if ((fcu->flag & FCURVE_ACTIVE) && (fcm)) { - switch (fcm->type) { - case FMODIFIER_TYPE_ENVELOPE: /* envelope */ - draw_fcurve_modifier_controls_envelope(fcu, fcm, &ar->v2d); - break; + /* 2) draw handles and vertices as appropriate based on active + * - if the option to only show controls if the F-Curve is selected is enabled, we must obey this + */ + if (!(sipo->flag & SIPO_SELCUVERTSONLY) || (fcu->flag & FCURVE_SELECTED)) { + if (fcurve_needs_draw_fmodifier_controls(fcu, fcm)) { + /* only draw controls if this is the active modifier */ + if ((fcu->flag & FCURVE_ACTIVE) && (fcm)) { + switch (fcm->type) { + case FMODIFIER_TYPE_ENVELOPE: /* envelope */ + draw_fcurve_modifier_controls_envelope(fcu, fcm, &ar->v2d); + break; + } } } - } - else if ( ((fcu->bezt) || (fcu->fpt)) && (fcu->totvert) ) { - if (fcu->bezt) { - /* only draw handles/vertices on keyframes */ - draw_fcurve_handles(sipo, ar, fcu); - draw_fcurve_vertices(sipo, ar, fcu); - } - else { - /* samples: should we only draw two indicators at either end as indicators? */ - draw_fcurve_samples(sipo, ar, fcu); + else if ( ((fcu->bezt) || (fcu->fpt)) && (fcu->totvert) ) { + if (fcu->bezt) { + /* only draw handles/vertices on keyframes */ + draw_fcurve_handles(sipo, ar, fcu); + draw_fcurve_vertices(sipo, ar, fcu); + } + else { + /* samples: should we only draw two indicators at either end as indicators? */ + draw_fcurve_samples(sipo, ar, fcu); + } } } diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 24c7a0c5c23..37389b32b3a 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -1386,7 +1386,7 @@ static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op) */ /* step 1: extract only the rotation f-curves */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_FOREDIT); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); for (ale= anim_data.first; ale; ale= ale->next) { diff --git a/source/blender/editors/space_graph/graph_header.c b/source/blender/editors/space_graph/graph_header.c index e4ce889a188..a0ac64e3672 100644 --- a/source/blender/editors/space_graph/graph_header.c +++ b/source/blender/editors/space_graph/graph_header.c @@ -87,6 +87,7 @@ static void graph_viewmenu(bContext *C, uiLayout *layout, void *arg_unused) else uiItemO(layout, "Show Handles", ICON_CHECKBOX_HLT, "GRAPH_OT_handles_view_toggle"); + uiItemR(layout, NULL, 0, &spaceptr, "only_selected_curves_handles", 0, 0, 0); uiItemR(layout, NULL, 0, &spaceptr, "automerge_keyframes", 0, 0, 0); if (sipo->flag & SIPO_DRAWTIME) diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index c4885d095ed..43f35862315 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -567,8 +567,13 @@ static short findnearest_fcurve_vert (bAnimContext *ac, int mval[2], FCurve **fc *fcurve= 0; *bezt= 0; - /* get curves to search through */ + /* get curves to search through + * - if the option to only show keyframes that belong to selected F-Curves is enabled, + * include the 'only selected' flag... + */ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY); + if (sipo->flag & SIPO_SELCUVERTSONLY) + filter |= ANIMFILTER_SEL; ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); for (ale= anim_data.first; ale; ale= ale->next) { @@ -718,7 +723,7 @@ static void mouse_graph_keys (bAnimContext *ac, int mval[], short select_mode, s else { BeztEditFunc select_cb; BeztEditData bed; - + /* initialise keyframe editing data */ memset(&bed, 0, sizeof(BeztEditData)); |