Outliner: the new 'restriction' options were drawn as buttons, and created
always even when not visible. Gave big slowdowns on large data sets.

Also: help lines were drawn as shorts, should be floats

Cannot fix: button coordinates are short by default still, giant outliner
data sets draw buttons in wrong location.

Did add nice feature though; on several events the outliner now is not
being re-built anymore, but redrawn only. I want to be a bit conservative
with it though... but it happens for:
- LMB drag to select items
- pageup/down, scrollwheel, mmb scroll
- search item
- show active item
- toggle selection
Makes a good difference :)
This commit is contained in:
2006-12-06 14:37:52 +00:00
parent c0becb4532
commit 4a5618a06c
4 changed files with 80 additions and 57 deletions

View File

@@ -210,7 +210,7 @@ typedef struct SpaceOops {
/* search stuff */
char search_string[32];
struct TreeStoreElem search_tse;
int search_flags, pad;
int search_flags, do_;
short type, outlinevis, storeflag;
short deps_flags;
@@ -540,6 +540,8 @@ typedef struct SpaceImaSel {
/* SpaceOops->storeflag */
#define SO_TREESTORE_CLEANUP 1
/* if set, it allows redraws. gets set for some allqueue events */
#define SO_TREESTORE_REDRAW 2
/* headerbuttons: 450-499 */

View File

@@ -2531,6 +2531,9 @@ int view2dmove(unsigned short event)
view2d_do_locks(curarea, V2D_LOCK_COPY|V2D_LOCK_REDRAW);
areawinset(sa->win);
if(curarea->spacetype==SPACE_OOPS)
((SpaceOops *)curarea->spacedata.first)->storeflag |= SO_TREESTORE_REDRAW;
scrarea_do_windraw(curarea);
screen_swapbuffers();

View File

@@ -833,6 +833,9 @@ static void outliner_build_tree(SpaceOops *soops)
struct VerseSession *session;
#endif
if(soops->tree.first && (soops->storeflag & SO_TREESTORE_REDRAW))
return;
outliner_free_tree(&soops->tree);
outliner_storage_cleanup(soops);
@@ -1050,6 +1053,7 @@ void outliner_toggle_selected(struct ScrArea *sa)
outliner_set_flag(soops, &soops->tree, TSE_SELECTED, 1);
BIF_undo_push("Outliner toggle selected");
soops->storeflag |= SO_TREESTORE_REDRAW;
scrarea_queue_redraw(sa);
}
@@ -1140,6 +1144,7 @@ void outliner_page_up_down(ScrArea *sa, int up)
soops->v2d.cur.ymin+= dy;
soops->v2d.cur.ymax+= dy;
soops->storeflag |= SO_TREESTORE_REDRAW;
scrarea_queue_redraw(sa);
}
@@ -1819,6 +1824,7 @@ static int do_outliner_mouse_event(SpaceOops *soops, TreeElement *te, short even
tselem->flag |= TSE_SELECTED;
/* redraw, same as outliner_select function */
soops->storeflag |= SO_TREESTORE_REDRAW;
scrarea_do_windraw(soops->area);
screen_swapbuffers();
}
@@ -1921,6 +1927,7 @@ 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);
so->storeflag |= SO_TREESTORE_REDRAW;
scrarea_queue_redraw(sa);
}
}
@@ -1938,6 +1945,7 @@ 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);
so->storeflag |= SO_TREESTORE_REDRAW;
scrarea_queue_redraw(sa);
}
}
@@ -2069,6 +2077,7 @@ void outliner_find_panel(struct ScrArea *sa, int again, int flags)
soops->search_flags= flags;
/* redraw */
soops->storeflag |= SO_TREESTORE_REDRAW;
scrarea_queue_redraw(sa);
}
}
@@ -2172,6 +2181,8 @@ void outliner_select(struct ScrArea *sa )
/* select the 'ouliner row' */
do_outliner_select(so, &so->tree, y1, y2, &selecting);
yo= mval[1];
so->storeflag |= SO_TREESTORE_REDRAW;
scrarea_do_windraw(sa);
screen_swapbuffers();
@@ -3099,22 +3110,22 @@ static void outliner_draw_restrictcols(SpaceOops *soops)
BIF_ThemeColorShadeAlpha(TH_BACK, -15, -200);
/* view */
sdrawline((short)soops->v2d.mask.xmax-(OL_TOG_RESTRICT_VIEWX+SCROLLB),
(short)soops->v2d.tot.ymax,
(short)soops->v2d.mask.xmax-(OL_TOG_RESTRICT_VIEWX+SCROLLB),
(short)soops->v2d.cur.ymin);
fdrawline(soops->v2d.mask.xmax-(OL_TOG_RESTRICT_VIEWX+SCROLLB),
soops->v2d.tot.ymax,
soops->v2d.mask.xmax-(OL_TOG_RESTRICT_VIEWX+SCROLLB),
soops->v2d.cur.ymin);
/* render */
sdrawline((short)soops->v2d.mask.xmax-(OL_TOG_RESTRICT_SELECTX+SCROLLB),
(short)soops->v2d.tot.ymax,
(short)soops->v2d.mask.xmax-(OL_TOG_RESTRICT_SELECTX+SCROLLB),
(short)soops->v2d.cur.ymin);
fdrawline(soops->v2d.mask.xmax-(OL_TOG_RESTRICT_SELECTX+SCROLLB),
soops->v2d.tot.ymax,
soops->v2d.mask.xmax-(OL_TOG_RESTRICT_SELECTX+SCROLLB),
soops->v2d.cur.ymin);
/* render */
sdrawline((short)soops->v2d.mask.xmax-(OL_TOG_RESTRICT_RENDERX+SCROLLB),
(short)soops->v2d.tot.ymax,
(short)soops->v2d.mask.xmax-(OL_TOG_RESTRICT_RENDERX+SCROLLB),
(short)soops->v2d.cur.ymin);
fdrawline(soops->v2d.mask.xmax-(OL_TOG_RESTRICT_RENDERX+SCROLLB),
soops->v2d.tot.ymax,
soops->v2d.mask.xmax-(OL_TOG_RESTRICT_RENDERX+SCROLLB),
soops->v2d.cur.ymin);
}
static void restrictbutton_view_cb(void *poin, void *poin2)
@@ -3256,7 +3267,9 @@ static void outliner_buttons(uiBlock *block, SpaceOops *soops, ListBase *lb)
int dx, len;
for(te= lb->first; te; te= te->next) {
if(te->ys >= soops->v2d.cur.ymin && te->ys <= soops->v2d.cur.ymax) {
tselem= TREESTORE(te);
if(tselem->flag & TSE_TEXTBUT) {
if(tselem->type == TSE_POSE_BASE) continue; // prevent crash when trying to rename 'pose' entry of armature
@@ -3306,6 +3319,7 @@ static void outliner_buttons(uiBlock *block, SpaceOops *soops, ListBase *lb)
if((tselem->flag & TSE_CLOSED)==0) outliner_buttons(block, soops, &te->subtree);
}
}
}
void draw_outliner(ScrArea *sa, SpaceOops *soops)
@@ -3360,5 +3374,8 @@ void draw_outliner(ScrArea *sa, SpaceOops *soops)
outliner_buttons(block, soops, &soops->tree);
uiDrawBlock(block);
/* clear flag that allows quick redraws */
soops->storeflag &= ~SO_TREESTORE_REDRAW;
/* drawoopsspace handles sliders */
}

View File

@@ -4685,6 +4685,7 @@ static void winqreadoopsspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
case WHEELUPMOUSE:
case WHEELDOWNMOUSE:
view2dmove(event); /* in drawipo.c */
soops->storeflag |= SO_TREESTORE_REDRAW;
break;
case AKEY: