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

Log Message:
-----------
NLA SoC: Notifier Fixes for Animation Editors 

I've gone through all the Animation Editor operators, making sure they send 
appropriate notifiers, and that these notifiers are handled. 

* Added a separate category for animation-related notifiers, since the 
old-style ones attached to specific datatypes only was turning out to be not 
too feasible.

* For now, the focus has been on making sure that all Animation Editors update 
when there have been any potentially suitable changes at all. Later on, we can 
filter these more carefully to only take the ones we really need (for 
optimisation purposes)

Modified Paths:
--------------
    branches/soc-2009-aligorith/source/blender/editors/animation/anim_channels.c
    branches/soc-2009-aligorith/source/blender/editors/animation/anim_deps.c
    
branches/soc-2009-aligorith/source/blender/editors/animation/keyframes_general.c
    branches/soc-2009-aligorith/source/blender/editors/animation/keyingsets.c
    branches/soc-2009-aligorith/source/blender/editors/include/ED_anim_api.h
    
branches/soc-2009-aligorith/source/blender/editors/space_action/action_edit.c
    
branches/soc-2009-aligorith/source/blender/editors/space_action/action_select.c
    
branches/soc-2009-aligorith/source/blender/editors/space_action/space_action.c
    branches/soc-2009-aligorith/source/blender/editors/space_graph/graph_edit.c
    
branches/soc-2009-aligorith/source/blender/editors/space_graph/graph_select.c
    branches/soc-2009-aligorith/source/blender/editors/space_graph/space_graph.c
    branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_channels.c
    branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_edit.c
    branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_select.c
    branches/soc-2009-aligorith/source/blender/editors/space_nla/space_nla.c
    
branches/soc-2009-aligorith/source/blender/editors/space_view3d/space_view3d.c
    branches/soc-2009-aligorith/source/blender/editors/transform/transform.c
    branches/soc-2009-aligorith/source/blender/windowmanager/WM_types.h

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-10 08:43:37 UTC (rev 21478)
+++ 
branches/soc-2009-aligorith/source/blender/editors/animation/anim_channels.c    
    2009-07-10 10:48:25 UTC (rev 21479)
@@ -614,8 +614,8 @@
        mode= RNA_enum_get(op->ptr, "direction");
        rearrange_action_channels(&ac, mode);
        
-       /* set notifier tha things have changed */
-       ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_CHANNELS);
+       /* send notifier that things have changed */
+       WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN_EDIT, NULL);
        
        return OPERATOR_FINISHED;
 }
@@ -728,8 +728,8 @@
        /* cleanup */
        BLI_freelistN(&anim_data);
        
-       /* set notifier tha things have changed */
-       ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_CHANNELS);
+       /* send notifier that things have changed */
+       WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN_EDIT, NULL);
        
        return OPERATOR_FINISHED;
 }
@@ -992,8 +992,8 @@
        /* modify setting */
        setflag_anim_channels(&ac, setting, mode, 1);
        
-       /* set notifier tha things have changed */
-       ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_CHANNELS);
+       /* send notifier that things have changed */
+       WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN_EDIT, NULL);
        
        return OPERATOR_FINISHED;
 }
@@ -1101,8 +1101,8 @@
        /* modify setting */
        setflag_anim_channels(&ac, ACHANNEL_SETTING_EXPAND, 
ACHANNEL_SETFLAG_ADD, onlysel);
        
-       /* set notifier that things have changed */
-       ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_CHANNELS);
+       /* send notifier that things have changed */
+       WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN_EDIT, NULL);
        
        return OPERATOR_FINISHED;
 }
@@ -1142,8 +1142,8 @@
        /* modify setting */
        setflag_anim_channels(&ac, ACHANNEL_SETTING_EXPAND, 
ACHANNEL_SETFLAG_CLEAR, onlysel);
        
