Revision: 21339
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21339
Author:   aligorith
Date:     2009-07-03 12:28:10 +0200 (Fri, 03 Jul 2009)

Log Message:
-----------
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.

Modified Paths:
--------------
    branches/soc-2009-aligorith/source/blender/blenkernel/intern/anim_sys.c
    branches/soc-2009-aligorith/source/blender/editors/animation/anim_channels.c
    branches/soc-2009-aligorith/source/blender/editors/animation/anim_filter.c
    
branches/soc-2009-aligorith/source/blender/editors/space_action/action_draw.c
    branches/soc-2009-aligorith/source/blender/editors/space_graph/graph_draw.c
    branches/soc-2009-aligorith/source/blender/makesdna/DNA_action_types.h
    branches/soc-2009-aligorith/source/blender/makesdna/DNA_anim_types.h

Modified: 
branches/soc-2009-aligorith/source/blender/blenkernel/intern/anim_sys.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/blenkernel/intern/anim_sys.c     
2009-07-03 09:23:12 UTC (rev 21338)
+++ branches/soc-2009-aligorith/source/blender/blenkernel/intern/anim_sys.c     
2009-07-03 10:28:10 UTC (rev 21339)
@@ -492,11 +492,14 @@
        /* 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 @@
        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 @@
                /* 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 

Modified: 
branches/soc-2009-aligorith/source/blender/editors/animation/anim_channels.c
===================================================================
--- 
branches/soc-2009-aligorith/source/blender/editors/animation/anim_channels.c    
    2009-07-03 09:23:12 UTC (rev 21338)
+++ 
branches/soc-2009-aligorith/source/blender/editors/animation/anim_channels.c    
    2009-07-03 10:28:10 UTC (rev 21339)
@@ -1491,10 +1491,18 @@
                                /* 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) {

Modified: 
branches/soc-2009-aligorith/source/blender/editors/animation/anim_filter.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/animation/anim_filter.c  
2009-07-03 09:23:12 UTC (rev 21338)
+++ branches/soc-2009-aligorith/source/blender/editors/animation/anim_filter.c  
2009-07-03 10:28:10 UTC (rev 21339)
@@ -682,25 +682,30 @@
                         * 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--;
+                                               }
                                        }
                                }
                        }

Modified: 
branches/soc-2009-aligorith/source/blender/editors/space_action/action_draw.c
===================================================================
--- 
branches/soc-2009-aligorith/source/blender/editors/space_action/action_draw.c   
    2009-07-03 09:23:12 UTC (rev 21338)
+++ 
branches/soc-2009-aligorith/source/blender/editors/space_action/action_draw.c   
    2009-07-03 10:28:10 UTC (rev 21339)
@@ -645,6 +645,11 @@
                                                        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

Modified: 
branches/soc-2009-aligorith/source/blender/editors/space_graph/graph_draw.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/space_graph/graph_draw.c 
2009-07-03 09:23:12 UTC (rev 21338)
+++ branches/soc-2009-aligorith/source/blender/editors/space_graph/graph_draw.c 
2009-07-03 10:28:10 UTC (rev 21339)
@@ -1166,6 +1166,17 @@
                                                        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

Modified: branches/soc-2009-aligorith/source/blender/makesdna/DNA_action_types.h
===================================================================
--- branches/soc-2009-aligorith/source/blender/makesdna/DNA_action_types.h      
2009-07-03 09:23:12 UTC (rev 21338)
+++ branches/soc-2009-aligorith/source/blender/makesdna/DNA_action_types.h      
2009-07-03 10:28:10 UTC (rev 21339)
@@ -225,10 +225,18 @@
 
 /* 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)

Modified: branches/soc-2009-aligorith/source/blender/makesdna/DNA_anim_types.h
===================================================================
--- branches/soc-2009-aligorith/source/blender/makesdna/DNA_anim_types.h        
2009-07-03 09:23:12 UTC (rev 21338)
+++ branches/soc-2009-aligorith/source/blender/makesdna/DNA_anim_types.h        
2009-07-03 10:28:10 UTC (rev 21339)
@@ -737,6 +737,9 @@
        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) */


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to