DopeSheet/Action Editors - Summary Channel Tweaks:
* Summary channel now works in DopeSheet AND Action Editors * By clicking on the expand/collapse widget on the summary channel, you can now show/hide all the other channels in the editor.
This commit is contained in:
@@ -280,11 +280,13 @@ static void acf_generic_idblock_name(bAnimListElem *ale, char *name)
|
||||
|
||||
/* Settings ------------------------------------------- */
|
||||
|
||||
#if 0
|
||||
/* channel type has no settings */
|
||||
static short acf_generic_none_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* check if some setting exists for this object-based data-expander (category only) */
|
||||
static short acf_generic_dsexpand_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting)
|
||||
@@ -372,6 +374,50 @@ static int acf_summary_icon(bAnimListElem *ale)
|
||||
return ICON_BORDERMOVE;
|
||||
}
|
||||
|
||||
/* check if some setting exists for this channel */
|
||||
static short acf_summary_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting)
|
||||
{
|
||||
/* only expanded is supported, as it is used for hiding all stuff which the summary covers */
|
||||
return (setting == ACHANNEL_SETTING_EXPAND);
|
||||
}
|
||||
|
||||
/* get the appropriate flag(s) for the setting when it is valid */
|
||||
static int acf_summary_setting_flag(int setting, short *neg)
|
||||
{
|
||||
if (setting == ACHANNEL_SETTING_EXPAND) {
|
||||
/* expanded */
|
||||
*neg= 1;
|
||||
return ADS_FLAG_SUMMARY_COLLAPSED;
|
||||
}
|
||||
else {
|
||||
/* unsupported */
|
||||
*neg= 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* get pointer to the setting */
|
||||
static void *acf_summary_setting_ptr(bAnimListElem *ale, int setting, short *type)
|
||||
{
|
||||
bAnimContext *ac= (bAnimContext *)ale->data;
|
||||
|
||||
/* if data is valid, return pointer to active dopesheet's relevant flag
|
||||
* - this is restricted to DopeSheet/Action Editor only
|
||||
*/
|
||||
if ((ac->sa) && (ac->spacetype == SPACE_ACTION) && (setting == ACHANNEL_SETTING_EXPAND)) {
|
||||
SpaceAction *saction= (SpaceAction *)ac->sa->spacedata.first;
|
||||
bDopeSheet *ads= &saction->ads;
|
||||
|
||||
/* return pointer to DopeSheet's flag */
|
||||
GET_ACF_FLAG_PTR(ads->flag);
|
||||
}
|
||||
else {
|
||||
/* can't return anything useful - unsupported */
|
||||
*type= 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* all animation summary (DopeSheet only) type define */
|
||||
static bAnimChannelType ACF_SUMMARY =
|
||||
{
|
||||
@@ -382,9 +428,9 @@ static bAnimChannelType ACF_SUMMARY =
|
||||
acf_summary_name, /* name */
|
||||
acf_summary_icon, /* icon */
|
||||
|
||||
acf_generic_none_setting_valid, /* has setting */
|
||||
NULL, /* flag for setting */
|
||||
NULL /* pointer for setting */
|
||||
acf_summary_setting_valid, /* has setting */
|
||||
acf_summary_setting_flag, /* flag for setting */
|
||||
acf_summary_setting_ptr /* pointer for setting */
|
||||
};
|
||||
|
||||
/* Scene ------------------------------------------- */
|
||||
|
||||
@@ -1520,21 +1520,6 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bAnimContext *ac, bDo
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* dopesheet summary
|
||||
* - only for drawing and/or selecting keyframes in channels, but not for real editing
|
||||
* - only useful for DopeSheet Editor, where the summary is useful
|
||||
*/
|
||||
// TODO: we should really check if some other prohibited filters are also active, but that can be for later
|
||||
if ((filter_mode & ANIMFILTER_CHANNELS) && (ads->filterflag & ADS_FILTER_SUMMARY)) {
|
||||
ale= make_new_animlistelem(ac, ANIMTYPE_SUMMARY, NULL, ANIMTYPE_NONE, NULL);
|
||||
if (ale) {
|
||||
BLI_addtail(anim_data, ale);
|
||||
items++;
|
||||
}
|
||||
|
||||
// TODO: if the summary gets a collapse widget, then we could make the other stuff not get shown...
|
||||
}
|
||||
|
||||
/* scene-linked animation */
|
||||
// TODO: sequencer, composite nodes - are we to include those here too?
|
||||
{
|
||||
@@ -1887,6 +1872,50 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bAnimContext *ac, bDo
|
||||
return items;
|
||||
}
|
||||
|
||||
/* Summary track for DopeSheet/Action Editor
|
||||
* - return code is whether the summary lets the other channels get drawn
|
||||
*/
|
||||
static short animdata_filter_dopesheet_summary (bAnimContext *ac, ListBase *anim_data, int filter_mode, int *items)
|
||||
{
|
||||
bDopeSheet *ads = NULL;
|
||||
|
||||
/* get the DopeSheet information to use
|
||||
* - we should only need to deal with the DopeSheet/Action Editor,
|
||||
* since all the other Animation Editors won't have this concept
|
||||
* being applicable.
|
||||
*/
|
||||
if ((ac && ac->sa) && (ac->sa->spacetype == SPACE_ACTION)) {
|
||||
SpaceAction *saction= (SpaceAction *)ac->sa->spacedata.first;
|
||||
ads= &saction->ads;
|
||||
}
|
||||
else {
|
||||
/* invalid space type - skip this summary channels */
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* dopesheet summary
|
||||
* - only for drawing and/or selecting keyframes in channels, but not for real editing
|
||||
* - only useful for DopeSheet Editor, where the summary is useful
|
||||
*/
|
||||
// TODO: we should really check if some other prohibited filters are also active, but that can be for later
|
||||
if ((filter_mode & ANIMFILTER_CHANNELS) && (ads->filterflag & ADS_FILTER_SUMMARY)) {
|
||||
bAnimListElem *ale= make_new_animlistelem(ac, ANIMTYPE_SUMMARY, NULL, ANIMTYPE_NONE, NULL);
|
||||
if (ale) {
|
||||
BLI_addtail(anim_data, ale);
|
||||
(*items)++;
|
||||
}
|
||||
|
||||
/* if summary is collapsed, don't show other channels beneath this
|
||||
* - this check is put inside the summary check so that it doesn't interfere with normal operation
|
||||
*/
|
||||
if (ads->flag & ADS_FLAG_SUMMARY_COLLAPSED)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* the other channels beneath this can be shown */
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ----------- Public API --------------- */
|
||||
|
||||
/* This function filters the active data source to leave only animation channels suitable for
|
||||
@@ -1907,23 +1936,41 @@ int ANIM_animdata_filter (bAnimContext *ac, ListBase *anim_data, int filter_mode
|
||||
|
||||
/* firstly filter the data */
|
||||
switch (datatype) {
|
||||
case ANIMCONT_ACTION:
|
||||
items= animdata_filter_action(anim_data, NULL, data, filter_mode, NULL, ANIMTYPE_NONE, (ID *)obact);
|
||||
case ANIMCONT_ACTION: /* 'Action Editor' */
|
||||
{
|
||||
/* the check for the DopeSheet summary is included here since the summary works here too */
|
||||
if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items))
|
||||
items += animdata_filter_action(anim_data, NULL, data, filter_mode, NULL, ANIMTYPE_NONE, (ID *)obact);
|
||||
}
|
||||
break;
|
||||
|
||||
case ANIMCONT_SHAPEKEY:
|
||||
{
|
||||
//items= animdata_filter_shapekey(anim_data, data, filter_mode, NULL, ANIMTYPE_NONE, (ID *)obact);
|
||||
}
|
||||
break;
|
||||
|
||||
case ANIMCONT_GPENCIL:
|
||||
{
|
||||
//items= animdata_filter_gpencil(anim_data, data, filter_mode);
|
||||
}
|
||||
break;
|
||||
|
||||
case ANIMCONT_DOPESHEET:
|
||||
case ANIMCONT_FCURVES:
|
||||
case ANIMCONT_DRIVERS:
|
||||
case ANIMCONT_NLA:
|
||||
items= animdata_filter_dopesheet(anim_data, ac, data, filter_mode);
|
||||
case ANIMCONT_DOPESHEET: /* 'DopeSheet Editor' */
|
||||
{
|
||||
/* the DopeSheet editor is the primary place where the DopeSheet summaries are useful */
|
||||
if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items))
|
||||
items += animdata_filter_dopesheet(anim_data, ac, data, filter_mode);
|
||||
}
|
||||
break;
|
||||
|
||||
case ANIMCONT_FCURVES: /* Graph Editor -> FCurves/Animation Editing */
|
||||
case ANIMCONT_DRIVERS: /* Graph Editor -> Drivers Editing */
|
||||
case ANIMCONT_NLA: /* NLA Editor */
|
||||
{
|
||||
/* all of these editors use the basic DopeSheet data for filtering options, but don't have all the same features */
|
||||
items = animdata_filter_dopesheet(anim_data, ac, data, filter_mode);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -326,23 +326,23 @@ void action_header_buttons(const bContext *C, ARegion *ar)
|
||||
|
||||
xco += (90 + 8);
|
||||
|
||||
/* SUMMARY CHANNEL */
|
||||
uiDefIconTextButBitI(block, TOG, ADS_FILTER_SUMMARY, B_REDR, ICON_BORDERMOVE, "Summary", xco,yco,XIC*4,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Include DopeSheet summary row"); // TODO: needs a better icon
|
||||
xco += (XIC*4.5);
|
||||
|
||||
/*if (ac.data)*/
|
||||
{
|
||||
/* MODE-DEPENDENT DRAWING */
|
||||
if (saction->mode == SACTCONT_DOPESHEET) {
|
||||
/* FILTERING OPTIONS */
|
||||
/* DopeSheet summary... */
|
||||
uiDefIconTextButBitI(block, TOG, ADS_FILTER_SUMMARY, B_REDR, ICON_BORDERMOVE, "Summary", xco,yco,XIC*4,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Include DopeSheet summary row"); // TODO: needs a better icon
|
||||
xco += (XIC*3.5);
|
||||
|
||||
/* Standard filtering... */
|
||||
xco -= XIC; // XXX first button incurs this offset...
|
||||
xco= ANIM_headerUI_standard_buttons(C, &saction->ads, block, xco, yco);
|
||||
}
|
||||
else if (saction->mode == SACTCONT_ACTION) {
|
||||
uiLayout *layout;
|
||||
bScreen *sc= CTX_wm_screen(C);
|
||||
PointerRNA ptr;
|
||||
|
||||
|
||||
RNA_pointer_create(&sc->id, &RNA_SpaceDopeSheetEditor, saction, &ptr);
|
||||
|
||||
layout= uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, xco, 20+3, 20, 1, U.uistyles.first);
|
||||
@@ -379,7 +379,7 @@ void action_header_buttons(const bContext *C, ARegion *ar)
|
||||
xco += (XIC + 8);
|
||||
}
|
||||
|
||||
/* always as last */
|
||||
/* always as last */
|
||||
UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, (int)(ar->v2d.tot.ymax-ar->v2d.tot.ymin));
|
||||
|
||||
uiEndBlock(C, block);
|
||||
|
||||
@@ -444,9 +444,9 @@ typedef enum DOPESHEET_FILTERFLAG {
|
||||
} DOPESHEET_FILTERFLAG;
|
||||
|
||||
/* DopeSheet general flags */
|
||||
//typedef enum DOPESHEET_FLAG {
|
||||
|
||||
//} DOPESHEET_FLAG;
|
||||
typedef enum DOPESHEET_FLAG {
|
||||
ADS_FLAG_SUMMARY_COLLAPSED = (1<<0), /* when summary is shown, it is collapsed, so all other channels get hidden */
|
||||
} DOPESHEET_FLAG;
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user