Revision: 18142
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18142
Author:   aligorith
Date:     2008-12-29 08:19:16 +0100 (Mon, 29 Dec 2008)

Log Message:
-----------
2.5 - Action Editor Transforms now work again

Note: there were some crashes that would occur if context was not reset 
everytime the modal callback was run. Probably there's something about the 
context info we need to be more careful about.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c
    branches/blender2.5/blender/source/blender/editors/space_action/action_ops.c
    branches/blender2.5/blender/source/blender/editors/transform/transform.c
    
branches/blender2.5/blender/source/blender/editors/transform/transform_conversions.c
    
branches/blender2.5/blender/source/blender/editors/transform/transform_generics.c
    branches/blender2.5/blender/source/blender/editors/transform/transform_ops.c

Modified: 
branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c  
2008-12-29 06:22:45 UTC (rev 18141)
+++ branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c  
2008-12-29 07:19:16 UTC (rev 18142)
@@ -224,24 +224,26 @@
        ac->obact= (scene && scene->basact)?  scene->basact->object : NULL;
        ac->sa= sa;
        ac->ar= ar;
-       ac->spacetype= sa->spacetype;
-       ac->regiontype= ar->regiontype;
+       ac->spacetype= (sa) ? sa->spacetype : 0;
+       ac->regiontype= (ar) ? ar->regiontype : 0;
        
        /* context depends on editor we are currently in */
