Revision: 19215
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19215
Author:   aligorith
Date:     2009-03-07 05:24:28 +0100 (Sat, 07 Mar 2009)

Log Message:
-----------
Animation Editors: Copy/Paste Keyframe changes

As was discussed by the team the other day, copying keyframes (to copy/paste 
buffer) in DopeSheet/Graph Editor no longer relies on the selection status of 
the F-Curves, but rather on the selected keyframes only. This should be less 
confusing...

However, pasting keyframes still relies on having F-Curves selected to aid in 
the channel-matching process. There is still a lot of room for improvement in 
this area though (as noted in the code!). 

Modified Paths:
--------------
    
branches/blender2.5/blender/source/blender/editors/animation/keyframes_general.c
    
branches/blender2.5/blender/source/blender/editors/space_action/action_edit.c
    branches/blender2.5/blender/source/blender/editors/space_graph/graph_edit.c

Modified: 
branches/blender2.5/blender/source/blender/editors/animation/keyframes_general.c
===================================================================
--- 
branches/blender2.5/blender/source/blender/editors/animation/keyframes_general.c
    2009-03-06 19:41:57 UTC (rev 19214)
+++ 
branches/blender2.5/blender/source/blender/editors/animation/keyframes_general.c
    2009-03-07 04:24:28 UTC (rev 19215)
@@ -420,13 +420,20 @@
        /* clear buffer first */
        free_anim_copybuf();
        
-       /* assume that each of these is an ipo-block */
+       /* assume that each of these is an F-Curve */
        for (ale= anim_data->first; ale; ale= ale->next) {
                FCurve *fcu= (FCurve *)ale->key_data;
                tAnimCopybufItem *aci;
                BezTriple *bezt, *newbuf;
                int i;
                
+               /* firstly, check if F-Curve has any selected keyframes
+                *      - skip if no selected keyframes found (so no need to 
create unnecessary copy-buffer data)
+                *      - this check should also eliminate any problems 
associated with using sample-data
+                */
+               if (ANIM_fcurve_keys_bezier_loop(NULL, fcu, NULL, 
ANIM_editkeyframes_ok(BEZT_OK_SELECTED), NULL) == 0)
+                       continue;
+               
                /* init copybuf item info */
                aci= MEM_callocN(sizeof(tAnimCopybufItem), "AnimCopybufItem");
                aci->id= ale->id;
@@ -436,7 +443,6 @@
                BLI_addtail(&animcopybuf, aci);
                
                /* add selected keyframes to buffer */
-               // XXX we don't cope with sample-data yet
                // TODO: currently, we resize array everytime we add a new vert 
- this works ok as long as it is assumed only a few keys are copied
                for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) {
                        if (BEZSELECTED(bezt)) {

Modified: 
branches/blender2.5/blender/source/blender/editors/space_action/action_edit.c
===================================================================
--- 
branches/blender2.5/blender/source/blender/editors/space_action/action_edit.c   
    2009-03-06 19:41:57 UTC (rev 19214)
+++ 
branches/blender2.5/blender/source/blender/editors/space_action/action_edit.c   
    2009-03-07 04:24:28 UTC (rev 19215)
@@ -248,7 +248,7 @@
        free_anim_copybuf();
        
        /* filter data */
-       filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY);
+       filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY);
        ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
        
        /* copy keyframes */

Modified: 
branches/blender2.5/blender/source/blender/editors/space_graph/graph_edit.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_graph/graph_edit.c 
2009-03-06 19:41:57 UTC (rev 19214)
+++ branches/blender2.5/blender/source/blender/editors/space_graph/graph_edit.c 
2009-03-07 04:24:28 UTC (rev 19215)
@@ -256,7 +256,7 @@
        free_anim_copybuf();
        
        /* filter data */
-       filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL 
| ANIMFILTER_CURVESONLY);
+       filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | 
ANIMFILTER_CURVESONLY);
        ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
        
        /* copy keyframes */
@@ -1011,6 +1011,50 @@
 /* ************************************************************************** 
*/
 /* TRANSFORM STUFF */
 
+/* ***************** 'Euler Filter' Operator **************************** */
+/* Euler filter tools (as seen in Maya), are necessary for working with 'baked'
+ * rotation curves (with Euler rotations). The main purpose of such tools is to
+ * resolve any discontinuities that may arise in the curves due to the clamping
+ * of values to -180 degrees to 180 degrees.
+ */
+
+static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op)
+{
+       bAnimContext ac;
+       //ListBase anim_data= {NULL, NULL};
+       //bAnimListElem *ale;
+       //int filter;
+       
+       /* get editor data */
+       if (ANIM_animdata_get_context(C, &ac) == 0)
+               return OPERATOR_CANCELLED;
+               
+       /* The process is done in two passes:
+        *       1) Sets of three related rotation curves are identified from 
the selected channels,
+        *              and are stored as a single 'operation unit' for the 
next step
+        *       2) Each set of three F-Curves is processed for each keyframe, 
with the values being
+        *              processed according to one of several ways.
+        */
+       
+       
+       // XXX for now
+       return OPERATOR_CANCELLED;
+}
+ 
+void GRAPHEDIT_OT_keyframes_euler_filter (wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "Euler Filter";
+       ot->idname= "GRAPHEDIT_OT_keyframes_euler_filter";
+       
+       /* api callbacks */
+       ot->exec= graphkeys_euler_filter_exec;
+       ot->poll= ED_operator_areaactive;
+       
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
 /* ***************** Snap Current Frame Operator *********************** */
 
 /* helper callback for graphkeys_cfrasnap_exec() -> used to help get the 
average time of all selected beztriples */


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

Reply via email to