Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2007-08-01 15:38:47 +0400
committerJoshua Leung <aligorith@gmail.com>2007-08-01 15:38:47 +0400
commitc79e2666a22ab9da1b48645843cf7ceec19540c8 (patch)
tree2d945f9d46e392492fddd73dfe53ddcd44c6d0ce /source
parent9df1b7d1fb1c6ce320cfedfcfe54a39d05253273 (diff)
== Outliner - Patch #4364 ==
Now the Outliner can be scrolled horizontally too. This was the first patch I ever submitted, but it's gone through many revisions due to ugly Blender bugs that needed to be fixed. Code Notes: * I discovered an ancient bug which would cause Blender to hang when loading a file saved with horizontal scrollbars turned on for the Outliner/OOPS. * Therefore, I've added special B_SCROLLO and HOR_SCROLLO defines for use by the Outliner only. These are used in place of B_SCROLL and HOR_SCROLL so that older Blender's won't choke on this stuff. Thanks for this suggestion Ton. * The hanging occurred in draw_scroll in draw_ipo.c
Diffstat (limited to 'source')
-rw-r--r--source/blender/makesdna/DNA_screen_types.h4
-rw-r--r--source/blender/src/drawipo.c23
-rw-r--r--source/blender/src/outliner.c224
-rw-r--r--source/blender/src/space.c20
4 files changed, 173 insertions, 98 deletions
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index cf3c2eaa168..65374983af5 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -147,7 +147,9 @@ typedef struct ScrArea {
#define VERT_SCROLL 3
#define T_SCROLL 4
#define B_SCROLL 8
-#define HOR_SCROLL 12
+#define HOR_SCROLL 12
+#define B_SCROLLO 16 /* special hack for outliner hscroll - prevent hanging */
+#define HOR_SCROLLO 20 /* in older versions of blender */
/* Panel->snap - for snapping to screen edges */
#define PNL_SNAP_NONE 0
diff --git a/source/blender/src/drawipo.c b/source/blender/src/drawipo.c
index 633d1b1ee31..1bbec20cd49 100644
--- a/source/blender/src/drawipo.c
+++ b/source/blender/src/drawipo.c
@@ -512,6 +512,7 @@ void test_view2d(View2D *v2d, int winx, int winy)
/* correct winx for scroll */
if(v2d->scroll & L_SCROLL) winx-= SCROLLB;
if(v2d->scroll & B_SCROLL) winy-= SCROLLH;
+ if(v2d->scroll & B_SCROLLO) winy-= SCROLLH; /* B_SCROLL and B_SCROLLO are basically same thing */
/* header completely closed window */
if(winy<=0) return;
@@ -652,7 +653,7 @@ void test_view2d(View2D *v2d, int winx, int winy)
cur->xmin+= dx;
cur->xmax+= dx;
}
- else if(cur->xmax > tot->xmax) {
+ else if((v2d->keeptot!=2) && (cur->xmax > tot->xmax)) {
dx= cur->xmax-tot->xmax;
cur->xmin-= dx;
cur->xmax-= dx;
@@ -753,7 +754,7 @@ void calc_scrollrcts(ScrArea *sa, View2D *v2d, int winx, int winy)
v2d->mask.xmax= v2d->vert.xmin;
}
- if(v2d->scroll & B_SCROLL) {
+ if((v2d->scroll & B_SCROLL) || (v2d->scroll & B_SCROLLO)) {
v2d->hor= v2d->mask;
v2d->hor.ymax= SCROLLH;
v2d->mask.ymin= SCROLLH;
@@ -856,7 +857,7 @@ void drawscroll(int disptype)
light= 20;
lighter= 50;
- if(G.v2d->scroll & HOR_SCROLL) {
+ if((G.v2d->scroll & HOR_SCROLL) || (G.v2d->scroll & HOR_SCROLLO)) {
BIF_ThemeColorShade(TH_SHADE1, light);
glRecti(hor.xmin, hor.ymin, hor.xmax, hor.ymax);
@@ -890,7 +891,13 @@ void drawscroll(int disptype)
val= ipogrid_startx;
while(fac < hor.xmax) {
- if(curarea->spacetype==SPACE_OOPS);
+ if(curarea->spacetype==SPACE_OOPS) {
+ /* Under no circumstances may the outliner/oops display numbers on its scrollbar
+ * Unfortunately, versions of Blender without this patch will hang on loading files with
+ * horizontally scrollable Outliners.
+ */
+ break;
+ }
else if(curarea->spacetype==SPACE_SEQ) {
SpaceSeq * sseq = curarea->spacedata.first;
if (sseq->flag & SEQ_DRAWFRAMES) {
@@ -2491,13 +2498,7 @@ int view2dmove(unsigned short event)
}
cursor = BC_NSEW_SCROLLCURSOR;
-
- /* no x move in outliner */
- if(curarea->spacetype==SPACE_OOPS && G.v2d->scroll) {
- facx= 0.0;
- cursor = BC_NS_SCROLLCURSOR;
- }
-
+
/* no y move in audio & time */
if ELEM(curarea->spacetype, SPACE_SOUND, SPACE_TIME) {
facy= 0.0;
diff --git a/source/blender/src/outliner.c b/source/blender/src/outliner.c
index 271d002e464..34e2798e58b 100644
--- a/source/blender/src/outliner.c
+++ b/source/blender/src/outliner.c
@@ -261,6 +261,20 @@ static void outliner_height(SpaceOops *soops, ListBase *lb, int *h)
}
}
+static void outliner_width(SpaceOops *soops, ListBase *lb, int *w)
+{
+ TreeElement *te= lb->first;
+ while(te) {
+ TreeStoreElem *tselem= TREESTORE(te);
+ if(tselem->flag & TSE_CLOSED) {
+ if (te->xend > *w)
+ *w = te->xend;
+ }
+ outliner_width(soops, &te->subtree, w);
+ te= te->next;
+ }
+}
+
static TreeElement *outliner_find_tree_element(ListBase *lb, int store_index)
{
TreeElement *te= lb->first, *tes;
@@ -2042,7 +2056,7 @@ void outliner_show_active(struct ScrArea *sa)
{
SpaceOops *so= sa->spacedata.first;
TreeElement *te;
- int ytop;
+ int xdelta, ytop;
if(OBACT == NULL) return;
@@ -2053,6 +2067,12 @@ void outliner_show_active(struct ScrArea *sa)
if(ytop>0) ytop= 0;
so->v2d.cur.ymax= ytop;
so->v2d.cur.ymin= ytop-(so->v2d.mask.ymax-so->v2d.mask.ymin);
+
+ /* make te->xs ==> te->xend center of view */
+ xdelta = te->xs - so->v2d.cur.xmin;
+ so->v2d.cur.xmin += xdelta;
+ so->v2d.cur.xmax += xdelta;
+
so->storeflag |= SO_TREESTORE_REDRAW;
scrarea_queue_redraw(sa);
}
@@ -2062,7 +2082,7 @@ void outliner_show_selected(struct ScrArea *sa)
{
SpaceOops *so= sa->spacedata.first;
TreeElement *te;
- int ytop;
+ int xdelta, ytop;
te= outliner_find_id(so, &so->tree, (ID *)OBACT);
if(te) {
@@ -2071,6 +2091,12 @@ void outliner_show_selected(struct ScrArea *sa)
if(ytop>0) ytop= 0;
so->v2d.cur.ymax= ytop;
so->v2d.cur.ymin= ytop-(so->v2d.mask.ymax-so->v2d.mask.ymin);
+
+ /* make te->xs ==> te->xend center of view */
+ xdelta = te->xs - so->v2d.cur.xmin;
+ so->v2d.cur.xmin += xdelta;
+ so->v2d.cur.xmax += xdelta;
+
so->storeflag |= SO_TREESTORE_REDRAW;
scrarea_queue_redraw(sa);
}
@@ -2149,7 +2175,7 @@ void outliner_find_panel(struct ScrArea *sa, int again, int flags)
TreeElement *te= NULL;
TreeElement *last_find;
TreeStoreElem *tselem;
- int ytop, prevFound=0;
+ int ytop, xdelta, prevFound=0;
char name[33];
/* get last found tree-element based on stored search_tse */
@@ -2196,6 +2222,11 @@ void outliner_find_panel(struct ScrArea *sa, int again, int flags)
soops->v2d.cur.ymax= ytop;
soops->v2d.cur.ymin= ytop-(soops->v2d.mask.ymax-soops->v2d.mask.ymin);
+ /* make te->xs ==> te->xend center of view */
+ xdelta = te->xs - soops->v2d.cur.xmin;
+ soops->v2d.cur.xmin += xdelta;
+ soops->v2d.cur.xmax += xdelta;
+
/* store selection */
soops->search_tse= *tselem;
@@ -3174,7 +3205,7 @@ static void outliner_draw_selection(SpaceOops *soops, ListBase *lb, int *starty)
/* selection status */
if(tselem->flag & TSE_SELECTED) {
- glRecti(0, *starty+1, (int)soops->v2d.mask.xmax, *starty+OL_H-1);
+ glRecti(0, *starty+1, (int)soops->v2d.cur.xmax, *starty+OL_H-1);
}
*starty-= OL_H;
if((tselem->flag & TSE_CLOSED)==0) outliner_draw_selection(soops, &te->subtree, starty);
@@ -3225,7 +3256,7 @@ static void outliner_back(SpaceOops *soops)
ystart= OL_H*(ystart/(OL_H));
while(ystart > soops->v2d.cur.ymin) {
- glRecti(0, ystart, (int)soops->v2d.mask.xmax, ystart+OL_H);
+ glRecti(0, ystart, (int)soops->v2d.cur.xmax, ystart+OL_H);
ystart-= 2*OL_H;
}
}
@@ -3236,35 +3267,35 @@ static void outliner_draw_restrictcols(SpaceOops *soops)
/* background underneath */
BIF_ThemeColor(TH_BACK);
- glRecti((int)soops->v2d.mask.xmax-(OL_TOGW+SCROLLB), soops->v2d.cur.ymin, (int)soops->v2d.mask.xmax, soops->v2d.tot.ymax);
+ glRecti((int)soops->v2d.cur.xmax-OL_TOGW, soops->v2d.cur.ymin, (int)soops->v2d.cur.xmax, soops->v2d.cur.ymax);
BIF_ThemeColorShade(TH_BACK, 6);
ystart= soops->v2d.tot.ymax;
ystart= OL_H*(ystart/(OL_H));
while(ystart > soops->v2d.cur.ymin) {
- glRecti((int)soops->v2d.mask.xmax-(OL_TOGW+SCROLLB), ystart, (int)soops->v2d.mask.xmax, ystart+OL_H);
+ glRecti((int)soops->v2d.cur.xmax-OL_TOGW, ystart, (int)soops->v2d.cur.xmax, ystart+OL_H);
ystart-= 2*OL_H;
}
BIF_ThemeColorShadeAlpha(TH_BACK, -15, -200);
/* view */
- fdrawline(soops->v2d.mask.xmax-(OL_TOG_RESTRICT_VIEWX+SCROLLB),
- soops->v2d.tot.ymax,
- soops->v2d.mask.xmax-(OL_TOG_RESTRICT_VIEWX+SCROLLB),
+ fdrawline(soops->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX,
+ soops->v2d.cur.ymax,
+ soops->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX,
soops->v2d.cur.ymin);
/* render */
- fdrawline(soops->v2d.mask.xmax-(OL_TOG_RESTRICT_SELECTX+SCROLLB),
- soops->v2d.tot.ymax,
- soops->v2d.mask.xmax-(OL_TOG_RESTRICT_SELECTX+SCROLLB),
+ fdrawline(soops->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX,
+ soops->v2d.cur.ymax,
+ soops->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX,
soops->v2d.cur.ymin);
/* render */
- fdrawline(soops->v2d.mask.xmax-(OL_TOG_RESTRICT_RENDERX+SCROLLB),
- soops->v2d.tot.ymax,
- soops->v2d.mask.xmax-(OL_TOG_RESTRICT_RENDERX+SCROLLB),
+ fdrawline(soops->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX,
+ soops->v2d.cur.ymax,
+ soops->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX,
soops->v2d.cur.ymin);
}
@@ -3419,12 +3450,76 @@ static void namebutton_cb(void *tep, void *oldnamep)
scrarea_queue_redraw(curarea);
}
+static void outliner_draw_restrictbuts(uiBlock *block, SpaceOops *soops, ListBase *lb)
+{
+ uiBut *bt;
+ TreeElement *te;
+ TreeStoreElem *tselem;
+ Object *ob;
+
+ for(te= lb->first; te; te= te->next) {
+ tselem= TREESTORE(te);
+ if(te->ys >= soops->v2d.cur.ymin && te->ys <= soops->v2d.cur.ymax) {
+ /* objects have toggle-able restriction flags */
+ if(tselem->type==0 && te->idcode==ID_OB) {
+ ob = (Object *)tselem->id;
+
+ uiBlockSetEmboss(block, UI_EMBOSSN);
+ bt= uiDefIconButBitS(block, ICONTOG, OB_RESTRICT_VIEW, REDRAWALL, ICON_RESTRICT_VIEW_OFF,
+ (int)soops->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, te->ys, 17, OL_H-1, &(ob->restrictflag), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
+ uiButSetFunc(bt, restrictbutton_view_cb, ob, NULL);
+ uiButSetFlag(bt, UI_NO_HILITE);
+
+ bt= uiDefIconButBitS(block, ICONTOG, OB_RESTRICT_SELECT, REDRAWALL, ICON_RESTRICT_SELECT_OFF,
+ (int)soops->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, te->ys, 17, OL_H-1, &(ob->restrictflag), 0, 0, 0, 0, "Restrict/Allow selection in the 3D View");
+ uiButSetFunc(bt, restrictbutton_sel_cb, ob, NULL);
+ uiButSetFlag(bt, UI_NO_HILITE);
+
+ bt= uiDefIconButBitS(block, ICONTOG, OB_RESTRICT_RENDER, REDRAWALL, ICON_RESTRICT_RENDER_OFF,
+ (int)soops->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX, te->ys, 17, OL_H-1, &(ob->restrictflag), 0, 0, 0, 0, "Restrict/Allow renderability");
+ uiButSetFunc(bt, restrictbutton_rend_cb, NULL, NULL);
+ uiButSetFlag(bt, UI_NO_HILITE);
+
+ uiBlockSetEmboss(block, UI_EMBOSS);
+ }
+ /* scene render layers and passes have toggle-able flags too! */
+ else if(tselem->type==TSE_R_LAYER) {
+ uiBlockSetEmboss(block, UI_EMBOSSN);
+
+ bt= uiDefIconButBitI(block, ICONTOGN, SCE_LAY_DISABLE, REDRAWBUTSSCENE, ICON_CHECKBOX_HLT-1,
+ (int)soops->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, te->ys, 17, OL_H-1, te->directdata, 0, 0, 0, 0, "Render this RenderLayer");
+ uiButSetFunc(bt, restrictbutton_r_lay_cb, NULL, NULL);
+
+ uiBlockSetEmboss(block, UI_EMBOSS);
+ }
+ else if(tselem->type==TSE_R_PASS) {
+ int *layflag= te->directdata;
+ uiBlockSetEmboss(block, UI_EMBOSSN);
+
+ /* NOTE: tselem->nr is short! */
+ bt= uiDefIconButBitI(block, ICONTOG, tselem->nr, REDRAWBUTSSCENE, ICON_CHECKBOX_HLT-1,
+ (int)soops->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, te->ys, 17, OL_H-1, layflag, 0, 0, 0, 0, "Render this Pass");
+ uiButSetFunc(bt, restrictbutton_r_lay_cb, NULL, NULL);
+
+ layflag++; /* is lay_xor */
+ if(ELEM6(tselem->nr, SCE_PASS_SPEC, SCE_PASS_SHADOW, SCE_PASS_AO, SCE_PASS_REFLECT, SCE_PASS_REFRACT, SCE_PASS_RADIO))
+ bt= uiDefIconButBitI(block, TOG, tselem->nr, REDRAWBUTSSCENE, (*layflag & tselem->nr)?ICON_DOT:ICON_BLANK1,
+ (int)soops->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, te->ys, 17, OL_H-1, layflag, 0, 0, 0, 0, "Exclude this Pass from Combined");
+ uiButSetFunc(bt, restrictbutton_r_lay_cb, NULL, NULL);
+
+ uiBlockSetEmboss(block, UI_EMBOSS);
+ }
+ }
+
+ if((tselem->flag & TSE_CLOSED)==0) outliner_draw_restrictbuts(block, soops, &te->subtree);
+ }
+}
+
static void outliner_buttons(uiBlock *block, SpaceOops *soops, ListBase *lb)
{
uiBut *bt;
TreeElement *te;
TreeStoreElem *tselem;
- Object *ob;
int dx, len;
for(te= lb->first; te; te= te->next) {
@@ -3451,59 +3546,6 @@ static void outliner_buttons(uiBlock *block, SpaceOops *soops, ListBase *lb)
/* otherwise keeps open on ESC */
tselem->flag &= ~TSE_TEXTBUT;
}
-
- if (!(soops->flag & SO_HIDE_RESTRICTCOLS)) {
-
- /* objects have toggle-able restriction flags */
- if(tselem->type==0 && te->idcode==ID_OB) {
- ob = (Object *)tselem->id;
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
- bt= uiDefIconButBitS(block, ICONTOG, OB_RESTRICT_VIEW, REDRAWALL, ICON_RESTRICT_VIEW_OFF,
- (int)soops->v2d.mask.xmax-(OL_TOG_RESTRICT_VIEWX+SCROLLB), te->ys, 17, OL_H-1, &(ob->restrictflag), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
- uiButSetFunc(bt, restrictbutton_view_cb, ob, NULL);
- uiButSetFlag(bt, UI_NO_HILITE);
-
- bt= uiDefIconButBitS(block, ICONTOG, OB_RESTRICT_SELECT, REDRAWALL, ICON_RESTRICT_SELECT_OFF,
- (int)soops->v2d.mask.xmax-(OL_TOG_RESTRICT_SELECTX+SCROLLB), te->ys, 17, OL_H-1, &(ob->restrictflag), 0, 0, 0, 0, "Restrict/Allow selection in the 3D View");
- uiButSetFunc(bt, restrictbutton_sel_cb, ob, NULL);
- uiButSetFlag(bt, UI_NO_HILITE);
-
- bt= uiDefIconButBitS(block, ICONTOG, OB_RESTRICT_RENDER, REDRAWALL, ICON_RESTRICT_RENDER_OFF,
- (int)soops->v2d.mask.xmax-(OL_TOG_RESTRICT_RENDERX+SCROLLB), te->ys, 17, OL_H-1, &(ob->restrictflag), 0, 0, 0, 0, "Restrict/Allow renderability");
- uiButSetFunc(bt, restrictbutton_rend_cb, NULL, NULL);
- uiButSetFlag(bt, UI_NO_HILITE);
-
- uiBlockSetEmboss(block, UI_EMBOSS);
- }
- /* scene render layers and passes have toggle-able flags too! */
- else if(tselem->type==TSE_R_LAYER) {
- uiBlockSetEmboss(block, UI_EMBOSSN);
-
- bt= uiDefIconButBitI(block, ICONTOGN, SCE_LAY_DISABLE, REDRAWBUTSSCENE, ICON_CHECKBOX_HLT-1,
- (int)soops->v2d.mask.xmax-(OL_TOG_RESTRICT_VIEWX+SCROLLB), te->ys, 17, OL_H-1, te->directdata, 0, 0, 0, 0, "Render this RenderLayer");
- uiButSetFunc(bt, restrictbutton_r_lay_cb, NULL, NULL);
-
- uiBlockSetEmboss(block, UI_EMBOSS);
- }
- else if(tselem->type==TSE_R_PASS) {
- int *layflag= te->directdata;
- uiBlockSetEmboss(block, UI_EMBOSSN);
-
- /* NOTE: tselem->nr is short! */
- bt= uiDefIconButBitI(block, ICONTOG, tselem->nr, REDRAWBUTSSCENE, ICON_CHECKBOX_HLT-1,
- (int)soops->v2d.mask.xmax-(OL_TOG_RESTRICT_VIEWX+SCROLLB), te->ys, 17, OL_H-1, layflag, 0, 0, 0, 0, "Render this Pass");
- uiButSetFunc(bt, restrictbutton_r_lay_cb, NULL, NULL);
-
- layflag++; /* is lay_xor */
- if(ELEM6(tselem->nr, SCE_PASS_SPEC, SCE_PASS_SHADOW, SCE_PASS_AO, SCE_PASS_REFLECT, SCE_PASS_REFRACT, SCE_PASS_RADIO))
- bt= uiDefIconButBitI(block, TOG, tselem->nr, REDRAWBUTSSCENE, (*layflag & tselem->nr)?ICON_DOT:ICON_BLANK1,
- (int)soops->v2d.mask.xmax-(OL_TOG_RESTRICT_SELECTX+SCROLLB), te->ys, 17, OL_H-1, layflag, 0, 0, 0, 0, "Exclude this Pass from Combined");
- uiButSetFunc(bt, restrictbutton_r_lay_cb, NULL, NULL);
-
- uiBlockSetEmboss(block, UI_EMBOSS);
- }
- }
}
if((tselem->flag & TSE_CLOSED)==0) outliner_buttons(block, soops, &te->subtree);
@@ -3513,11 +3555,18 @@ static void outliner_buttons(uiBlock *block, SpaceOops *soops, ListBase *lb)
void draw_outliner(ScrArea *sa, SpaceOops *soops)
{
uiBlock *block;
- int sizey;
+ int sizey, sizex;
short ofsx, ofsy;
- calc_scrollrcts(sa, G.v2d, sa->winx, sa->winy);
-
+ /* version patch for old outliners here - do_versions patch doesn't work */
+ if (G.v2d->scroll != L_SCROLL+B_SCROLLO) {
+ init_v2d_oops(curarea, soops);
+ test_view2d(G.v2d, curarea->winx, curarea->winy);
+ calc_scrollrcts(sa, G.v2d, sa->winx, sa->winy);
+ }
+ else
+ calc_scrollrcts(sa, G.v2d, sa->winx, sa->winy);
+
if(sa->winx>SCROLLB+10 && sa->winy>SCROLLH+10) {
if(G.v2d->scroll) {
ofsx= sa->winrct.xmin; /* because mywin */
@@ -3528,12 +3577,21 @@ void draw_outliner(ScrArea *sa, SpaceOops *soops)
}
outliner_build_tree(soops); // always
- sizey= 0;
+ sizey = sizex = 0;
outliner_height(soops, &soops->tree, &sizey);
+ outliner_width(soops, &soops->tree, &sizex);
- /* we init all tot rect vars, only really needed on window size change tho */
+ /* we init all tot rect vars, only really needed on window size change though */
G.v2d->tot.xmin= 0.0;
G.v2d->tot.xmax= (G.v2d->mask.xmax-G.v2d->mask.xmin);
+ if(soops->flag & SO_HIDE_RESTRICTCOLS) {
+ if(G.v2d->tot.xmax <= sizex)
+ G.v2d->tot.xmax= 2*sizex;
+ }
+ else {
+ if(G.v2d->tot.xmax-OL_TOGW <= sizex)
+ G.v2d->tot.xmax= 2*sizex;
+ }
G.v2d->tot.ymax= 0.0;
G.v2d->tot.ymin= -sizey*OL_H;
test_view2d(G.v2d, sa->winx, sa->winy);
@@ -3546,20 +3604,26 @@ void draw_outliner(ScrArea *sa, SpaceOops *soops)
myortho2(G.v2d->cur.xmin-0.375, G.v2d->cur.xmax-0.375, G.v2d->cur.ymin-0.375, G.v2d->cur.ymax-0.375);
- /* draw outliner stuff */
+ /* draw outliner stuff (background and hierachy lines) */
outliner_back(soops);
outliner_draw_tree(soops);
- if (!(soops->flag & SO_HIDE_RESTRICTCOLS))
- outliner_draw_restrictcols(soops);
/* restore viewport */
mywinset(sa->win);
- /* ortho corrected */
- myortho2(G.v2d->cur.xmin-SCROLLB-0.375, G.v2d->cur.xmax-0.375, G.v2d->cur.ymin-0.375, G.v2d->cur.ymax-0.375);
+ /* ortho corrected - 'pixel space' */
+ myortho2(G.v2d->cur.xmin-SCROLLB-0.375, G.v2d->cur.xmax-0.375, G.v2d->cur.ymin-SCROLLH-0.375, G.v2d->cur.ymax-0.375);
+ /* draw icons and names */
block= uiNewBlock(&sa->uiblocks, "outliner buttons", UI_EMBOSS, UI_HELV, sa->win);
outliner_buttons(block, soops, &soops->tree);
+
+ /* draw restriction columns */
+ if (!(soops->flag & SO_HIDE_RESTRICTCOLS)) {
+ outliner_draw_restrictcols(soops);
+ outliner_draw_restrictbuts(block, soops, &soops->tree);
+ }
+
uiDrawBlock(block);
/* clear flag that allows quick redraws */
diff --git a/source/blender/src/space.c b/source/blender/src/space.c
index 215a6addee4..768a2ea0ac3 100644
--- a/source/blender/src/space.c
+++ b/source/blender/src/space.c
@@ -5209,10 +5209,10 @@ void init_v2d_oops(ScrArea *sa, SpaceOops *soops)
/* outliner space is window size */
calc_scrollrcts(sa, v2d, sa->winx, sa->winy);
- v2d->tot.xmax= 0.0;
- v2d->tot.ymax= 0.0;
- v2d->tot.xmin= -(v2d->mask.xmax-v2d->mask.xmin);
- v2d->tot.ymin= -(v2d->mask.ymax-v2d->mask.ymin);
+ v2d->tot.xmax= (v2d->mask.xmax-v2d->mask.xmin);
+ v2d->tot.ymax= (v2d->mask.ymax-v2d->mask.ymin);
+ v2d->tot.xmin= 0.0;
+ v2d->tot.ymin= 0.0;
v2d->cur= v2d->tot;
@@ -5225,10 +5225,18 @@ void init_v2d_oops(ScrArea *sa, SpaceOops *soops)
v2d->minzoom= 1.0;
v2d->maxzoom= 1.0;
- v2d->scroll= L_SCROLL;
+ /* B_SCROLLO used here instead of B_SCROLL, to stop old blender's hanging on
+ * loading a file from a version with horizontal scrolling due to an old bug
+ */
+ v2d->scroll= L_SCROLL+B_SCROLLO;
v2d->keepaspect= 1;
v2d->keepzoom= 1;
- v2d->keeptot= 1;
+
+ /* NOTE: keeptot is 2, as keeptot!=0 makes sure it does get
+ * too freely scrolled on x-axis, but keeptot=1 will result
+ * in a snap-back when clicking on elements
+ */
+ v2d->keeptot= 2;
}
else {
v2d->tot.xmin= -28.0;