Revision: 21963
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21963
Author:   aligorith
Date:     2009-07-28 08:50:30 +0200 (Tue, 28 Jul 2009)

Log Message:
-----------
2.5 - Anim Editor cleanups + Graph Editor Clutter Reduction

* Cleaned up some parts of the code that were unused/could be done a bit nicer

* Added a new option for only showing the keyframes of the selected F-Curves in 
the Graph Editor, as another way of reducing the clutter.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c
    branches/blender2.5/blender/source/blender/editors/animation/anim_draw.c
    branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c
    branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h
    branches/blender2.5/blender/source/blender/editors/space_graph/graph_draw.c
    branches/blender2.5/blender/source/blender/editors/space_graph/graph_edit.c
    
branches/blender2.5/blender/source/blender/editors/space_graph/graph_header.c
    
branches/blender2.5/blender/source/blender/editors/space_graph/graph_select.c
    branches/blender2.5/blender/source/blender/editors/space_nla/nla_channels.c
    branches/blender2.5/blender/source/blender/editors/space_nla/nla_draw.c
    branches/blender2.5/blender/source/blender/editors/space_nla/nla_edit.c
    branches/blender2.5/blender/source/blender/makesdna/DNA_action_types.h
    branches/blender2.5/blender/source/blender/makesdna/DNA_space_types.h
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_space.c

Modified: 
branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c
===================================================================
--- 
branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c    
    2009-07-28 06:26:10 UTC (rev 21962)
+++ 
branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c    
    2009-07-28 06:50:30 UTC (rev 21963)
