From 892be750e58e9824b573a86d8a2c49e43ddbbfd3 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Mon, 22 Dec 2008 22:59:48 +0000 Subject: 2.5 - Bugfixes * 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 | 4 +- source/blender/editors/interface/view2d_ops.c | 8 +- .../blender/editors/space_action/action_header.c | 112 +++++++++++---------- 3 files changed, 65 insertions(+), 59 deletions(-) (limited to 'source') diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 3d8b4fa959a..f827d68f697 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -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 */ diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index e6dbcd60023..132413477f1 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -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 */ diff --git a/source/blender/editors/space_action/action_header.c b/source/blender/editors/space_action/action_header.c index a81e95f7dc9..635a40037b3 100644 --- a/source/blender/editors/space_action/action_header.c +++ b/source/blender/editors/space_action/action_header.c @@ -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 */ -- cgit v1.2.3