-       /* set notifier that things have changed */
-       ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_CHANNELS);
+       /* send notifier that things have changed */
+       WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN_EDIT, NULL);
        
        return OPERATOR_FINISHED;
 }
@@ -1181,8 +1181,8 @@
        else
                ANIM_deselect_anim_channels(ac.data, ac.datatype, 1, 
ACHANNEL_SETFLAG_ADD);
        
-       /* set notifier tha things have changed */
-       ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_CHANNELS);
+       /* send notifier that things have changed */
+       WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN_SELECT, NULL);
        
        return OPERATOR_FINISHED;
 }
@@ -1310,6 +1310,9 @@
        /* apply borderselect animation channels */
        borderselect_anim_channels(&ac, &rect, selectmode);
        
+       /* send notifier that things have changed */
+       WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN_SELECT, NULL);
+       
        return OPERATOR_FINISHED;
 } 
 
@@ -1344,11 +1347,12 @@
  * NOTE: eventually, this should probably be phased out when many of these 
things are replaced with buttons
  */
 
-static void mouse_anim_channels (bAnimContext *ac, float x, int channel_index, 
short selectmode)
+static int mouse_anim_channels (bAnimContext *ac, float x, int channel_index, 
short selectmode)
 {
        ListBase anim_data = {NULL, NULL};
        bAnimListElem *ale;
        int filter;
+       int notifierFlags = 0;
        
        /* get the channel that was clicked on */
                /* filter channels */
@@ -1362,7 +1366,7 @@
                printf("Error: animation channel (index = %d) not found in 
mouse_anim_channels() \n", channel_index);
                
                BLI_freelistN(&anim_data);
-               return;
+               return 0;
        }
        
        /* selectmode -1 is a special case for ActionGroups only, which selects 
all of the channels underneath it only... */
@@ -1370,7 +1374,7 @@
        if ((selectmode == -1) && (ale->type != ANIMTYPE_GROUP)) {
                /* normal channels should not behave normally in this case */
                BLI_freelistN(&anim_data);
-               return;
+               return 0;
        }
        
        /* action to take depends on what channel we've got */
@@ -1382,6 +1386,8 @@
                        if (x < 16) {
                                /* toggle expand */
                                sce->flag ^= SCE_DS_COLLAPSED;
+                               
+                               notifierFlags |= ND_ANIMCHAN_EDIT;
                        }
                        else {
                                /* set selection status */
@@ -1392,6 +1398,8 @@
                                else {
                                        sce->flag |= SCE_DS_SELECTED;
                                }
+                               
+                               notifierFlags |= ND_ANIMCHAN_SELECT;
                        }
                }
                        break;
@@ -1405,6 +1413,8 @@
                        if (x < 16) {
                                /* toggle expand */
                                ob->nlaflag ^= OB_ADS_COLLAPSED; // XXX 
+                               
+                               notifierFlags |= ND_ANIMCHAN_EDIT;
                        }
                        else {
                                /* set selection status */
@@ -1429,6 +1439,8 @@
                                
                                /* xxx should be ED_base_object_activate(), but 
we need context pointer for that... */
                                //set_active_base(base);
+                               
+                               notifierFlags |= ND_ANIMCHAN_SELECT;
                        }
                }
                        break;
@@ -1436,18 +1448,21 @@
                {
                        bAction *act= (bAction *)ale->data;
                        act->flag ^= ACT_COLLAPSED;
+                       notifierFlags |= ND_ANIMCHAN_EDIT;
                }
                        break;
                case ANIMTYPE_FILLDRIVERS:
                {
                        AnimData *adt= (AnimData* )ale->data;
                        adt->flag ^= ADT_DRIVERS_COLLAPSED;
+                       notifierFlags |= ND_ANIMCHAN_EDIT;
                }
                        break;
                case ANIMTYPE_FILLMATD:
                {
                        Object *ob= (Object *)ale->data;
                        ob->nlaflag ^= OB_ADS_SHOWMATS; // XXX 
+                       notifierFlags |= ND_ANIMCHAN_EDIT;
                }
                        break;
                                
