Revision: 18953
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18953
Author:   aligorith
Date:     2009-02-13 07:33:07 +0100 (Fri, 13 Feb 2009)

Log Message:
-----------
Animato: Various improvements

* Scene and World AnimDatas are now included in animation editors
 
* Keyframes for integer-value settings now get the FCURVE_INT_VALUES flag set 
for their F-Curves, which restricts those curves to only having integer-values. 
F-Curve displays have been altered accordingly, but some editing tools may 
still need tweaks to work with this.

* Fixed notifiers for Insert Keyframe -> Active Keying Set.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c
    branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c
    
branches/blender2.5/blender/source/blender/editors/animation/keyframes_draw.c
    branches/blender2.5/blender/source/blender/editors/animation/keyframing.c
    branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h
    
branches/blender2.5/blender/source/blender/editors/include/ED_keyframes_draw.h
    
branches/blender2.5/blender/source/blender/editors/space_action/action_draw.c
    
branches/blender2.5/blender/source/blender/editors/space_action/action_header.c
    
branches/blender2.5/blender/source/blender/editors/space_action/action_select.c
    branches/blender2.5/blender/source/blender/editors/space_graph/graph_draw.c
    
branches/blender2.5/blender/source/blender/editors/space_graph/graph_header.c
    branches/blender2.5/blender/source/blender/editors/space_graph/space_graph.c
    branches/blender2.5/blender/source/blender/makesdna/DNA_action_types.h
    branches/blender2.5/blender/source/blender/makesdna/DNA_scene_types.h
    branches/blender2.5/blender/source/blender/makesdna/DNA_world_types.h

Modified: 
branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c
===================================================================
--- 
branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c    
    2009-02-13 06:24:15 UTC (rev 18952)
+++ 
branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c    
    2009-02-13 06:33:07 UTC (rev 18953)
@@ -58,6 +58,7 @@
 #include "DNA_userdef_types.h"
 #include "DNA_gpencil_types.h"
 #include "DNA_windowmanager_types.h"
+#include "DNA_world_types.h"
 
 #include "RNA_access.h"
 #include "RNA_define.h"
