Revision: 21118
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21118
Author:   aligorith
Date:     2009-06-24 03:41:12 +0200 (Wed, 24 Jun 2009)

Log Message:
-----------
NLA SoC: Fixes for segfaults during NLA Transforms 

The snapping code was incorrectly assuming that td->extra was always AnimData, 
but for NLA this is incorrect as it is used for special data used for checking 
back.

Modified Paths:
--------------
    branches/soc-2009-aligorith/source/blender/editors/transform/transform.c
    
branches/soc-2009-aligorith/source/blender/editors/transform/transform_conversions.c

Modified: 
branches/soc-2009-aligorith/source/blender/editors/transform/transform.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/transform/transform.c    
2009-06-24 01:04:01 UTC (rev 21117)
+++ branches/soc-2009-aligorith/source/blender/editors/transform/transform.c    
2009-06-24 01:41:12 UTC (rev 21118)
@@ -4470,10 +4470,11 @@
        
        /* it doesn't matter whether we apply to t->data or t->data2d, but 
t->data2d is more convenient */
        for (i = 0 ; i < t->total; i++, td++) {
-               /* it is assumed that td->ob is a pointer to the object,
+               /* it is assumed that td->extra is a pointer to the AnimData,
                 * whose active action is where this keyframe comes from 
+                * (this is only valid when not in NLA)
                 */
-               AnimData *adt= td->extra;
+               AnimData *adt= (t->spacetype != SPACE_NLA) ? td->extra : NULL;
                
                /* check if any need to apply nla-mapping */
                if (adt) {
@@ -4606,8 +4607,9 @@
        for (i = 0 ; i < t->total; i++, td++) {
                /* it is assumed that td->extra is a pointer to the AnimData,
                 * whose active action is where this keyframe comes from 
+                * (this is only valid when not in NLA)
                 */
-               AnimData *adt= td->extra;
+               AnimData *adt= (t->spacetype != SPACE_NLA) ? td->extra : NULL;
                float cval = t->values[0];
                
                /* apply NLA-mapping to necessary values */
@@ -4709,8 +4711,9 @@
        for (i = 0 ; i < t->total; i++, td++) {
                /* it is assumed that td->extra is a pointer to the AnimData,
                 * whose active action is where this keyframe comes from 
+                * (this is only valid when not in NLA)
                 */
-               AnimData *adt= td->extra;
+               AnimData *adt= (t->spacetype != SPACE_NLA) ? td->extra : NULL;
                float startx= CFRA;
                float fac= t->values[0];
                
@@ -4745,18 +4748,6 @@
        sval= t->imval[0];
        cval= mval[0];
        
-       // XXX ewww... we need a better factor!
-#if 0 // TRANSFORM_FIX_ME              
-       switch (t->spacetype) {
-               case SPACE_ACTION:
-                       width= ACTWIDTH;
-                       break;
-               case SPACE_NLA:
-                       width= NLAWIDTH;
-                       break;
-       }
-#endif
-       
        /* calculate scaling factor */
        startx= sval-(width/2+(t->ar->winx)/2);
        deltax= cval-(width/2+(t->ar->winx)/2);

Modified: 
branches/soc-2009-aligorith/source/blender/editors/transform/transform_conversions.c
===================================================================
--- 
branches/soc-2009-aligorith/source/blender/editors/transform/transform_conversions.c
        2009-06-24 01:04:01 UTC (rev 21117)
+++ 
branches/soc-2009-aligorith/source/blender/editors/transform/transform_conversions.c
        2009-06-24 01:41:12 UTC (rev 21118)
@@ -3271,7 +3271,7 @@
                 * higher scaling ratios, but is faster than converting all 
points) 
                 */
                if (adt) 
-                       cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, 1);
+                       cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, 0);
                else
                        cfra = (float)CFRA;
                
@@ -3330,7 +3330,7 @@
                 * higher scaling ratios, but is faster than converting all 
points) 
                 */
                if (adt) 
-                       cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, 1);
+                       cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, 0);
                else
                        cfra = (float)CFRA;
                


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

Reply via email to