[Bf-blender-cvs] [69a04c61402] blender2.8: Cleanup: correct flag comparisons

Campbell Barton noreply at git.blender.org
Wed Nov 14 13:45:30 CET 2018


Commit: 69a04c61402cf4e09927640d2588764bcfd2a357
Author: Campbell Barton
Date:   Wed Nov 14 23:30:20 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB69a04c61402cf4e09927640d2588764bcfd2a357

Cleanup: correct flag comparisons

Also use smaller types for shading data.

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

M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/draw/engines/workbench/workbench_data.c
M	source/blender/editors/space_view3d/space_view3d.c
M	source/blender/makesdna/DNA_view3d_types.h

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

diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 2049856cfa6..9521c05f7f0 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -1809,7 +1809,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
 			}
 		}
 
-		if (!DNA_struct_elem_find(fd->filesdna, "View3DShadeing", "short", "background_type")) {
+		if (!DNA_struct_elem_find(fd->filesdna, "View3DShadeing", "char", "background_type")) {
 			for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
 				for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
 					for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
diff --git a/source/blender/draw/engines/workbench/workbench_data.c b/source/blender/draw/engines/workbench/workbench_data.c
index 29a3249782d..aa99883bb6b 100644
--- a/source/blender/draw/engines/workbench/workbench_data.c
+++ b/source/blender/draw/engines/workbench/workbench_data.c
@@ -55,13 +55,13 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
 	wd->matcap_orientation = (wpd->shading.flag & V3D_SHADING_MATCAP_FLIP_X) != 0;
 	wd->background_alpha = (DRW_state_is_image_render() && scene->r.alphamode == R_ALPHAPREMUL) ? 0.0f : 1.0f;
 
-	if (!v3d || ((v3d->shading.background_type & V3D_SHADING_BACKGROUND_WORLD) &&
+	if (!v3d || ((v3d->shading.background_type == V3D_SHADING_BACKGROUND_WORLD) &&
 	    (scene->world != NULL)))
 	{
 		copy_v3_v3(wd->background_color_low, &scene->world->horr);
 		copy_v3_v3(wd->background_color_high, &scene->world->horr);
 	}
-	else if (v3d->shading.background_type & V3D_SHADING_BACKGROUND_VIEWPORT) {
+	else if (v3d->shading.background_type == V3D_SHADING_BACKGROUND_VIEWPORT) {
 		copy_v3_v3(wd->background_color_low, v3d->shading.background_color);
 		copy_v3_v3(wd->background_color_high, v3d->shading.background_color);
 	}
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 044cb56d367..4fe2fe08fc9 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -1333,8 +1333,9 @@ static void space_view3d_listener(
 			switch (wmn->data) {
 				case ND_WORLD_DRAW:
 				case ND_WORLD:
-					if (v3d->shading.background_type & V3D_SHADING_BACKGROUND_WORLD)
+					if (v3d->shading.background_type == V3D_SHADING_BACKGROUND_WORLD) {
 						ED_area_tag_redraw_regiontype(sa, RGN_TYPE_WINDOW);
+					}
 					break;
 			}
 			break;
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index 6796c9d4d00..d0880b0af9a 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -139,11 +139,11 @@ typedef struct View3DShading {
 	short prev_type;   /* Runtime, for toggle between rendered viewport. */
 
 	short flag;
-	short color_type;
+	char color_type;
+	char _pad0[7];
 
-	short light;
-	short background_type;
-	short pad2[2];
+	char light;
+	char background_type;
 
 	char studio_light[256]; /* FILE_MAXFILE */
 	char matcap[256]; /* FILE_MAXFILE */



More information about the Bf-blender-cvs mailing list