@@ -164,6 +165,10 @@
                                break;
                        
                        switch (ale->type) {
+                               case ANIMTYPE_SCENE:
+                                       if (ale->flag & SCE_DS_SELECTED)
+                                               sel= ACHANNEL_SETFLAG_CLEAR;
+                                       break;
                                case ANIMTYPE_OBJECT:
                                        if (ale->flag & SELECT)
                                                sel= ACHANNEL_SETFLAG_CLEAR;
@@ -187,6 +192,13 @@
        /* Now set the flags */
        for (ale= anim_data.first; ale; ale= ale->next) {
                switch (ale->type) {
+                       case ANIMTYPE_SCENE:
+                       {
+                               Scene *scene= (Scene *)ale->data;
+                               
+                               ACHANNEL_SET_FLAG(scene, sel, SCE_DS_SELECTED);
+                       }
+                               break;
                        case ANIMTYPE_OBJECT:
                        {
                                Base *base= (Base *)ale->data;
@@ -1046,6 +1058,26 @@
        
        /* action to take depends on what channel we've got */
        switch (ale->type) {
+               case ANIMTYPE_SCENE:
+               {
+                       Scene *sce= (Scene *)ale->data;
+                       
+                       if (x < 16) {
+                               /* toggle expand */
+                               sce->flag ^= SCE_DS_COLLAPSED;
+                       }
+                       else {
+                               /* set selection status */
+                               if (selectmode == SELECT_INVERT) {
+                                       /* swap select */
+                                       sce->flag ^= SCE_DS_SELECTED;
+                               }
+                               else {
+                                       sce->flag |= SCE_DS_SELECTED;
+                               }
+                       }
+               }
+                       break;
                case ANIMTYPE_OBJECT:
                {
                        bDopeSheet *ads= (bDopeSheet *)ac->data;
@@ -1132,6 +1164,12 @@
                        key->flag ^= KEYBLOCK_DS_EXPAND;
                }
                        break;
+               case ANIMTYPE_DSWOR:
+               {
+                       World *wo= (World *)ale->data;
+                       wo->flag ^= WO_DS_EXPAND;
+               }
+                       break;
                        
                case ANIMTYPE_GROUP: 
                {

Modified: 
branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c  
2009-02-13 06:24:15 UTC (rev 18952)
+++ branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c  
2009-02-13 06:33:07 UTC (rev 18953)
@@ -66,6 +66,7 @@
 #include "DNA_scene_types.h"
 #include "DNA_screen_types.h"
 #include "DNA_windowmanager_types.h"
+#include "DNA_world_types.h"
 
 #include "MEM_guardedalloc.h"
 
@@ -333,6 +334,16 @@
                
                /* do specifics */
                switch (datatype) {
+                       case ANIMTYPE_SCENE:
+                       {
+                               Scene *sce= (Scene *)data;
+                               
+                               ale->flag= sce->flag;
+                               
+                               ale->key_data= sce;
+                               ale->datatype= ALE_SCE;
+                       }
+                               break;
                        case ANIMTYPE_OBJECT:
                        {
                                Base *base= (Base *)data;
@@ -431,7 +442,18 @@
                                ale->datatype= ALE_ACT;
                        }
                                break;
+                       case ANIMTYPE_DSWOR:
+                       {
+                               World *wo= (World *)data;
+                               AnimData *adt= wo->adt;
                                
+                               ale->flag= FILTER_WOR_SCED(wo); 
+                               
+                               ale->key_data= (adt) ? adt->action : NULL;
+                               ale->datatype= ALE_ACT;
+                       }
+                               break;
+                               
                        case ANIMTYPE_GROUP:
                        {
                                bActionGroup *agrp= (bActionGroup *)data;
@@ -1007,6 +1029,117 @@
        return items;
 }      
 
+static int animdata_filter_dopesheet_scene (ListBase *anim_data, bDopeSheet 
*ads, Scene *sce, int filter_mode)
+{
+       World *wo= sce->world;
+       bAnimListElem *ale;
+       int items = 0;
+       
+       /* add scene as a channel first (even if we aren't showing scenes we 
still need to show the scene's sub-data */
+       if ((filter_mode & ANIMFILTER_CURVESONLY) == 0) {
+               /* check if filtering by selection */
+               if ( !(filter_mode & ANIMFILTER_SEL) || (sce->flag & 
SCE_DS_SELECTED) ) {
+                       ale= make_new_animlistelem(sce, ANIMTYPE_SCENE, NULL, 
ANIMTYPE_NONE, NULL);
+                       if (ale) {
+                               BLI_addtail(anim_data, ale);
+                               items++;
+                       }
+               }
+       }
+       
+       /* if collapsed, don't go any further (unless adding keyframes only) */
+       if ( (EXPANDED_SCEC(sce) == 0) && !(filter_mode & 
ANIMFILTER_CURVESONLY) )
+               return items;
+               
+       /* Action or Drivers */
+       if ((ads->filterflag & ADS_FILTER_ONLYDRIVERS) == 0) {
+               /* Action? */
+               if (ANIMDATA_HAS_KEYS(sce) && !(ads->filterflag & 
ADS_FILTER_NOSCE)) {
+                       AnimData *adt= sce->adt;
+                       
+                       /* include action-expand widget? */
+                       if ((filter_mode & ANIMFILTER_CHANNELS) && 
!(filter_mode & ANIMFILTER_CURVESONLY)) {
+                               ale= make_new_animlistelem(adt->action, 
ANIMTYPE_FILLACTD, sce, ANIMTYPE_SCENE, (ID *)sce);
+                               if (ale) {
+                                       BLI_addtail(anim_data, ale);
+                                       items++;
+                               }
+                       }
+                       
+                       /* add F-Curve channels? */
+                       if (EXPANDED_ACTC(adt->action) || !(filter_mode & 
ANIMFILTER_CHANNELS)) {
+                               items += animdata_filter_action(anim_data, 
adt->action, filter_mode, sce, ANIMTYPE_SCENE, (ID *)sce); 
+                       }
+               }
+       }
+       else {
+               /* Drivers */
+               if (ANIMDATA_HAS_DRIVERS(sce) && !(ads->filterflag & 
ADS_FILTER_NOSCE)) {
+                       AnimData *adt= sce->adt;
+                       
+                       /* include drivers-expand widget? */
+                       if ((filter_mode & ANIMFILTER_CHANNELS) && 
!(filter_mode & ANIMFILTER_CURVESONLY)) {
+                               ale= make_new_animlistelem(adt->action, 
ANIMTYPE_FILLDRIVERS, sce, ANIMTYPE_SCENE, (ID *)sce);
+                               if (ale) {
+                                       BLI_addtail(anim_data, ale);
+                                       items++;
+                               }
+                       }
+                       
+                       /* add F-Curve channels (drivers are F-Curves) */
+                       if (EXPANDED_DRVD(adt) || !(filter_mode & 
ANIMFILTER_CHANNELS)) {
+                               items += animdata_filter_fcurves(anim_data, 
adt->drivers.first, NULL, sce, ANIMTYPE_SCENE, filter_mode, (ID *)sce);
+                       }
+               }
+       }
+               
+       /* world */
+       if ((wo) && !(ads->filterflag & ADS_FILTER_NOWOR)) {
+               /* Animation or Drivers */
+               if ((ads->filterflag & ADS_FILTER_ONLYDRIVERS) == 0) {
+                       AnimData *adt= wo->adt;
+                       
+                       /* include world-expand widget? */
+                       if ((filter_mode & ANIMFILTER_CHANNELS) && 
!(filter_mode & ANIMFILTER_CURVESONLY)) {
+                               ale= make_new_animlistelem(wo, ANIMTYPE_DSWOR, 
sce, ANIMTYPE_SCENE, (ID *)sce);
+                               if (ale) {
+                                       BLI_addtail(anim_data, ale);
+                                       items++;
+                               }
+                       }
+                       
+                       /* add channels */
+                       if (FILTER_WOR_SCED(wo) || (filter_mode & 
ANIMFILTER_CURVESONLY)) {
+                               items += animdata_filter_action(anim_data, 
adt->action, filter_mode, wo, ANIMTYPE_DSWOR, (ID *)wo); 
+                       }
+               }
+               else {
+                       /* Drivers */
+                       if (ANIMDATA_HAS_DRIVERS(wo)) {
+                               AnimData *adt= wo->adt;
+                               
+                               /* include shapekey-expand widget? */
+                               if ((filter_mode & ANIMFILTER_CHANNELS) && 
!(filter_mode & ANIMFILTER_CURVESONLY)) {
+                                       ale= make_new_animlistelem(wo, 
ANIMTYPE_DSWOR, sce, ANIMTYPE_SCENE, (ID *)wo);
+                                       if (ale) {
+                                               BLI_addtail(anim_data, ale);
+                                               items++;
+                                       }
+                               }
+                               
+                               /* add F-Curve channels (drivers are F-Curves) 
*/
+                               if (FILTER_WOR_SCED(wo)/*EXPANDED_DRVD(adt)*/ 
|| !(filter_mode & ANIMFILTER_CHANNELS)) {
+                                       // XXX owner info is messed up now...
+                                       items += 
animdata_filter_fcurves(anim_data, adt->drivers.first, NULL, wo, 
ANIMTYPE_DSWOR, filter_mode, (ID *)wo);
+                               }
+                       }
+               }
+       }
+       
+       /* return the number of items added to the list */
+       return items;
+}
+
 // TODO: implement pinning... (if and when pinning is done, what we need to do 
is to provide freeing mechanisms - to protect against data that was deleted)
 static int animdata_filter_dopesheet (ListBase *anim_data, bDopeSheet *ads, 
int filter_mode)
 {
@@ -1020,6 +1153,35 @@
                return 0;
        }
        
+       /* scene-linked animation */
+       // TODO: sequencer, composite nodes - are we to include those here too?
+       {
+               short sceOk, worOk;
+               
+               /* check filtering-flags if ok */
+               if (ads->filterflag) {
+                       if (ads->filterflag & ADS_FILTER_ONLYDRIVERS) {
+                               sceOk= (ANIMDATA_HAS_DRIVERS(sce) && 
!(ads->filterflag & ADS_FILTER_NOSCE));
+                               worOk= ((sce->world) && 
ANIMDATA_HAS_DRIVERS(sce->world) && !(ads->filterflag & ADS_FILTER_NOWOR));
+                       }
+                       else {
+                               sceOk= (ANIMDATA_HAS_KEYS(sce) && 
!(ads->filterflag & ADS_FILTER_NOSCE));
+                               worOk= ((sce->world) && 
ANIMDATA_HAS_KEYS(sce->world) && !(ads->filterflag & ADS_FILTER_NOWOR));
+                       }
+               }
+               else {
+                       sceOk= (ANIMDATA_HAS_KEYS(sce));
+                       worOk= ((sce->world) && ANIMDATA_HAS_KEYS(sce->world));
+               }
+               
+               /* check if not all bad (i.e. so there is something to show) */
+               if ( !(!sceOk && !worOk) ) {
+                       /* add scene data to the list of filtered channels */
+                       items += animdata_filter_dopesheet_scene(anim_data, 
ads, sce, filter_mode);
+               }
+       }
+       
+       
        /* loop over all bases in the scene */
        for (base= sce->base.first; base; base= base->next) {
                /* check if there's an object (all the relevant checks are done 
in the ob-function) */
@@ -1049,16 +1211,6 @@
                                        /* only selected should be shown */
                                        continue;
                                }
-#if 0
-                               if ((ads->filterflag & ADS_FILTER_NOARM) && 
(ob->type == OB_ARMATURE)) {
-                                       /* not showing armatures  */
-                                       continue;
-                               }
-                               if ((ads->filterflag & ADS_FILTER_NOOBJ) && 
(ob->type != OB_ARMATURE)) {
-                                       /* not showing objects that aren't 
armatures */
-                                       continue;
-                               }
-#endif
                                
                                /* check filters for datatypes */
                                if (ads->filterflag & ADS_FILTER_ONLYDRIVERS) {
@@ -1066,7 +1218,7 @@
                                        keyOk= ((key) && 
ANIMDATA_HAS_DRIVERS(key) && !(ads->filterflag & ADS_FILTER_NOSHAPEKEYS));
                                }
                                else {
-                                       actOk= (ANIMDATA_HAS_KEYS(ob) /*&& 
!(ads->filterflag & ADS_FILTER_NOACTS)*/);
+                                       actOk= ANIMDATA_HAS_KEYS(ob);
                                        keyOk= ((key) && ANIMDATA_HAS_KEYS(key) 
&& !(ads->filterflag & ADS_FILTER_NOSHAPEKEYS));
                                }
                                

Modified: 
branches/blender2.5/blender/source/blender/editors/animation/keyframes_draw.c
===================================================================
--- 
branches/blender2.5/blender/source/blender/editors/animation/keyframes_draw.c   
    2009-02-13 06:24:15 UTC (rev 18952)
+++ 
branches/blender2.5/blender/source/blender/editors/animation/keyframes_draw.c   
    2009-02-13 06:33:07 UTC (rev 18953)
@@ -63,6 +63,7 @@
 #include "DNA_userdef_types.h"
 #include "DNA_gpencil_types.h"
 #include "DNA_windowmanager_types.h"
+#include "DNA_world_types.h"
 
 #include "BKE_action.h"
 #include "BKE_depsgraph.h"
@@ -331,6 +332,18 @@
 
 /* *************************** Channel Drawing Funcs 
*************************** */
 
+void draw_scene_channel(gla2DDrawInfo *di, ActKeysInc *aki, Scene *sce, float 
ypos)
+{
+       ListBase keys = {0, 0};
+       ListBase blocks = {0, 0};
+
+       scene_to_keylist(sce, &keys, &blocks, aki);
+       draw_keylist(di, &keys, &blocks, ypos);
+       
+       BLI_freelistN(&keys);
+       BLI_freelistN(&blocks);
+}
+
 void draw_object_channel(gla2DDrawInfo *di, ActKeysInc *aki, Object *ob, float 
ypos)
 {
        ListBase keys = {0, 0};
@@ -390,9 +403,44 @@
 

@@ Diff output truncated at 10240 characters. @@

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

Reply via email to