@@ -1455,36 +1470,42 @@
                {
                        Material *ma= (Material *)ale->data;
                        ma->flag ^= MA_DS_EXPAND;
+                       notifierFlags |= ND_ANIMCHAN_EDIT;
                }
                        break;
                case ANIMTYPE_DSLAM:
                {
                        Lamp *la= (Lamp *)ale->data;
                        la->flag ^= LA_DS_EXPAND;
+                       notifierFlags |= ND_ANIMCHAN_EDIT;
                }
                        break;
                case ANIMTYPE_DSCAM:
                {
                        Camera *ca= (Camera *)ale->data;
                        ca->flag ^= CAM_DS_EXPAND;
+                       notifierFlags |= ND_ANIMCHAN_EDIT;
                }
                        break;
                case ANIMTYPE_DSCUR:
                {
                        Curve *cu= (Curve *)ale->data;
                        cu->flag ^= CU_DS_EXPAND;
+                       notifierFlags |= ND_ANIMCHAN_EDIT;
                }
                        break;
                case ANIMTYPE_DSSKEY:
                {
                        Key *key= (Key *)ale->data;
                        key->flag ^= KEYBLOCK_DS_EXPAND;
+                       notifierFlags |= ND_ANIMCHAN_EDIT;
                }
                        break;
                case ANIMTYPE_DSWOR:
                {
                        World *wo= (World *)ale->data;
                        wo->flag ^= WO_DS_EXPAND;
+                       notifierFlags |= ND_ANIMCHAN_EDIT;
                }
                        break;
                        
@@ -1496,18 +1517,22 @@
                        if ((x < (offset+17)) && (agrp->channels.first)) {
                                /* toggle expand */
                                agrp->flag ^= AGRP_EXPANDED;
+                               notifierFlags |= ND_ANIMCHAN_EDIT;
                        }
                        else if ((x < (offset+32)) && 
(ac->spacetype==SPACE_IPO)) {
                                /* toggle visibility (of grouped F-Curves in 
Graph editor) */
                                agrp->flag ^= AGRP_NOTVISIBLE;
+                               notifierFlags |= ND_ANIMCHAN_EDIT;
                        }
                        else if (x >= 
(ACHANNEL_NAMEWIDTH-ACHANNEL_BUTTON_WIDTH)) {
                                /* toggle protection/locking */
                                agrp->flag ^= AGRP_PROTECTED;
+                               notifierFlags |= ND_ANIMCHAN_EDIT;
                        }
                        else if (x >= 
(ACHANNEL_NAMEWIDTH-2*ACHANNEL_BUTTON_WIDTH)) {
                                /* toggle mute */
                                agrp->flag ^= AGRP_MUTED;
+                               notifierFlags |= ND_ANIMCHAN_EDIT;
                        }
                        else {
                                /* select/deselect group */
@@ -1536,6 +1561,8 @@
                                /* if group is selected now, make group the 
'active' one in the visible list */
                                if (agrp->flag & AGRP_SELECTED)
                                        ANIM_set_active_channel(ac, ac->data, 
ac->datatype, filter, agrp, ANIMTYPE_GROUP);
+                                       
+                               notifierFlags |= ND_ANIMCHAN_SELECT;
                        }
                }
                        break;
