Revision: 26202
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26202
Author:   aligorith
Date:     2010-01-23 00:51:31 +0100 (Sat, 23 Jan 2010)

Log Message:
-----------
Graph Editor: Bugfixes for option where only the keyframes of selected F-Curves 
are shown

* Selected keyframes in unselected F-Curves were still being modified, although 
not shown
* Selection tools for keyframes were changing the selection status of F-Curves, 
making keyframes sometimes disappear after trying to select another keyframe

* Warning fixes in a few other files

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/armature.c
    trunk/blender/source/blender/blenkernel/intern/curve.c
    trunk/blender/source/blender/editors/animation/anim_filter.c
    trunk/blender/source/blender/editors/space_graph/graph_select.c
    trunk/blender/source/blender/makesrna/intern/rna_action.c

Modified: trunk/blender/source/blender/blenkernel/intern/armature.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/armature.c   2010-01-22 
21:57:41 UTC (rev 26201)
+++ trunk/blender/source/blender/blenkernel/intern/armature.c   2010-01-22 
23:51:31 UTC (rev 26202)
@@ -1480,7 +1480,6 @@
        bPose *pose= ob->pose, *frompose= from->pose;
        bPoseChannel *pchan, *pchanp, pchanw;
        bConstraint *con;
-       AnimData *adt, *fromadt;
        int error = 0;
        
        if (frompose==NULL) return;

Modified: trunk/blender/source/blender/blenkernel/intern/curve.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/curve.c      2010-01-22 
21:57:41 UTC (rev 26201)
+++ trunk/blender/source/blender/blenkernel/intern/curve.c      2010-01-22 
23:51:31 UTC (rev 26202)
@@ -2325,7 +2325,7 @@
 
 /*
  *   handlecodes:
- *             1: nothing,  1:auto,  2:vector,  3:aligned
+ *             0: nothing,  1:auto,  2:vector,  3:aligned
  */
 
 /* mode: is not zero when FCurve, is 2 when forced horizontal for autohandles 
*/

Modified: trunk/blender/source/blender/editors/animation/anim_filter.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_filter.c        
2010-01-22 21:57:41 UTC (rev 26201)
+++ trunk/blender/source/blender/editors/animation/anim_filter.c        
2010-01-22 23:51:31 UTC (rev 26202)
@@ -442,11 +442,15 @@
                  
 /* 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
+ *
+ * checks here work as follows:
+ *     1) seledit off - don't need to consider the implications of this option
+ *     2) foredit off - we're not considering editing, so channel is ok still
+ *     3) test_func (i.e. selection test) - only if selected, this test will 
pass
  */
-// FIXME: this doesn't work cleanly yet...
 #define ANIMCHANNEL_SELEDITOK(test_func) \
                ( !(filter_mode & ANIMFILTER_SELEDIT) || \
-                 (filter_mode & ANIMFILTER_CHANNELS) || \
+                 !(filter_mode & ANIMFILTER_FOREDIT) || \
                  (test_func) )
 
 /* ----------- 'Private' Stuff --------------- */
@@ -952,6 +956,7 @@
                                 *      - group is expanded
                                 *      - we just need the F-Curves present
                                 */
