2.5 - Bugfixes
authorJoshua Leung <aligorith@gmail.com>
Mon, 22 Dec 2008 22:59:48 +0000 (22:59 +0000)
committerJoshua Leung <aligorith@gmail.com>
Mon, 22 Dec 2008 22:59:48 +0000 (22:59 +0000)
* View Pan Operator now stores area, etc. values from context in case user moves out of view
* Moved the invalid-context check for Action Editor so that mode can still be changed when there's no data to show.

source/blender/editors/interface/view2d.c
source/blender/editors/interface/view2d_ops.c
source/blender/editors/space_action/action_header.c

index 3d8b4fa959addac879a178da91f2afe4a19f0e40..f827d68f697064466b87d14ab092ab1659d72eea 100644 (file)
@@ -562,7 +562,7 @@ void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag)
                return;
                
        /* check if doing within area syncing (i.e. channels/vertical) */
-       if (v2dcur->flag & V2D_VIEWSYNC_AREA_VERTICAL) {
+       if ((v2dcur->flag & V2D_VIEWSYNC_AREA_VERTICAL) && (area)) {
                for (ar= area->regionbase.first; ar; ar= ar->next) {
                        /* don't operate on self */
                        if (v2dcur != &ar->v2d) {
@@ -587,7 +587,7 @@ void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag)
        }
        
        /* check if doing whole screen syncing (i.e. time/horizontal) */
-       if (v2dcur->flag & V2D_VIEWSYNC_SCREEN_TIME) {
+       if ((v2dcur->flag & V2D_VIEWSYNC_SCREEN_TIME) && (screen)) {
                for (sa= screen->areabase.first; sa; sa= sa->next) {
                        for (ar= sa->regionbase.first; ar; ar= ar->next) {
                                /* don't operate on self */
index e6dbcd60023aad04ac610a2d81580fd39b8504ed..132413477f1516b574a67cae4afd063e6a32733c 100644 (file)
@@ -101,6 +101,8 @@ static short mouse_in_v2d_scrollers (const bContext *C, View2D *v2d, int x, int
  
 /* temp customdata for operator */
 typedef struct v2dViewPanData {
+       bScreen *sc;                    /* screen where view pan was initiated */
+       ScrArea *sa;                    /* area where view pan was initiated */
        View2D *v2d;                    /* view2d we're operating in */
        
        float facx, facy;               /* amount to move view relative to zoom */
@@ -129,6 +131,8 @@ static int view_pan_init(bContext *C, wmOperator *op)
        op->customdata= vpd;
        
        /* set pointers to owners */
+       vpd->sc= CTX_wm_screen(C);
+       vpd->sa= CTX_wm_area(C);
        vpd->v2d= v2d= &ar->v2d;
        
        /* calculate translation factor - based on size of view */
@@ -165,8 +169,8 @@ static void view_pan_apply(bContext *C, wmOperator *op)
        UI_view2d_curRect_validate(v2d);
        
        /* request updates to be done... */
-       ED_area_tag_redraw(CTX_wm_area(C));
-       UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
+       ED_area_tag_redraw(vpd->sa);
+       UI_view2d_sync(vpd->sc, vpd->sa, v2d, V2D_LOCK_COPY);
 }
 
 /* cleanup temp customdata  */
index a81e95f7dc91ce05efd4dde29776317826826c6b..635a40037b375d04cc0c361782a4c4e877827df3 100644 (file)
@@ -329,66 +329,68 @@ void action_header_buttons(const bContext *C, ARegion *ar)
        uiBlockSetEmboss(block, UI_EMBOSS);
        
        /* get context... (also syncs data) */
-       if ((ANIM_animdata_get_context(C, &ac)) && (ac.data)) { 
-               if ((sa->flag & HEADER_NO_PULLDOWN)==0) {
-                       /* pull down menus */
-                       uiBlockSetEmboss(block, UI_EMBOSSP);
-                       
-                       xmax= GetButStringLength("View");
-                       uiDefPulldownBut(block, action_viewmenu, CTX_wm_area(C), 
-                                                 "View", xco, yco, xmax-3, 24, "");
-                       xco+= xmax;
-                       
-                       xmax= GetButStringLength("Select");
-                       uiDefPulldownBut(block, action_selectmenu, CTX_wm_area(C), 
-                                                 "Select", xco, yco, xmax-3, 24, "");
+       ANIM_animdata_get_context(C, &ac);
+       
+       if ((sa->flag & HEADER_NO_PULLDOWN)==0) {
+               /* pull down menus */
+               uiBlockSetEmboss(block, UI_EMBOSSP);
+               
+               xmax= GetButStringLength("View");
+               uiDefPulldownBut(block, action_viewmenu, CTX_wm_area(C), 
+                                         "View", xco, yco, xmax-3, 24, "");
+               xco+= xmax;
+               
+               xmax= GetButStringLength("Select");
+               uiDefPulldownBut(block, action_selectmenu, CTX_wm_area(C), 
+                                         "Select", xco, yco, xmax-3, 24, "");
+               xco+= xmax;
+               
+               if ( (saction->mode == SACTCONT_DOPESHEET) ||
+                        ((saction->action) && (saction->mode==SACTCONT_ACTION)) ) 
+               {
+                       xmax= GetButStringLength("Channel");
+                       uiDefPulldownBut(block, action_channelmenu, CTX_wm_area(C), 
+                                                 "Channel", xco, yco, xmax-3, 24, "");
                        xco+= xmax;
-                       
-                       if ( (saction->mode == SACTCONT_DOPESHEET) ||
-                                ((saction->action) && (saction->mode==SACTCONT_ACTION)) ) 
-                       {
-                               xmax= GetButStringLength("Channel");
-                               uiDefPulldownBut(block, action_channelmenu, CTX_wm_area(C), 
-                                                         "Channel", xco, yco, xmax-3, 24, "");
-                               xco+= xmax;
-                       }
-                       else if (saction->mode==SACTCONT_GPENCIL) {
-                               xmax= GetButStringLength("Channel");
-                               uiDefPulldownBut(block, action_gplayermenu, CTX_wm_area(C), 
-                                                         "Channel", xco, yco, xmax-3, 24, "");
-                               xco+= xmax;
-                       }
-                       
-                       xmax= GetButStringLength("Marker");
-                       uiDefPulldownBut(block, action_markermenu, CTX_wm_area(C), 
-                                                 "Marker", xco, yco, xmax-3, 24, "");
+               }
+               else if (saction->mode==SACTCONT_GPENCIL) {
+                       xmax= GetButStringLength("Channel");
+                       uiDefPulldownBut(block, action_gplayermenu, CTX_wm_area(C), 
+                                                 "Channel", xco, yco, xmax-3, 24, "");
                        xco+= xmax;
-                       
-                       if (saction->mode == SACTCONT_GPENCIL) {
-                               xmax= GetButStringLength("Frame");
-                               uiDefPulldownBut(block, action_framemenu, CTX_wm_area(C), 
-                                                         "Frame", xco, yco, xmax-3, 24, "");
-                               xco+= xmax;
-                       }
-                       else {
-                               xmax= GetButStringLength("Key");
-                               uiDefPulldownBut(block, action_keymenu, CTX_wm_area(C), 
-                                                         "Key", xco, yco, xmax-3, 24, "");
-                               xco+= xmax;
-                       }
                }
-
-               uiBlockSetEmboss(block, UI_EMBOSS);
-               
-               /* MODE SELECTOR */
-               uiDefButC(block, MENU, B_REDR, 
-                               "Editor Mode %t|DopeSheet %x3|Action Editor %x0|ShapeKey Editor %x1|Grease Pencil %x2", 
-                               xco,yco,90,YIC, &saction->mode, 0, 1, 0, 0, 
-                               "Editing modes for this editor");
-
                
-               xco += (90 + 8);
+               xmax= GetButStringLength("Marker");
+               uiDefPulldownBut(block, action_markermenu, CTX_wm_area(C), 
+                                         "Marker", xco, yco, xmax-3, 24, "");
+               xco+= xmax;
                
+               if (saction->mode == SACTCONT_GPENCIL) {
+                       xmax= GetButStringLength("Frame");
+                       uiDefPulldownBut(block, action_framemenu, CTX_wm_area(C), 
+                                                 "Frame", xco, yco, xmax-3, 24, "");
+                       xco+= xmax;
+               }
+               else {
+                       xmax= GetButStringLength("Key");
+                       uiDefPulldownBut(block, action_keymenu, CTX_wm_area(C), 
+                                                 "Key", xco, yco, xmax-3, 24, "");
+                       xco+= xmax;
+               }
+       }
+
+       uiBlockSetEmboss(block, UI_EMBOSS);
+       
+       /* MODE SELECTOR */
+       uiDefButC(block, MENU, B_REDR, 
+                       "Editor Mode %t|DopeSheet %x3|Action Editor %x0|ShapeKey Editor %x1|Grease Pencil %x2", 
+                       xco,yco,90,YIC, &saction->mode, 0, 1, 0, 0, 
+                       "Editing modes for this editor");
+       
+       
+       xco += (90 + 8);
+       
+       if (ac.data) {
                /* MODE-DEPENDENT DRAWING */
                if (saction->mode == SACTCONT_DOPESHEET) {
                        /* FILTERING OPTIONS */