Outliner: Fix selection drawing

Outliner was using the old selection flag to show selected objects.
So if you selected an object in the outliner it would keep "selected"
(drawn in yellow) even after you selected another object.
This commit is contained in:
Dalai Felinto
2017-12-13 16:23:56 -02:00
parent 3a3587f4b2
commit 53ea46d36c
2 changed files with 7 additions and 5 deletions

View File

@@ -1378,22 +1378,24 @@ static void outliner_draw_tree_element(
}
else if (te->idcode == ID_OB) {
Object *ob = (Object *)tselem->id;
if (ob == OBACT(view_layer) || (ob->flag & SELECT)) {
Base *base = (Base *)te->directdata;
const bool is_selected = (base != NULL) && ((base->flag & BASE_SELECTED) != 0);
if (ob == OBACT(view_layer) || is_selected) {
char col[4] = {0, 0, 0, 0};
/* outliner active ob: always white text, circle color now similar to view3d */
active = OL_DRAWSEL_ACTIVE;
if (ob == OBACT(view_layer)) {
if (ob->flag & SELECT) {
if (is_selected) {
UI_GetThemeColorType4ubv(TH_ACTIVE, SPACE_VIEW3D, col);
col[3] = alpha;
}
active = OL_DRAWSEL_NORMAL;
}
else if (ob->flag & SELECT) {
else if (is_selected) {
UI_GetThemeColorType4ubv(TH_SELECT, SPACE_VIEW3D, col);
col[3] = alpha;
}

View File

@@ -185,7 +185,7 @@ static eOLDrawState tree_element_set_active_object(
if (recursive) {
/* Recursive select/deselect for Object hierarchies */
do_outliner_object_select_recursive(view_layer, ob, (ob->flag & SELECT) != 0);
do_outliner_object_select_recursive(view_layer, ob, (base->flag & BASE_SELECTED) != 0);
}
if (set != OL_SETSEL_NONE) {