+                               // FIXME: checking if groups are expanded is 
only valid if in one or other modes
                                if ( (!(filter_mode & ANIMFILTER_VISIBLE) || 
EXPANDED_AGRP(agrp)) || (filter_mode & ANIMFILTER_CURVESONLY) ) 
                                {
                                        /* for the Graph Editor, curves may be 
set to not be visible in the view to lessen clutter,
@@ -1804,6 +1809,14 @@
                return 0;
        }
        
+       /* augment the filter-flags with settings based on the dopesheet 
filterflags 
+        * so that some temp settings can get added automagically...
+        */
+       if (ads->filterflag & ADS_FILTER_SELEDIT) {
+               /* only selected F-Curves should get their keyframes considered 
for editability */
+               filter_mode |= ANIMFILTER_SELEDIT;
+       }
+       
        /* scene-linked animation */
        // TODO: sequencer, composite nodes - are we to include those here too?
        {

Modified: trunk/blender/source/blender/editors/space_graph/graph_select.c
===================================================================
--- trunk/blender/source/blender/editors/space_graph/graph_select.c     
2010-01-22 21:57:41 UTC (rev 26201)
+++ trunk/blender/source/blender/editors/space_graph/graph_select.c     
2010-01-22 23:51:31 UTC (rev 26202)
@@ -109,6 +109,7 @@
        bAnimListElem *ale;
        int filter;
        
+       SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
        BeztEditData bed;
        BeztEditFunc test_cb, sel_cb;
        
@@ -142,13 +143,18 @@
                /* Keyframes First */
                ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, sel_cb, 
NULL);
                
-               /* deactivate the F-Curve, and deselect if deselecting 
keyframes.
-                * otherwise select the F-Curve too since we've selected all 
the keyframes
-                */
-               if (sel == SELECT_SUBTRACT) 
-                       fcu->flag &= ~FCURVE_SELECTED;
-               else
-                       fcu->flag |= FCURVE_SELECTED;
+               /* only change selection of channel when the visibility of 
keyframes doesn't depend on this */
+               if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) {
+                       /* deactivate the F-Curve, and deselect if deselecting 
keyframes.
+                        * otherwise select the F-Curve too since we've 
selected all the keyframes
+                        */
+                       if (sel == SELECT_SUBTRACT) 
+                               fcu->flag &= ~FCURVE_SELECTED;
+                       else
+                               fcu->flag |= FCURVE_SELECTED;
+               }
+               
+               /* always deactivate all F-Curves if we perform batch ops for 
selection */
                fcu->flag &= ~FCURVE_ACTIVE;
        }
        
@@ -214,6 +220,7 @@
        bAnimListElem *ale;
        int filter;
        
+       SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
        BeztEditData bed;
        BeztEditFunc ok_cb, select_cb;
        View2D *v2d= &ac->ar->v2d;
@@ -264,9 +271,12 @@
                        /* select keyframes that are in the appropriate places 
*/
                        ANIM_fcurve_keys_bezier_loop(&bed, fcu, ok_cb, 
select_cb, NULL);
                        
-                       /* select the curve too now that curve will be touched 
*/
-                       if (selectmode == SELECT_ADD)
-                               fcu->flag |= FCURVE_SELECTED;
+                       /* only change selection of channel when the visibility 
of keyframes doesn't depend on this */
+                       if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) {
+                               /* select the curve too now that curve will be 
touched */
+                               if (selectmode == SELECT_ADD)
+                                       fcu->flag |= FCURVE_SELECTED;
+                       }
                }
                
                /* un-apply NLA mapping from all the keyframes */
@@ -290,7 +300,7 @@
        if (ANIM_animdata_get_context(C, &ac) == 0)
                return OPERATOR_CANCELLED;
 
-       if(RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT)
+       if (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT)
                selectmode= SELECT_ADD;
        else
                selectmode= SELECT_SUBTRACT;
@@ -584,7 +594,7 @@
         *        include the 'only selected' flag...
         */
        filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | 
ANIMFILTER_CURVESONLY);
-       if (sipo->flag & SIPO_SELCUVERTSONLY) 
+       if (sipo->flag & SIPO_SELCUVERTSONLY)   // FIXME: this should really be 
check for by the filtering code...
                filter |= ANIMFILTER_SEL;
        ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
        
@@ -670,6 +680,7 @@
 /* option 1) select keyframe directly under mouse */
 static void mouse_graph_keys (bAnimContext *ac, int mval[], short select_mode, 
short curves_only)
 {
+       SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
        FCurve *fcu;
        BezTriple *bezt;
        short handle;
@@ -687,9 +698,15 @@
                /* reset selection mode */
                select_mode= SELECT_ADD;
                
-               /* deselect all other channels and keyframes */
-               //ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, 
ACHANNEL_SETFLAG_CLEAR);
+               /* deselect all other keyframes */
                deselect_graph_keys(ac, 0, SELECT_SUBTRACT);
