[Bf-blender-cvs] [35f8198c9de] blender2.8: Refactor: SHOW->HIDE

Jeroen Bakker noreply at git.blender.org
Thu Jul 5 16:59:41 CEST 2018


Commit: 35f8198c9de254ff0ef2595719275413f1b798a5
Author: Jeroen Bakker
Date:   Thu Jul 5 15:13:15 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB35f8198c9de254ff0ef2595719275413f1b798a5

Refactor: SHOW->HIDE

HIDE needs less code also in the future, RNA still uses SHOW.

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

M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/draw/modes/object_mode.c
M	source/blender/editors/space_view3d/space_view3d.c
M	source/blender/makesdna/DNA_view3d_types.h
M	source/blender/makesrna/intern/rna_space.c

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

diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 8194648f369..3bdd4db3b94 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -1530,19 +1530,6 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
 			}
 		}
 
-		if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "int", "visible_object_types")) {
-			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) {
-						if (sl->spacetype == SPACE_VIEW3D) {
-							View3D *v3d = (View3D *)sl;
-							v3d->overlay.visible_object_types = V3D_OVERLAY_VISIBLE_OBJECT_TYPES_MASK;
-						}
-					}
-				}
-			}
-		}
-
 		for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
 			if (scene->toolsettings->manipulator_flag == 0) {
 				scene->toolsettings->manipulator_flag = SCE_MANIP_TRANSLATE | SCE_MANIP_ROTATE | SCE_MANIP_SCALE;
diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c
index 2beb453e069..b8387a53f22 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -2217,38 +2217,38 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
 			break;
 		}
 		case OB_LAMP:
-			if (v3d->overlay.visible_object_types & V3D_OVERLAY_SHOW_LAMP)
+			if ((v3d->overlay.hidden_object_types & V3D_OVERLAY_HIDE_LAMP) == 0)
 			{
 				DRW_shgroup_lamp(stl, ob, view_layer);
 			}
 			break;
 		case OB_CAMERA:
-			if (v3d->overlay.visible_object_types & V3D_OVERLAY_SHOW_CAMERA)
+			if ((v3d->overlay.hidden_object_types & V3D_OVERLAY_HIDE_CAMERA) == 0)
 			{
 				DRW_shgroup_camera(stl, ob, view_layer);
 			}
 			break;
 		case OB_EMPTY:
-			if (v3d->overlay.visible_object_types & V3D_OVERLAY_SHOW_EMPTY)
+			if ((v3d->overlay.hidden_object_types & V3D_OVERLAY_HIDE_EMPTY) == 0)
 			{
 				DRW_shgroup_empty(stl, psl, ob, view_layer);
 			}
 			break;
 		case OB_SPEAKER:
-			if (v3d->overlay.visible_object_types & V3D_OVERLAY_SHOW_SPEAKER)
+			if ((v3d->overlay.hidden_object_types & V3D_OVERLAY_HIDE_SPEAKER) == 0)
 			{
 				DRW_shgroup_speaker(stl, ob, view_layer);
 			}
 			break;
 		case OB_LIGHTPROBE:
