minor change for operator OUTLINER_OT_item_activate

Noticed clicking anywhere in the outliner was doing undo pushes, even in empty areas.

- check if any selection is made before redrawing.
- don't do an undo push when selecting outliner items since only screen data is touched here.
This commit is contained in:
Campbell Barton 2011-08-18 18:42:42 +00:00
parent ccdec67fec
commit 238955070b
2 changed files with 13 additions and 8 deletions

@ -143,9 +143,6 @@ void outliner_build_tree(struct Main *mainvar, struct Scene *scene, struct Space
void draw_outliner(const struct bContext *C);
/* outliner_select.c -------------------------------------------- */
void outliner_select(struct SpaceOops *soops, ListBase *lb, int *index, short *selecting);
int tree_element_type_active(struct bContext *C, struct Scene *scene, struct SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, int set);
int tree_element_active(struct bContext *C, struct Scene *scene, SpaceOops *soops, TreeElement *te, int set);

@ -106,10 +106,11 @@
/* ****************************************************** */
/* Outliner Selection (grey-blue highlight for rows) */
void outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *selecting)
static int outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *selecting)
{
TreeElement *te;
TreeStoreElem *tselem;
int change= 0;
for (te= lb->first; te && *index >= 0; te=te->next, (*index)--) {
tselem= TREESTORE(te);
@ -131,6 +132,8 @@ void outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *selectin
tselem->flag |= TSE_SELECTED;
else
tselem->flag &= ~TSE_SELECTED;
change |= 1;
}
}
else if ((tselem->flag & TSE_CLOSED)==0) {
@ -142,10 +145,12 @@ void outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *selectin
* function correctly
*/
(*index)--;
outliner_select(soops, &te->subtree, index, selecting);
change |= outliner_select(soops, &te->subtree, index, selecting);
(*index)++;
}
}
return change;
}
/* ****************************************************** */
@ -839,11 +844,14 @@ static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event)
fmval[0], fmval[1], NULL, &row);
/* select relevant row */
outliner_select(soops, &soops->tree, &row, &selecting);
if(outliner_select(soops, &soops->tree, &row, &selecting)) {
soops->storeflag |= SO_TREESTORE_REDRAW;
soops->storeflag |= SO_TREESTORE_REDRAW;
ED_undo_push(C, "Outliner selection event");
/* no need for undo push here, only changing outliner data which is
* scene level - campbell */
/* ED_undo_push(C, "Outliner selection event"); */
}
}
ED_region_tag_redraw(ar);