+               
+               /* deselect other channels too, but only only do this if 
+                * selection of channel when the visibility of keyframes 
+                * doesn't depend on this 
+                */
+               if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0)
+                       ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, 
ACHANNEL_SETFLAG_CLEAR);
        }
        
        /* if points can be selected on this F-Curve */
@@ -746,16 +763,19 @@
                ANIM_fcurve_keys_bezier_loop(&bed, fcu, NULL, select_cb, NULL);
        }
        
-       /* select or deselect curve? */
-       if (select_mode == SELECT_INVERT)
-               fcu->flag ^= FCURVE_SELECTED;
-       else if (select_mode == SELECT_ADD)
-               fcu->flag |= FCURVE_SELECTED;
-               
-       /* set active F-Curve (NOTE: sync the filter flags with 
findnearest_fcurve_vert) */
-       if (fcu->flag & FCURVE_SELECTED) {
-               filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | 
ANIMFILTER_CURVESONLY);
-               ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, 
fcu, ANIMTYPE_FCURVE);
+       /* only change selection of channel when the visibility of keyframes 
doesn't depend on this */
+       if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) {
+               /* select or deselect curve? */
+               if (select_mode == SELECT_INVERT)
+                       fcu->flag ^= FCURVE_SELECTED;
+               else if (select_mode == SELECT_ADD)
+                       fcu->flag |= FCURVE_SELECTED;
+                       
+               /* set active F-Curve (NOTE: sync the filter flags with 
findnearest_fcurve_vert) */
+               if (fcu->flag & FCURVE_SELECTED) {
+                       filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | 
ANIMFILTER_CURVESONLY);
+                       ANIM_set_active_channel(ac, ac->data, ac->datatype, 
filter, fcu, ANIMTYPE_FCURVE);
+               }
        }
 }
 
@@ -766,6 +786,7 @@
        bAnimListElem *ale;
        int filter;
        
+       SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
        BeztEditFunc ok_cb, select_cb;
        BeztEditData bed;
        Scene *scene= ac->scene;
@@ -775,9 +796,15 @@
                /* reset selection mode to add to selection */
                select_mode= SELECT_ADD;
                
-               /* deselect all other channels and keyframes */
-               ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, 
ACHANNEL_SETFLAG_CLEAR);
+               /* deselect all other keyframes */
                deselect_graph_keys(ac, 0, SELECT_SUBTRACT);
+               
+               /* deselect other channels too, but only only do this if 
+                * selection of channel when the visibility of keyframes 
+                * doesn't depend on this 
+                */
+               if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0)
+                       ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, 
ACHANNEL_SETFLAG_CLEAR);
        }
        
        /* set callbacks and editing data */
@@ -822,6 +849,7 @@
        bAnimListElem *ale;
        int filter;
        
+       SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
        BeztEditFunc select_cb, ok_cb;
        BeztEditData bed;
        FCurve *fcu;
@@ -841,9 +869,15 @@
                /* reset selection mode to add to selection */
                select_mode= SELECT_ADD;
                
-               /* deselect all other channels and keyframes */
-               ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, 
ACHANNEL_SETFLAG_CLEAR);
+               /* deselect all other keyframes */
                deselect_graph_keys(ac, 0, SELECT_SUBTRACT);
+               
+               /* deselect other channels too, but only only do this if 
+                * selection of channel when the visibility of keyframes 
+                * doesn't depend on this 
+                */
+               if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0)
+                       ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, 
ACHANNEL_SETFLAG_CLEAR);
        }
        
        /* initialise keyframe editing data */

Modified: trunk/blender/source/blender/makesrna/intern/rna_action.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_action.c   2010-01-22 
21:57:41 UTC (rev 26201)
+++ trunk/blender/source/blender/makesrna/intern/rna_action.c   2010-01-22 
23:51:31 UTC (rev 26202)
@@ -80,12 +80,7 @@
        RNA_def_property_boolean_sdna(prop, NULL, "filterflag", 
ADS_FILTER_ONLYNLA);
        RNA_def_property_ui_text(prop, "Only NLA", "Only include NLA data from 
Animation data.");

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