diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-08-16 06:21:43 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-08-16 06:21:43 +0400 |
commit | b257acfed11e8d98eb7c86e0908acf80fb9e27af (patch) | |
tree | a1b197d8355a6f66df48939627ea814eebf16fdd /source/blender/editors/space_action | |
parent | ebf1c5faca86286aa90ab5ab9fc4d3ddb1f51cdf (diff) |
Animation Editors: Code Cleanups (for Channel Lists) Part 2
Now the mute/protect/expand/etc. toggles are drawn using UI widgets. This means that special event handling code to determine when they were clicked on is no longer needed, and also means that there can now be tooltips for these items too.
Also, added visibility toggles for ID-block expanders, which will cause all the F-Curves in the linked datablock to not get drawn. The backend filtering code to make this work will come later...
Diffstat (limited to 'source/blender/editors/space_action')
-rw-r--r-- | source/blender/editors/space_action/action_draw.c | 54 | ||||
-rw-r--r-- | source/blender/editors/space_action/action_intern.h | 2 | ||||
-rw-r--r-- | source/blender/editors/space_action/space_action.c | 2 |
3 files changed, 42 insertions, 16 deletions
diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index f5fa263eee8..4fb22064c17 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -397,7 +397,7 @@ static void action_icu_buts(SpaceAction *saction) /* Channel List */ /* left hand part */ -void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar) +void draw_channel_names(bContext *C, bAnimContext *ac, SpaceAction *saction, ARegion *ar) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; @@ -428,22 +428,48 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar) UI_view2d_sync(NULL, ac->sa, v2d, V2D_VIEWSYNC_AREA_VERTICAL); /* loop through channels, and set up drawing depending on their type */ - y= (float)ACHANNEL_FIRST; - - for (ale= anim_data.first; ale; ale= ale->next) { - float yminc= (float)(y - ACHANNEL_HEIGHT_HALF); - float ymaxc= (float)(y + ACHANNEL_HEIGHT_HALF); + { /* first pass: just the standard GL-drawing for backdrop + text */ + y= (float)ACHANNEL_FIRST; - /* check if visible */ - if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) || - IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) ) - { - /* draw all channels using standard channel-drawing API */ - ANIM_channel_draw(ac, ale, yminc, ymaxc); + for (ale= anim_data.first; ale; ale= ale->next) { + float yminc= (float)(y - ACHANNEL_HEIGHT_HALF); + float ymaxc= (float)(y + ACHANNEL_HEIGHT_HALF); + + /* check if visible */ + if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) || + IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) ) + { + /* draw all channels using standard channel-drawing API */ + ANIM_channel_draw(ac, ale, yminc, ymaxc); + } + + /* adjust y-position for next one */ + y -= ACHANNEL_STEP; } + } + { /* second pass: widgets */ + uiBlock *block= uiBeginBlock(C, ar, "dopesheet channel buttons", UI_EMBOSS); - /* adjust y-position for next one */ - y -= ACHANNEL_STEP; + y= (float)ACHANNEL_FIRST; + + for (ale= anim_data.first; ale; ale= ale->next) { + float yminc= (float)(y - ACHANNEL_HEIGHT_HALF); + float ymaxc= (float)(y + ACHANNEL_HEIGHT_HALF); + + /* check if visible */ + if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) || + IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) ) + { + /* draw all channels using standard channel-drawing API */ + ANIM_channel_draw_widgets(ac, ale, block, yminc, ymaxc); + } + + /* adjust y-position for next one */ + y -= ACHANNEL_STEP; + } + + uiEndBlock(C, block); + uiDrawBlock(C, block); } /* free tempolary channels */ diff --git a/source/blender/editors/space_action/action_intern.h b/source/blender/editors/space_action/action_intern.h index 26655892176..1aeeeff0c80 100644 --- a/source/blender/editors/space_action/action_intern.h +++ b/source/blender/editors/space_action/action_intern.h @@ -41,7 +41,7 @@ struct bAnimListElem; /* ***************************************** */ /* action_draw.c */ -void draw_channel_names(struct bAnimContext *ac, struct SpaceAction *saction, struct ARegion *ar); +void draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct SpaceAction *saction, struct ARegion *ar); void draw_channel_strips(struct bAnimContext *ac, struct SpaceAction *saction, struct ARegion *ar); struct ActKeysInc *init_aki_data(struct bAnimContext *ac, struct bAnimListElem *ale); diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index 55e035cfced..275ac4ea4c1 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -243,7 +243,7 @@ static void action_channel_area_draw(const bContext *C, ARegion *ar) /* data */ if (ANIM_animdata_get_context(C, &ac)) { - draw_channel_names(&ac, saction, ar); + draw_channel_names(C, &ac, saction, ar); } /* reset view matrix */ |