@@ -722,7 +722,7 @@
                        /* only groups - don't check other types yet, since 
they may no-longer exist */
                        if (ale->type == ANIMTYPE_GROUP) {
                                bActionGroup *agrp= (bActionGroup *)ale->data;
-                               AnimData *adt= BKE_animdata_from_id(ale->id);
+                               AnimData *adt= ale->adt;
                                FCurve *fcu, *fcn;
                                
                                /* skip this group if no AnimData available, as 
we can't safely remove the F-Curves */
@@ -760,7 +760,7 @@
                for (ale= anim_data.first; ale; ale= ale->next) {
                        /* only F-Curves, and only if we can identify its 
parent */
                        if (ale->type == ANIMTYPE_FCURVE) {
-                               AnimData *adt= BKE_animdata_from_id(ale->id);
+                               AnimData *adt= ale->adt;
                                FCurve *fcu= (FCurve *)ale->data;
                                
                                /* if no AnimData, we've got nowhere to remove 
the F-Curve from */

Modified: 
branches/blender2.5/blender/source/blender/editors/animation/anim_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/anim_draw.c    
2009-07-28 06:26:10 UTC (rev 21962)
+++ branches/blender2.5/blender/source/blender/editors/animation/anim_draw.c    
2009-07-28 06:50:30 UTC (rev 21963)
@@ -242,42 +242,12 @@
                return NULL;
        
        /* handling depends on the type of animation-context we've got */
-       if (ale && ale->id)
-               return BKE_animdata_from_id(ale->id);
-       
-       /* no appropriate object found */
-       return NULL;
+       if (ale)
+               return ale->adt;
+       else
+               return NULL;
 }
 
-/* Set/clear temporary mapping of coordinates from 'local-action' time to 
'global-nla-scaled' time
- *     - the old mapping is stored in a static var, but that shouldn't be too 
bad as UI drawing
- *       (where this is called) is single-threaded anyway
- */
-// XXX was called: map_active_strip()
-// TODO: should this be depreceated?
-void ANIM_nla_mapping_draw(gla2DDrawInfo *di, AnimData *adt, short restore)
-{
-       static rctf stored;
-       
-       if (restore) {
-               /* restore un-mapped coordinates */
-               gla2DSetMap(di, &stored);
-       }
-       else {
-               /* set mapped coordinates */
-               rctf map;
-               
-               gla2DGetMap(di, &stored);
-               map= stored;
-               
-               map.xmin= BKE_nla_tweakedit_remap(adt, map.xmin, 
NLATIME_CONVERT_MAP);
-               map.xmax= BKE_nla_tweakedit_remap(adt, map.xmax, 
NLATIME_CONVERT_MAP);
-               
-               if (map.xmin == map.xmax) map.xmax += 1.0f;
-               gla2DSetMap(di, &map);
-       }
-}
-
 /* ------------------- */
 
 /* helper function for ANIM_nla_mapping_apply_fcurve() -> "restore", i.e. 
mapping points back to action-time */

Modified: 
branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c  
2009-07-28 06:26:10 UTC (rev 21962)
+++ branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c  
2009-07-28 06:50:30 UTC (rev 21963)
@@ -17,11 +17,11 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
- * The Original Code is Copyright (C) 2008 Blender Foundation.
+ * The Original Code is Copyright (C) 2008 Blender Foundation, Joshua Leung
  * All rights reserved.
  *
  * 
- * Contributor(s): Joshua Leung
+ * Contributor(s): Joshua Leung (original author)
  *
  * ***** END GPL LICENSE BLOCK *****
  */
@@ -33,15 +33,16 @@
  * for cases to ignore. 
  *
  * While this is primarily used for the Action/Dopesheet Editor (and its 
accessory modes),
- * the IPO Editor also uses this for it's channel list and for determining 
which curves
- * are being edited.
+ * the Graph Editor also uses this for its channel list and for determining 
which curves
+ * are being edited. Likewise, the NLA Editor also uses this for its channel 
list and in
+ * its operators.
  *
  * Note: much of the original system this was based on was built before the 
creation of the RNA
  * system. In future, it would be interesting to replace some parts of this 
code with RNA queries,
  * however, RNA does not eliminate some of the boiler-plate reduction benefits 
presented by this 
  * system, so if any such work does occur, it should only be used for the 
internals used here...
  *
- * -- Joshua Leung, Dec 2008
+ * -- Joshua Leung, Dec 2008 (Last revision July 2009)
  */
 
 #include <string.h>
@@ -73,6 +74,7 @@
 
 #include "BLI_blenlib.h"
 
+#include "BKE_animsys.h"
 #include "BKE_context.h"
 #include "BKE_global.h"
 #include "BKE_key.h"
@@ -205,6 +207,12 @@
        if (sipo->ads == NULL)
                sipo->ads= MEM_callocN(sizeof(bDopeSheet), "GraphEdit 
DopeSheet");
        
+       /* set settings for Graph Editor - "Selected = Editable" */
+       if (sipo->flag & SIPO_SELCUVERTSONLY)
+               sipo->ads->filterflag |= ADS_FILTER_SELEDIT;
+       else
+               sipo->ads->filterflag &= ~ADS_FILTER_SELEDIT;
+       
        /* sync settings with current view status, then return appropriate data 
*/
        switch (sipo->mode) {
                case SIPO_MODE_ANIMATION:       /* Animation F-Curve Editor */
@@ -403,11 +411,20 @@
        
 
 
-/* quick macro to test if a anim-channel (F-Curve, Group, etc.) is selected in 
an acceptable way */
+/* quick macro to test if an anim-channel (F-Curve, Group, etc.) is selected 
in an acceptable way */
 #define ANIMCHANNEL_SELOK(test_func) \
                ( !(filter_mode & (ANIMFILTER_SEL|ANIMFILTER_UNSEL)) || \
                  ((filter_mode & ANIMFILTER_SEL) && test_func) || \
                  ((filter_mode & ANIMFILTER_UNSEL) && test_func==0) ) 
+                 
+/* quick macro to test if an anim-channel (F-Curve) is selected ok for editing 
purposes 
+ *     - _SELEDIT means that only selected curves will have visible+editable 
keyframes
+ */
+// FIXME: this doesn't work cleanly yet...
+#define ANIMCHANNEL_SELEDITOK(test_func) \
+               ( !(filter_mode & ANIMFILTER_SELEDIT) || \
+                 (filter_mode & ANIMFILTER_CHANNELS) || \
+                 (test_func) )
 
 /* ----------- 'Private' Stuff --------------- */
 
@@ -430,6 +447,7 @@
                ale->ownertype= ownertype;
                
                ale->id= owner_id;
+               ale->adt= BKE_animdata_from_id(owner_id);
                
                /* do specifics */
                switch (datatype) {
@@ -649,7 +667,7 @@
                        /* only work with this channel and its subchannels if 
it is editable */
                        if (!(filter_mode & ANIMFILTER_FOREDIT) || 
EDITABLE_FCU(fcu)) {
                                /* only include this curve if selected in a way 
consistent with the filtering requirements */
-                               if ( ANIMCHANNEL_SELOK(SEL_FCU(fcu)) ) {
+                               if ( ANIMCHANNEL_SELOK(SEL_FCU(fcu)) && 
ANIMCHANNEL_SELEDITOK(SEL_FCU(fcu)) ) {
                                        /* only include if this curve is active 
*/
                                        if (!(filter_mode & ANIMFILTER_ACTIVE) 
|| (fcu->flag & FCURVE_ACTIVE)) {
                                                ale= make_new_animlistelem(fcu, 
ANIMTYPE_FCURVE, owner, ownertype, owner_id);
@@ -1628,10 +1646,10 @@
                                                dataOk= 0;
                                                break;
                                }
-
+                               
                                /* particles */
                                partOk = 0;
-                               if(!(ads->filterflag & ADS_FILTER_NOPART) && 
ob->particlesystem.first) {
+                               if (!(ads->filterflag & ADS_FILTER_NOPART) && 
ob->particlesystem.first) {
                                        ParticleSystem *psys = 
ob->particlesystem.first;
                                        for(; psys; psys=psys->next) {
                                                if (psys->part) {
@@ -1653,7 +1671,6 @@
                                                        break;
                                        }
                                }
-
                                
                                /* check if all bad (i.e. nothing to show) */
                                if (!actOk && !keyOk && !dataOk && !matOk && 
!partOk)
@@ -1705,17 +1722,16 @@
                                                dataOk= 0;
                                                break;
                                }
-
+                               
                                /* particles */
                                partOk = 0;
-                               if(ob->particlesystem.first) {
+                               if (ob->particlesystem.first) {
                                        ParticleSystem *psys = 
ob->particlesystem.first;
                                        for(; psys; psys=psys->next) {
                                                if(psys->part && 
ANIMDATA_HAS_KEYS(psys->part)) {
                                                        partOk = 1;
                                                        break;
                                                }
-
                                        }
                                }
                                

Modified: 
branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h    
2009-07-28 06:26:10 UTC (rev 21962)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h    
2009-07-28 06:50:30 UTC (rev 21963)
@@ -30,15 +30,18 @@
 #define ED_ANIM_API_H
 
 struct ID;
-struct Scene;
 struct ListBase;
+struct AnimData;
+
 struct bContext;
 struct wmWindowManager;
 struct ScrArea;
 struct ARegion;
 struct View2D;
-struct gla2DDrawInfo;
+
+struct Scene;
 struct Object;
+
 struct bActionGroup;
 struct FCurve;
 struct FModifier;
@@ -88,18 +91,19 @@
 typedef struct bAnimListElem {
        struct bAnimListElem *next, *prev;
        
-       void    *data;          /* source data this elem represents */
-       int     type;           /* one of the ANIMTYPE_* values */
-       int             flag;           /* copy of elem's flags for quick 
access */
-       int     index;          /* copy of adrcode where applicable */
+       void    *data;                  /* source data this elem represents */
+       int     type;                   /* one of the ANIMTYPE_* values */
+       int             flag;                   /* copy of elem's flags for 
quick access */
+       int     index;                  /* copy of adrcode where applicable */
        
-       void    *key_data;      /* motion data - mostly F-Curves, but can be 
other types too */
-       short   datatype;       /* type of motion data to expect */
+       void    *key_data;              /* motion data - mostly F-Curves, but 
can be other types too */
+       short   datatype;               /* type of motion data to expect */
        
-       struct ID *id;          /* ID block that channel is attached to (may be 
used  */
+       struct ID *id;                  /* ID block that channel is attached to 
*/
+       struct AnimData *adt;   /* source of the animation data attached to ID 
block (for convenience) */
        
-       void    *owner;         /* group or channel which acts as this 
channel's owner */
-       short   ownertype;      /* type of owner */
+       void    *owner;                 /* group or channel which acts as this 
channel's owner */
+       short   ownertype;              /* type of owner */
 } bAnimListElem;
 
 
@@ -166,6 +170,7 @@
        ANIMFILTER_ACTIVE               = (1<<8),       /* channel should be 
'active' */
        ANIMFILTER_ANIMDATA             = (1<<9),       /* only return the 
underlying AnimData blocks (not the tracks, etc.) data comes from */
        ANIMFILTER_NLATRACKS    = (1<<10),      /* only include NLA-tracks */
+       ANIMFILTER_SELEDIT              = (1<<11),      /* link editability 
with selected status */
 } eAnimFilter_Flags;
 
 
@@ -341,9 +346,6 @@
 /* Obtain the AnimData block providing NLA-scaling for the given channel if 
applicable */
 struct AnimData *ANIM_nla_mapping_get(bAnimContext *ac, bAnimListElem *ale);
 

@@ 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