[Bf-blender-cvs] [08e4808318f] blender2.8: Fix EEVEE lamps with shadows by default but wrong UI

Dalai Felinto noreply at git.blender.org
Tue Apr 24 12:25:46 CEST 2018


Commit: 08e4808318f143b1489a91259784c51b01cede19
Author: Dalai Felinto
Date:   Tue Apr 24 12:11:31 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB08e4808318f143b1489a91259784c51b01cede19

Fix EEVEE lamps with shadows by default but wrong UI

Reported on T54788: Actually this was what BI was doing as well.
But anyways fixed for good now.

That includes a subversion bump.

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

M	source/blender/blenkernel/BKE_blender_version.h
M	source/blender/blenkernel/intern/lamp.c
M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/draw/engines/eevee/eevee_lights.c
M	source/blender/makesdna/DNA_lamp_types.h
M	source/blender/makesrna/intern/rna_lamp.c

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

diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index 1304b4e8b55..6ba9e3eab9c 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -28,7 +28,7 @@
  * and keep comment above the defines.
  * Use STRINGIFY() rather than defining with quotes */
 #define BLENDER_VERSION         280
-#define BLENDER_SUBVERSION      10
+#define BLENDER_SUBVERSION      11
 /* Several breakages with 270, e.g. constraint deg vs rad */
 #define BLENDER_MINVERSION      270
 #define BLENDER_MINSUBVERSION   6
diff --git a/source/blender/blenkernel/intern/lamp.c b/source/blender/blenkernel/intern/lamp.c
index 75abd10f52d..195280aad5a 100644
--- a/source/blender/blenkernel/intern/lamp.c
+++ b/source/blender/blenkernel/intern/lamp.c
@@ -64,7 +64,7 @@ void BKE_lamp_init(Lamp *la)
 	la->spotsize = DEG2RADF(45.0f);
 	la->spotblend = 0.15f;
 	la->att2 = 1.0f;
-	la->mode = LA_SHAD_BUF;
+	la->mode = LA_SHADOW;
 	la->bufsize = 512;
 	la->clipsta = 0.5f;
 	la->clipend = 40.0f;
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 05ae70b0971..15f43f02150 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -1013,7 +1013,8 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
 		}
 	}
 
-	if (!DNA_struct_find(fd->filesdna, "SpaceTopBar")) {
+	if (!MAIN_VERSION_ATLEAST(main, 280, 11)) {
+
 		/* Remove info editor, but only if at the top of the window. */
 		for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) {
 			/* Calculate window width/height from screen vertices */
@@ -1045,6 +1046,15 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
 		}
 	}
 
+	if (!MAIN_VERSION_ATLEAST(main, 280, 11)) {
+		for (Lamp *lamp = main->lamp.first; lamp; lamp = lamp->id.next) {
+			if (lamp->mode & (1 << 13)) { /* LA_SHAD_RAY */
+				lamp->mode |= LA_SHADOW;
+				lamp->mode &= ~(1 << 13);
+			}
+		}
+	}
+
 #ifdef WITH_REDO_REGION_REMOVAL
 	if (!MAIN_VERSION_ATLEAST(main, 280, TO_BE_DETERMINED)) {
 		/* Remove tool property regions. */
diff --git a/source/blender/draw/engines/eevee/eevee_lights.c b/source/blender/draw/engines/eevee/eevee_lights.c
index 86c9b9c850b..190f489ca50 100644
--- a/source/blender/draw/engines/eevee/eevee_lights.c
+++ b/source/blender/draw/engines/eevee/eevee_lights.c
@@ -318,7 +318,7 @@ void EEVEE_lights_cache_add(EEVEE_ViewLayerData *sldata, Object *ob)
 		led->data.ld.shadow_id = -1;
 		led->prev_cube_shadow_id = -1;
 
-		if (la->mode & (LA_SHAD_BUF | LA_SHAD_RAY)) {
+		if (la->mode & LA_SHADOW) {
 			if (la->type == LA_SUN) {
 				int sh_nbr = 1; /* TODO : MSM */
 				int cascade_nbr = MAX_CASCADE_NUM; /* TODO : Custom cascade number */
diff --git a/source/blender/makesdna/DNA_lamp_types.h b/source/blender/makesdna/DNA_lamp_types.h
index 68453e5f189..b3c07543201 100644
--- a/source/blender/makesdna/DNA_lamp_types.h
+++ b/source/blender/makesdna/DNA_lamp_types.h
@@ -113,7 +113,7 @@ typedef struct Lamp {
 #define LA_AREA			4
 
 /* mode */
-#define LA_SHAD_BUF		(1 << 0)
+#define LA_SHADOW		(1 << 0)
 /* #define LA_HALO		(1 << 1) */ /* not used anymore */
 /* #define LA_LAYER		(1 << 2) */ /* not used anymore */
 /* #define LA_QUAD		(1 << 3) */ /* not used anymore */
@@ -126,7 +126,7 @@ typedef struct Lamp {
 /* #define LA_DEEP_SHADOW	(1 << 10) */ /* not used anywhere */
 /* #define LA_NO_DIFF		(1 << 11) */ /* not used anywhere */
 /* #define LA_NO_SPEC		(1 << 12) */ /* not used anywhere */
-#define LA_SHAD_RAY		(1 << 13)
+/* #define LA_SHAD_RAY		(1 << 13) */ /* not used anywhere - cleaned */
 /* yafray: lamp shadowbuffer flag, softlight */
 /* Since it is used with LOCAL lamp, can't use LA_SHAD */
 /* #define LA_YF_SOFT		(1 << 14) */ /* not used anymore */
diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c
index 7e437a8a51f..6f176ebe331 100644
--- a/source/blender/makesrna/intern/rna_lamp.c
+++ b/source/blender/makesrna/intern/rna_lamp.c
@@ -63,27 +63,6 @@ static void rna_Lamp_buffer_size_set(PointerRNA *ptr, int value)
 	la->bufsize &= (~15); /* round to multiple of 16 */
 }
 
-static int rna_use_shadow_get(PointerRNA *ptr)
-{
-	Lamp *la = (Lamp *)ptr->data;
-
-	if (la->type == LA_SPOT) {
-		return (la->mode & (LA_SHAD_BUF | LA_SHAD_RAY)) != 0;
-	}
-	else {
-		return (la->mode & LA_SHAD_RAY) != 0;
-	}
-}
-
-static void rna_use_shadow_set(PointerRNA *ptr, int value)
-{
-	Lamp *la = (Lamp *)ptr->data;
-	la->mode &= ~(LA_SHAD_BUF | LA_SHAD_RAY);
-	if (value) {
-		la->mode |= LA_SHAD_RAY;
-	}
-}
-
 static StructRNA *rna_Lamp_refine(struct PointerRNA *ptr)
 {
 	Lamp *la = (Lamp *)ptr->data;
@@ -255,7 +234,7 @@ static void rna_def_lamp_shadow(StructRNA *srna, int sun)
 	PropertyRNA *prop;
 
 	prop = RNA_def_property(srna, "use_shadow", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_funcs(prop, "rna_use_shadow_get", "rna_use_shadow_set");
+	RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_SHADOW);
 	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
 
 	prop = RNA_def_property(srna, "shadow_buffer_size", PROP_INT, PROP_NONE);



More information about the Bf-blender-cvs mailing list