Bug found by Bassam; in certain occasions reading a file calls setscreen()
without the (ugly) global curarea being set. Fixed the crash in his sample by nicely passing on 'current area' as argument.
This commit is contained in:
@@ -55,7 +55,7 @@ void ipoco_to_areaco_noclip (struct View2D *v2d, float *vec, short *mval);
|
||||
|
||||
void view2d_zoom (struct View2D *v2d, float factor, int winx, int winy);
|
||||
void test_view2d (struct View2D *v2d, int winx, int winy);
|
||||
void calc_scrollrcts (struct View2D *v2d, int winx, int winy);
|
||||
void calc_scrollrcts (struct ScrArea *sa, struct View2D *v2d, int winx, int winy);
|
||||
|
||||
int in_ipo_buttons(void);
|
||||
void drawscroll(int disptype);
|
||||
|
||||
@@ -612,7 +612,7 @@ void drawactionspace(ScrArea *sa, void *spacedata)
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) ;
|
||||
|
||||
calc_scrollrcts(G.v2d, curarea->winx, curarea->winy);
|
||||
calc_scrollrcts(sa, G.v2d, curarea->winx, curarea->winy);
|
||||
|
||||
/* background color for entire window (used in lefthand part tho) */
|
||||
BIF_GetThemeColor3fv(TH_HEADER, col);
|
||||
|
||||
@@ -565,21 +565,21 @@ void test_view2d(View2D *v2d, int winx, int winy)
|
||||
}
|
||||
|
||||
|
||||
void calc_scrollrcts(View2D *v2d, int winx, int winy)
|
||||
void calc_scrollrcts(ScrArea *sa, View2D *v2d, int winx, int winy)
|
||||
{
|
||||
v2d->mask.xmin= v2d->mask.ymin= 0;
|
||||
v2d->mask.xmax= winx;
|
||||
v2d->mask.ymax= winy;
|
||||
|
||||
if(curarea->spacetype==SPACE_ACTION) {
|
||||
if(sa->spacetype==SPACE_ACTION) {
|
||||
v2d->mask.xmin+= ACTWIDTH;
|
||||
v2d->hor.xmin+=ACTWIDTH;
|
||||
}
|
||||
else if(curarea->spacetype==SPACE_NLA){
|
||||
else if(sa->spacetype==SPACE_NLA){
|
||||
v2d->mask.xmin+= NLAWIDTH;
|
||||
v2d->hor.xmin+=NLAWIDTH;
|
||||
}
|
||||
else if(curarea->spacetype==SPACE_IPO) {
|
||||
else if(sa->spacetype==SPACE_IPO) {
|
||||
v2d->mask.xmax-= IPOBUTX;
|
||||
|
||||
if(v2d->mask.xmax<IPOBUTX)
|
||||
@@ -1642,7 +1642,7 @@ void drawipospace(ScrArea *sa, void *spacedata)
|
||||
uiFreeBlocksWin(&sa->uiblocks, sa->win); /* for panel handler to work */
|
||||
|
||||
v2d->hor.xmax+=IPOBUTX;
|
||||
calc_scrollrcts(G.v2d, sa->winx, sa->winy);
|
||||
calc_scrollrcts(sa, G.v2d, sa->winx, sa->winy);
|
||||
|
||||
BIF_GetThemeColor3fv(TH_BACK, col);
|
||||
glClearColor(col[0], col[1], col[2], 0.0);
|
||||
|
||||
@@ -537,7 +537,7 @@ void drawnlaspace(ScrArea *sa, void *spacedata)
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) ;
|
||||
|
||||
calc_scrollrcts(G.v2d, curarea->winx, curarea->winy);
|
||||
calc_scrollrcts(sa, G.v2d, curarea->winx, curarea->winy);
|
||||
|
||||
/* clear all, becomes the color for left part */
|
||||
BIF_GetThemeColor3fv(TH_HEADER, col);
|
||||
|
||||
@@ -405,7 +405,7 @@ void drawoopsspace(ScrArea *sa, void *spacedata)
|
||||
if(soops->type==SO_OUTLINER) draw_outliner(sa, soops);
|
||||
else {
|
||||
boundbox_oops();
|
||||
calc_scrollrcts(G.v2d, curarea->winx, curarea->winy);
|
||||
calc_scrollrcts(sa, G.v2d, curarea->winx, curarea->winy);
|
||||
|
||||
myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
|
||||
|
||||
|
||||
@@ -792,7 +792,7 @@ void drawseqspace(ScrArea *sa, void *spacedata)
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
calc_scrollrcts(G.v2d, curarea->winx, curarea->winy);
|
||||
calc_scrollrcts(sa, G.v2d, curarea->winx, curarea->winy);
|
||||
|
||||
if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) {
|
||||
if(G.v2d->scroll) {
|
||||
|
||||
@@ -200,7 +200,7 @@ void drawsoundspace(ScrArea *sa, void *spacedata)
|
||||
glClearColor(col[0], col[1], col[2], 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
calc_scrollrcts(G.v2d, curarea->winx, curarea->winy);
|
||||
calc_scrollrcts(sa, G.v2d, curarea->winx, curarea->winy);
|
||||
|
||||
if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) {
|
||||
if(G.v2d->scroll) {
|
||||
|
||||
@@ -2224,7 +2224,7 @@ void draw_outliner(ScrArea *sa, SpaceOops *soops)
|
||||
int sizey;
|
||||
short ofsx, ofsy;
|
||||
|
||||
calc_scrollrcts(G.v2d, sa->winx, sa->winy);
|
||||
calc_scrollrcts(sa, G.v2d, sa->winx, sa->winy);
|
||||
|
||||
if(sa->winx>SCROLLB+10 && sa->winy>SCROLLH+10) {
|
||||
if(G.v2d->scroll) {
|
||||
|
||||
@@ -3992,7 +3992,7 @@ void init_v2d_oops(ScrArea *sa, SpaceOops *soops)
|
||||
|
||||
if(soops->type==SO_OUTLINER) {
|
||||
/* outliner space is window size */
|
||||
calc_scrollrcts(v2d, sa->winx, sa->winy);
|
||||
calc_scrollrcts(sa, v2d, sa->winx, sa->winy);
|
||||
|
||||
v2d->tot.xmax= 0.0;
|
||||
v2d->tot.ymax= 0.0;
|
||||
|
||||
Reference in New Issue
Block a user