[Bf-blender-cvs] [0ce76a4274] blender2.8: Fix missing highlights in 3D View

Julian Eisel noreply at git.blender.org
Thu Feb 9 21:27:02 CET 2017


Commit: 0ce76a427475c469e22fbe02e5b93b9e943aaf47
Author: Julian Eisel
Date:   Thu Feb 9 21:16:06 2017 +0100
Branches: blender2.8
https://developer.blender.org/rB0ce76a427475c469e22fbe02e5b93b9e943aaf47

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.

===================================================================

M	source/blender/editors/space_view3d/drawobject.c

===================================================================

diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 114a61c452..5d821734b6 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 {




More information about the Bf-blender-cvs mailing list