@@ -1556,16 +1583,20 @@
                        
                        if (x >= (ACHANNEL_NAMEWIDTH-ACHANNEL_BUTTON_WIDTH)) {
                                /* toggle protection (only if there's a toggle 
there) */
-                               if (fcu->bezt)
+                               if (fcu->bezt) {
                                        fcu->flag ^= FCURVE_PROTECTED;
+                                       notifierFlags |= ND_ANIMCHAN_EDIT;
+                               }
                        }
                        else if (x >= 
(ACHANNEL_NAMEWIDTH-2*ACHANNEL_BUTTON_WIDTH)) {
                                /* toggle mute */
                                fcu->flag ^= FCURVE_MUTED;
+                               notifierFlags |= ND_ANIMCHAN_EDIT;
                        }
                        else if ((x < (offset+17)) && 
(ac->spacetype==SPACE_IPO)) {
                                /* toggle visibility */
                                fcu->flag ^= FCURVE_VISIBLE;
+                               notifierFlags |= ND_ANIMCHAN_EDIT;
                        }
                        else {
                                /* select/deselect */
@@ -1582,6 +1613,8 @@
                                /* if F-Curve is selected now, make F-Curve the 
'active' one in the visible list */
                                if (fcu->flag & FCURVE_SELECTED)
                                        ANIM_set_active_channel(ac, ac->data, 
ac->datatype, filter, fcu, ANIMTYPE_FCURVE);
+                                       
+                               notifierFlags |= ND_ANIMCHAN_SELECT;
                        }
                }
                        break;
@@ -1591,6 +1624,8 @@
                        
                        /* toggle expand */
                        gpd->flag ^= GP_DATA_EXPAND;
+                       
+                       notifierFlags |= ND_ANIMCHAN_EDIT;
                }
                        break;
                case ANIMTYPE_GPLAYER:
@@ -1629,6 +1664,9 @@
        
        /* free channels */
        BLI_freelistN(&anim_data);
+       
+       /* return notifier flags */
+       return notifierFlags;
 }
 
 /* ------------------- */
@@ -1641,6 +1679,7 @@
        ARegion *ar;
        View2D *v2d;
        int mval[2], channel_index;
+       int notifierFlags = 0;
        short selectmode;
        float x, y;
        
@@ -1675,10 +1714,10 @@
        UI_view2d_listview_view_to_cell(v2d, ACHANNEL_NAMEWIDTH, ACHANNEL_STEP, 
0, (float)ACHANNEL_HEIGHT_HALF, x, y, NULL, &channel_index);
        
        /* handle mouse-click in the relevant channel then */
-       mouse_anim_channels(&ac, x, channel_index, selectmode);
+       notifierFlags= mouse_anim_channels(&ac, x, channel_index, selectmode);
        
-       /* set notifier tha things have changed */
-       ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_CHANNELS);
+       /* set notifier that things have changed */
+       WM_event_add_notifier(C, NC_ANIMATION|notifierFlags, NULL);
        
        return OPERATOR_FINISHED;
 }

Modified: 
branches/soc-2009-aligorith/source/blender/editors/animation/anim_deps.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/animation/anim_deps.c    
2009-07-10 08:43:37 UTC (rev 21478)
+++ branches/soc-2009-aligorith/source/blender/editors/animation/anim_deps.c    
2009-07-10 10:48:25 UTC (rev 21479)
@@ -77,72 +77,6 @@
 }
 
 
-/* **************************** animation tool notifiers 
******************************** */
-
-/* Send notifiers on behalf of animation editing tools, based on various 
context info 
- *     - data_changed: eAnimData_Changed
- */
-void ANIM_animdata_send_notifiers (bContext *C, bAnimContext *ac, short 
data_changed)
-{
-       /* types of notifiers to send, depends on the editor context */
-       switch (ac->datatype) {
-               case ANIMCONT_DOPESHEET: /* dopesheet */
-               case ANIMCONT_FCURVES: /* fcurve editor */
-               case ANIMCONT_DRIVERS: /* drivers editor */     // XXX probably 
this will need separate handling, since these are part of dependency system 
-               {
-                       /* what action was taken */
-                       switch (data_changed) {
-                               case ANIM_CHANGED_KEYFRAMES_VALUES:
-                                       /* keyframe values changed, so 
transform may have changed */
-                                       // XXX what about other cases? maybe we 
need general ND_KEYFRAMES or ND_ANIMATION?

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to