-       switch (sa->spacetype) {
-               case SPACE_ACTION:
-               {
-                       SpaceAction *saction= (SpaceAction 
*)CTX_wm_space_data(C);
-                       ok= actedit_get_context(C, ac, saction);
+       if (sa) {
+               switch (sa->spacetype) {
+                       case SPACE_ACTION:
+                       {
+                               SpaceAction *saction= (SpaceAction 
*)CTX_wm_space_data(C);
+                               ok= actedit_get_context(C, ac, saction);
+                       }
+                               break;
+                               
+                       case SPACE_IPO:
+                       {
+                               SpaceIpo *sipo= (SpaceIpo 
*)CTX_wm_space_data(C);
+                               ok= ipoedit_get_context(C, ac, sipo);
+                       }
+                               break;
                }
-                       break;
-                       
-               case SPACE_IPO:
-               {
-                       SpaceIpo *sipo= (SpaceIpo *)CTX_wm_space_data(C);
-                       ok= ipoedit_get_context(C, ac, sipo);
-               }
-                       break;
        }
        
        /* check if there's any valid data */

Modified: 
branches/blender2.5/blender/source/blender/editors/space_action/action_ops.c
===================================================================
--- 
branches/blender2.5/blender/source/blender/editors/space_action/action_ops.c    
    2008-12-29 06:22:45 UTC (rev 18141)
+++ 
branches/blender2.5/blender/source/blender/editors/space_action/action_ops.c    
    2008-12-29 07:19:16 UTC (rev 18142)
@@ -46,6 +46,8 @@
 #include "UI_interface.h"
 #include "UI_view2d.h"
 
+#include "BIF_transform.h"
+
 #include "action_intern.h"
 
 #include "RNA_access.h"
@@ -82,7 +84,7 @@
 
 /* ************************** registration - keymaps 
**********************************/
 
-static void action_keymap_keyframes (ListBase *keymap)
+static void action_keymap_keyframes (wmWindowManager *wm, ListBase *keymap)
 {
        /* action_select.c - selection tools */
                /* click-select */
@@ -124,6 +126,9 @@
        
        WM_keymap_add_item(keymap, "ACT_OT_keyframes_delete", XKEY, KM_PRESS, 
0, 0);
        WM_keymap_add_item(keymap, "ACT_OT_keyframes_delete", DELKEY, KM_PRESS, 
0, 0);
+       
+       /* transform system */
+       transform_keymap_for_space(wm, keymap, SPACE_ACTION);
 }
 
 /* --------------- */
@@ -137,6 +142,6 @@
        
        /* keyframes */
        keymap= WM_keymap_listbase(wm, "Action_Keys", SPACE_ACTION, 0);
-       action_keymap_keyframes(keymap);
+       action_keymap_keyframes(wm, keymap);
 }
 

Modified: 
branches/blender2.5/blender/source/blender/editors/transform/transform.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/transform/transform.c    
2008-12-29 06:22:45 UTC (rev 18141)
+++ branches/blender2.5/blender/source/blender/editors/transform/transform.c    
2008-12-29 07:19:16 UTC (rev 18142)
@@ -469,7 +469,7 @@
                ED_area_tag_redraw(t->sa);
        }
        else if (t->spacetype == SPACE_ACTION) {
-               SpaceAction *saction= (SpaceAction 
*)CTX_wm_space_data(t->context);
+               SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
                
                // TRANSFORM_FIX_ME
                if (saction->lock) {
@@ -4263,7 +4263,7 @@
        
        /* currently, some of these are only for the action editor */
        if (t->spacetype == SPACE_ACTION) {
-               SpaceAction *saction= (SpaceAction 
*)CTX_wm_space_data(t->context);
+               SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
                
                if (saction) {
                        switch (saction->autosnap) {
@@ -4290,7 +4290,7 @@
                }
        }
        else if (t->spacetype == SPACE_NLA) {
-               SpaceNla *snla= (SpaceNla *)CTX_wm_space_data(t->context);
+               SpaceNla *snla= (SpaceNla *)t->sa->spacedata.first;
                
                if (snla) {
                        switch (snla->autosnap) {
@@ -4340,12 +4340,12 @@
        
        /* currently, some of these are only for the action editor */
        if (t->spacetype == SPACE_ACTION) {
-               SpaceAction *saction= (SpaceAction 
*)CTX_wm_space_data(t->context);
+               SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
                
                drawtime = (saction->flag & SACTION_DRAWTIME)? 1 : 0;
        }
        else if (t->spacetype == SPACE_NLA) {
-               SpaceNla *snla= (SpaceNla *)CTX_wm_space_data(t->context);
+               SpaceNla *snla= (SpaceNla *)t->sa->spacedata.first;
                
                drawtime = (snla->flag & SNLA_DRAWTIME)? 1 : 0;
        }
@@ -4548,7 +4548,7 @@
 {
        /* this tool is only really available in the Action Editor... */
        if (t->spacetype == SPACE_ACTION) {
-               SpaceAction *saction= (SpaceAction 
*)CTX_wm_space_data(t->context);
+               SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
                
                /* set flag for drawing stuff */
                saction->flag |= SACTION_MOVING;
@@ -4576,9 +4576,9 @@
                outputNumInput(&(t->num), tvec);
        }
        else {
-               const float minx= *((float *)(t->customData));
-               const float maxx= *((float *)(t->customData) + 1);
-               const float cval= t->fac;
+               float minx= *((float *)(t->customData));
+               float maxx= *((float *)(t->customData) + 1);
+               float cval= t->fac;
                float val;
                        
                val= 2.0f*(cval-sval) / (maxx-minx);
@@ -4598,17 +4598,11 @@
        float minx= *((float *)(t->customData));
        float maxx= *((float *)(t->customData) + 1);
        
-       
        /* set value for drawing black line */
        if (t->spacetype == SPACE_ACTION) {
-               SpaceAction *saction= (SpaceAction 
*)CTX_wm_space_data(t->context);
+               SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
                float cvalf = t->fac;
-
-#if 0 // TRANSFORM_FIX_ME              
-               if (NLA_ACTION_SCALED)
-                       cvalf= get_action_frame(OBACT, cvalf);
-#endif
-                       
+               
                saction->timeslide= cvalf;
        }
        
@@ -4658,7 +4652,7 @@
        t->fac= cval[0];
        
        /* handle numeric-input stuff */
-       t->vec[0] = 2.0*(cval[0]-sval[0]) / (maxx-minx);
+       t->vec[0] = 2.0f*(cval[0]-sval[0]) / (maxx-minx);
        applyNumInput(&t->num, &t->vec[0]);
        t->fac = (maxx-minx) * t->vec[0] / 2.0 + sval[0];
        

Modified: 
branches/blender2.5/blender/source/blender/editors/transform/transform_conversions.c
===================================================================
--- 
branches/blender2.5/blender/source/blender/editors/transform/transform_conversions.c
        2008-12-29 06:22:45 UTC (rev 18141)
+++ 
branches/blender2.5/blender/source/blender/editors/transform/transform_conversions.c
        2008-12-29 07:19:16 UTC (rev 18142)
@@ -3973,7 +3973,7 @@
        }
        
        if (t->spacetype == SPACE_ACTION) {
-               SpaceAction *saction= (SpaceAction 
*)CTX_wm_space_data(t->context);
+               SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
                Scene *scene= NULL;
                bAnimContext ac;
                
@@ -3984,8 +3984,8 @@
                }
                
                /* get pointers to useful data */
+               scene= ac.scene;
                ob = OBACT;
-               scene= ac.scene;
                
                if (ac.datatype == ANIMCONT_DOPESHEET) {
                        ListBase anim_data = {NULL, NULL};

Modified: 
branches/blender2.5/blender/source/blender/editors/transform/transform_generics.c
===================================================================
--- 
branches/blender2.5/blender/source/blender/editors/transform/transform_generics.c
   2008-12-29 06:22:45 UTC (rev 18141)
+++ 
branches/blender2.5/blender/source/blender/editors/transform/transform_generics.c
   2008-12-29 07:19:16 UTC (rev 18142)
@@ -730,7 +730,7 @@
        }
        else if(t->spacetype==SPACE_IMAGE)
        {
-               View2D *v2d = sa->spacedata.first;
+               View2D *v2d = sa->spacedata.first; // XXX no!
 
                t->view = v2d;
 
@@ -738,7 +738,8 @@
        }
        else
        {
-               t->view = NULL;
+               // XXX for now, get View2D  from the active region
+               t->view = &ar->v2d;
                
                t->around = V3D_CENTER;
        }

Modified: 
branches/blender2.5/blender/source/blender/editors/transform/transform_ops.c
===================================================================
--- 
branches/blender2.5/blender/source/blender/editors/transform/transform_ops.c    
    2008-12-29 06:22:45 UTC (rev 18141)
+++ 
branches/blender2.5/blender/source/blender/editors/transform/transform_ops.c    
    2008-12-29 07:19:16 UTC (rev 18142)
@@ -62,7 +62,11 @@
 static int transform_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
        TransInfo *t = op->customdata;
-
+       
+       /* need to set context here, otherwise we get crashes with things that 
use context */
+       // XXX this seems quite hackish - Aligorith
+       t->context= C;
+       
        transformEvent(t, event);
        
        transformApply(t);


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

Reply via email to