diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2017-02-09 23:16:06 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2017-02-09 23:26:38 +0300 |
commit | 0ce76a427475c469e22fbe02e5b93b9e943aaf47 (patch) | |
tree | 5743ddad073831887df3edbbcefe49ccab11b6da | |
parent | ca9c1de33e2f770f0f48d4a1fbde919328dece8f (diff) |
Fix missing highlights in 3D View
Things like selection outlines didn't work at all.
Caused by rBc973e8d2da5cf3f.
When splitting up bitflags, the equivalent to `foo->flag & (bar1 + bar2)` is
`(foo->flag1 & bar1) || (foo->flag2 & bar2)`, *not*
`(foo->flag1 & bar1) && (foo->flag2 & bar2)`.
Also, let's please avoid using '+' operator for bitwise operations, a
binary addition is a binary OR *with* cary, which can cause quite some damage.
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 114a61c452b..5d821734b63 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -8109,20 +8109,19 @@ void draw_object_wire_color(Scene *scene, SceneLayer *sl, Base *base, unsigned c if ((scene->obedit == NULL) && (G.moving & G_TRANSFORM_OBJ) && - (base->flag & BASE_SELECTED) && - (base->flag_legacy & BA_WAS_SEL)) + ((base->flag & BASE_SELECTED) || (base->flag_legacy & BA_WAS_SEL))) { theme_id = TH_TRANSFORM; } else { /* Sets the 'colindex' */ if (ID_IS_LINKED_DATABLOCK(ob)) { - colindex = ((base->flag & BASE_SELECTED) && (base->flag_legacy & BA_WAS_SEL)) ? 2 : 1; + colindex = ((base->flag & BASE_SELECTED) || (base->flag_legacy & BA_WAS_SEL)) ? 2 : 1; } /* Sets the 'theme_id' or fallback to wire */ else { if ((ob->flag & OB_FROMGROUP) != 0) { - if ((base->flag & BASE_SELECTED) && (base->flag_legacy & BA_WAS_SEL)) { + if ((base->flag & BASE_SELECTED) || (base->flag_legacy & BA_WAS_SEL)) { /* uses darker active color for non-active + selected */ theme_id = TH_GROUP_ACTIVE; @@ -8135,7 +8134,7 @@ void draw_object_wire_color(Scene *scene, SceneLayer *sl, Base *base, unsigned c } } else { - if ((base->flag & BASE_SELECTED) && (base->flag_legacy & BA_WAS_SEL)) { + if ((base->flag & BASE_SELECTED) || (base->flag_legacy & BA_WAS_SEL)) { theme_id = sl->basact == base ? TH_ACTIVE : TH_SELECT; } else { |