-			if (v3d->overlay.visible_object_types & V3D_OVERLAY_SHOW_LIGHTPROBE)
+			if ((v3d->overlay.hidden_object_types & V3D_OVERLAY_HIDE_LIGHTPROBE) == 0)
 			{
 				DRW_shgroup_lightprobe(stl, psl, ob, view_layer);
 			}
 			break;
 		case OB_ARMATURE:
 		{
-			if (v3d->overlay.visible_object_types & V3D_OVERLAY_SHOW_ARMATURE)
+			if ((v3d->overlay.hidden_object_types & V3D_OVERLAY_HIDE_ARMATURE) == 0)
 			{
 				bArmature *arm = ob->data;
 				if (arm->edbo == NULL) {
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 5383e3d9e01..77beadccd5d 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -338,7 +338,6 @@ static SpaceLink *view3d_new(const ScrArea *UNUSED(sa), const Scene *scene)
 	v3d->overlay.texture_paint_mode_opacity = 0.8;
 	v3d->overlay.weight_paint_mode_opacity = 0.8;
 	v3d->overlay.vertex_paint_mode_opacity = 0.8;
-	v3d->overlay.visible_object_types = V3D_OVERLAY_VISIBLE_OBJECT_TYPES_MASK;
 
 	v3d->gridflag = V3D_SHOW_X | V3D_SHOW_Y | V3D_SHOW_FLOOR;
 
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index f7fd4a52a5f..04edb202ded 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -179,7 +179,7 @@ typedef struct View3DOverlay {
 
 	/* Other settings */
 	float wireframe_threshold;
-	int visible_object_types;
+	int hidden_object_types;
 
 } View3DOverlay;
 
@@ -384,16 +384,15 @@ enum {
 	V3D_OVERLAY_ONION_SKINS       = (1 << 7),
 };
 
-/* View3DOverlay->visible_object_types */
+/* View3DOverlay->hidden_object_types */
 enum {
-	V3D_OVERLAY_SHOW_EMPTY        = (1 << OB_EMPTY),
-	V3D_OVERLAY_SHOW_LAMP         = (1 << OB_LAMP),
-	V3D_OVERLAY_SHOW_CAMERA       = (1 << OB_CAMERA),
-	V3D_OVERLAY_SHOW_SPEAKER      = (1 << OB_SPEAKER),
-	V3D_OVERLAY_SHOW_LIGHTPROBE   = (1 << OB_LIGHTPROBE),
-	V3D_OVERLAY_SHOW_ARMATURE     = (1 << OB_ARMATURE),
+	V3D_OVERLAY_HIDE_EMPTY        = (1 << OB_EMPTY),
+	V3D_OVERLAY_HIDE_LAMP         = (1 << OB_LAMP),
+	V3D_OVERLAY_HIDE_CAMERA       = (1 << OB_CAMERA),
+	V3D_OVERLAY_HIDE_SPEAKER      = (1 << OB_SPEAKER),
+	V3D_OVERLAY_HIDE_LIGHTPROBE   = (1 << OB_LIGHTPROBE),
+	V3D_OVERLAY_HIDE_ARMATURE     = (1 << OB_ARMATURE),
 };
-#define V3D_OVERLAY_VISIBLE_OBJECT_TYPES_MASK (V3D_OVERLAY_SHOW_EMPTY | V3D_OVERLAY_SHOW_LAMP | V3D_OVERLAY_SHOW_CAMERA | V3D_OVERLAY_SHOW_SPEAKER | V3D_OVERLAY_SHOW_LIGHTPROBE | V3D_OVERLAY_SHOW_ARMATURE)
 
 /* View3DOverlay->edit_flag */
 enum {
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 00baf948a84..346ca6c8774 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -2609,7 +2609,7 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 
 	prop = RNA_def_property(srna, "show_empties", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "overlay.visible_object_types", V3D_OVERLAY_SHOW_EMPTY);
+	RNA_def_property_boolean_negative_sdna(prop, NULL, "overlay.hidden_object_types", V3D_OVERLAY_HIDE_EMPTY);
 	RNA_def_property_boolean_default(prop, true);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Show Empties", "Draw empties in the overlay");
@@ -2617,7 +2617,7 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 
 	prop = RNA_def_property(srna, "show_cameras", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "overlay.visible_object_types", V3D_OVERLAY_SHOW_CAMERA);
+	RNA_def_property_boolean_negative_sdna(prop, NULL, "overlay.hidden_object_types", V3D_OVERLAY_HIDE_CAMERA);
 	RNA_def_property_boolean_default(prop, true);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Show Cameras", "Draw cameras in the overlay");
@@ -2625,7 +2625,7 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 
 	prop = RNA_def_property(srna, "show_speakers", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "overlay.visible_object_types", V3D_OVERLAY_SHOW_SPEAKER);
+	RNA_def_property_boolean_negative_sdna(prop, NULL, "overlay.hidden_object_types", V3D_OVERLAY_HIDE_SPEAKER);
 	RNA_def_property_boolean_default(prop, true);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Show Speakers", "Draw speakers in the overlay");
@@ -2633,7 +2633,7 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 
 	prop = RNA_def_property(srna, "show_lightprobes", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "overlay.visible_object_types", V3D_OVERLAY_SHOW_LIGHTPROBE);
+	RNA_def_property_boolean_negative_sdna(prop, NULL, "overlay.hidden_object_types", V3D_OVERLAY_HIDE_LIGHTPROBE);
 	RNA_def_property_boolean_default(prop, true);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Show Lightprobes", "Draw lightprobes in the overlay");
@@ -2641,7 +2641,7 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 
 	prop = RNA_def_property(srna, "show_armatures", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "overlay.visible_object_types", V3D_OVERLAY_SHOW_ARMATURE);
+	RNA_def_property_boolean_negative_sdna(prop, NULL, "overlay.hidden_object_types", V3D_OVERLAY_HIDE_ARMATURE);
 	RNA_def_property_boolean_default(prop, true);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Show Armatures", "Draw armatures in the overlay");
@@ -2649,7 +2649,7 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 
 	prop = RNA_def_property(srna, "show_lamps", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "overlay.visible_object_types", V3D_OVERLAY_SHOW_LAMP);
+	RNA_def_property_boolean_negative_sdna(prop, NULL, "overlay.hidden_object_types", V3D_OVERLAY_HIDE_LAMP);
 	RNA_def_property_boolean_default(prop, true);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Show Lamps", "Draw lamps in the overlay");



More information about the Bf-blender-cvs mailing list