NLA SoC: Muting and Graph-Editor Curve visibility for (Action) Groups
Groups (the Action variety) can now be muted, and also be set to not be drawn in the Graph Editor. These settings get applied to all the F-Curves within the group, overriding any settings individual F-Curves might have, allowing users to quickly mute or hide groups of curves without having to go through clicking on all of them. Also, added a flag that can be used to set the curve visiblity on AnimData level too. This will be enabled in a future commit.
This commit is contained in:
@@ -492,11 +492,14 @@ static void animsys_evaluate_fcurves (PointerRNA *ptr, ListBase *list, AnimMappe
|
||||
/* calculate then execute each curve */
|
||||
for (fcu= list->first; fcu; fcu= fcu->next)
|
||||
{
|
||||
/* check if this curve should be skipped */
|
||||
if ((fcu->flag & (FCURVE_MUTED|FCURVE_DISABLED)) == 0)
|
||||
{
|
||||
calculate_fcurve(fcu, ctime);
|
||||
animsys_execute_fcurve(ptr, remap, fcu);
|
||||
/* check if this F-Curve doesn't belong to a muted group */
|
||||
if ((fcu->grp == NULL) || (fcu->grp->flag & AGRP_MUTED)==0) {
|
||||
/* check if this curve should be skipped */
|
||||
if ((fcu->flag & (FCURVE_MUTED|FCURVE_DISABLED)) == 0)
|
||||
{
|
||||
calculate_fcurve(fcu, ctime);
|
||||
animsys_execute_fcurve(ptr, remap, fcu);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -551,6 +554,10 @@ void animsys_evaluate_action_group (PointerRNA *ptr, bAction *act, bActionGroup
|
||||
if ELEM(NULL, act, agrp) return;
|
||||
if ((remap) && (remap->target != act)) remap= NULL;
|
||||
|
||||
/* if group is muted, don't evaluated any of the F-Curve */
|
||||
if (agrp->flag & AGRP_MUTED)
|
||||
return;
|
||||
|
||||
/* calculate then execute each curve */
|
||||
for (fcu= agrp->channels.first; (fcu) && (fcu->grp == agrp); fcu= fcu->next)
|
||||
{
|
||||
@@ -884,6 +891,8 @@ static void nlastrip_evaluate_actionclip (PointerRNA *ptr, ListBase *channels, N
|
||||
/* check if this curve should be skipped */
|
||||
if (fcu->flag & (FCURVE_MUTED|FCURVE_DISABLED))
|
||||
continue;
|
||||
if ((fcu->grp) && (fcu->grp->flag & AGRP_MUTED))
|
||||
continue;
|
||||
|
||||
/* evaluate the F-Curve's value for the time given in the strip
|
||||
* NOTE: we use the modified time here, since strip's F-Curve Modifiers are applied on top of this
|
||||
|
||||
@@ -928,6 +928,12 @@ static void setflag_anim_channels (bAnimContext *ac, short setting, short mode,
|
||||
case ACHANNEL_SETTING_EXPAND:
|
||||
ACHANNEL_SET_FLAG(agrp, mode, AGRP_EXPANDED);
|
||||
break;
|
||||
case ACHANNEL_SETTING_MUTE:
|
||||
ACHANNEL_SET_FLAG(agrp, mode, AGRP_MUTED);
|
||||
break;
|
||||
case ACHANNEL_SETTING_VISIBLE:
|
||||
ACHANNEL_SET_FLAG_NEG(agrp, mode, AGRP_NOTVISIBLE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1491,10 +1497,18 @@ static void mouse_anim_channels (bAnimContext *ac, float x, int channel_index, s
|
||||
/* toggle expand */
|
||||
agrp->flag ^= AGRP_EXPANDED;
|
||||
}
|
||||
else if ((x < (offset+32)) && (ac->spacetype==SPACE_IPO)) {
|
||||
/* toggle visibility (of grouped F-Curves in Graph editor) */
|
||||
agrp->flag ^= AGRP_NOTVISIBLE;
|
||||
}
|
||||
else if (x >= (ACHANNEL_NAMEWIDTH-ACHANNEL_BUTTON_WIDTH)) {
|
||||
/* toggle protection/locking */
|
||||
agrp->flag ^= AGRP_PROTECTED;
|
||||
}
|
||||
else if (x >= (ACHANNEL_NAMEWIDTH-2*ACHANNEL_BUTTON_WIDTH)) {
|
||||
/* toggle mute */
|
||||
agrp->flag ^= AGRP_MUTED;
|
||||
}
|
||||
else {
|
||||
/* select/deselect group */
|
||||
if (selectmode == SELECT_INVERT) {
|
||||
|
||||
@@ -682,25 +682,30 @@ static int animdata_filter_action (ListBase *anim_data, bAction *act, int filter
|
||||
* cases when we should include F-Curves inside group:
|
||||
* - we don't care about visibility
|
||||
* - group is expanded
|
||||
* - we're interested in keyframes, but not if they appear in selected channels
|
||||
* - we just need the F-Curves present
|
||||
*/
|
||||
// XXX what was the selection check here for again?
|
||||
if ( (!(filter_mode & ANIMFILTER_VISIBLE) || EXPANDED_AGRP(agrp)) ||
|
||||
( /*ANIMCHANNEL_SELOK(SEL_AGRP(agrp)) &&*/ (filter_mode & ANIMFILTER_CURVESONLY) ) )
|
||||
if ( (!(filter_mode & ANIMFILTER_VISIBLE) || EXPANDED_AGRP(agrp)) || (filter_mode & ANIMFILTER_CURVESONLY) )
|
||||
{
|
||||
if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_AGRP(agrp)) {
|
||||
// XXX the 'owner' info here needs review...
|
||||
items += animdata_filter_fcurves(anim_data, agrp->channels.first, agrp, owner, ownertype, filter_mode, owner_id);
|
||||
|
||||
/* remove group from filtered list if last element is group
|
||||
* (i.e. only if group had channels, which were all hidden)
|
||||
*/
|
||||
// XXX this is really hacky... it should be fixed in a much more elegant way!
|
||||
if ( (ale) && (anim_data->last == ale) &&
|
||||
(ale->data == agrp) && (agrp->channels.first) )
|
||||
{
|
||||
BLI_freelinkN(anim_data, ale);
|
||||
items--;
|
||||
/* for the Graph Editor, curves may be set to not be visible in the view to lessen clutter,
|
||||
* but to do this, we need to check that the group doesn't have it's not-visible flag set preventing
|
||||
* all its sub-curves to be shown
|
||||
*/
|
||||
if ( !(filter_mode & ANIMFILTER_CURVEVISIBLE) || !(agrp->flag & AGRP_NOTVISIBLE) )
|
||||
{
|
||||
if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_AGRP(agrp)) {
|
||||
// XXX the 'owner' info here needs review...
|
||||
items += animdata_filter_fcurves(anim_data, agrp->channels.first, agrp, owner, ownertype, filter_mode, owner_id);
|
||||
|
||||
/* remove group from filtered list if last element is group
|
||||
* (i.e. only if group had channels, which were all hidden)
|
||||
*/
|
||||
// XXX this is really hacky... it should be fixed in a much more elegant way!
|
||||
if ( (ale) && (anim_data->last == ale) &&
|
||||
(ale->data == agrp) && (agrp->channels.first) )
|
||||
{
|
||||
BLI_freelinkN(anim_data, ale);
|
||||
items--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -645,6 +645,11 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
|
||||
expand = ICON_TRIA_RIGHT;
|
||||
}
|
||||
|
||||
if (agrp->flag & AGRP_MUTED)
|
||||
mute = ICON_MUTE_IPO_ON;
|
||||
else
|
||||
mute = ICON_MUTE_IPO_OFF;
|
||||
|
||||
if (EDITABLE_AGRP(agrp))
|
||||
protect = ICON_UNLOCKED;
|
||||
else
|
||||
|
||||
@@ -1166,6 +1166,17 @@ void graph_draw_channel_names(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
|
||||
expand = ICON_TRIA_RIGHT;
|
||||
}
|
||||
|
||||
/* for now, 'special' (i.e. in front of name) is used to show visibility status */
|
||||
if (agrp->flag & AGRP_NOTVISIBLE)
|
||||
special= ICON_CHECKBOX_DEHLT;
|
||||
else
|
||||
special= ICON_CHECKBOX_HLT;
|
||||
|
||||
if (agrp->flag & AGRP_MUTED)
|
||||
mute = ICON_MUTE_IPO_ON;
|
||||
else
|
||||
mute = ICON_MUTE_IPO_OFF;
|
||||
|
||||
if (EDITABLE_AGRP(agrp))
|
||||
protect = ICON_UNLOCKED;
|
||||
else
|
||||
|
||||
@@ -225,10 +225,18 @@ typedef struct bActionGroup {
|
||||
|
||||
/* Action Group flags */
|
||||
typedef enum eActionGroup_Flag {
|
||||
/* group is selected */
|
||||
AGRP_SELECTED = (1<<0),
|
||||
/* group is 'active' / last selected one */
|
||||
AGRP_ACTIVE = (1<<1),
|
||||
/* keyframes/channels belonging to it cannot be edited */
|
||||
AGRP_PROTECTED = (1<<2),
|
||||
/* for UI, sub-channels are shown */
|
||||
AGRP_EXPANDED = (1<<3),
|
||||
/* sub-channels are not evaluated */
|
||||
AGRP_MUTED = (1<<4),
|
||||
/* sub-channels are not visible in Graph Editor */
|
||||
AGRP_NOTVISIBLE = (1<<5),
|
||||
|
||||
AGRP_TEMP = (1<<30),
|
||||
AGRP_MOVED = (1<<31)
|
||||
|
||||
@@ -737,6 +737,9 @@ enum {
|
||||
ADT_DRIVERS_COLLAPSED = (1<<10),
|
||||
/* don't execute drivers */
|
||||
ADT_DRIVERS_DISABLED = (1<<11),
|
||||
|
||||
/* F-Curves from this AnimData block are not visible in the Graph Editor */
|
||||
ADT_CURVES_NOT_VISIBLE = (1<<16),
|
||||
} eAnimData_Flag;
|
||||
|
||||
/* Animation Data recalculation settings (to be set by depsgraph) */
|
||||
|
||||
Reference in New Issue
Block a user