[Bf-blender-cvs] [38e5861] master: Revert own previous commit rBe2f9afbaabbd.

IRIE Shinsuke noreply at git.blender.org
Tue Feb 11 21:46:34 CET 2014


Commit: 38e58612efbd79807ffc030ed6093e6110b2fd5a
Author: IRIE Shinsuke
Date:   Wed Feb 12 05:41:09 2014 +0900
https://developer.blender.org/rB38e58612efbd79807ffc030ed6093e6110b2fd5a

Revert own previous commit rBe2f9afbaabbd.

The "Cast Shadows" worked as expected, but it can cause problem in some cases.
For example, when using strand render, we need disabling only buffer shadows,
but the previous changes made that impossible. "Cast Shadows" should be added
as a newly created option.

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

M	release/scripts/startup/bl_ui/properties_material.py
M	source/blender/blenkernel/intern/material.c
M	source/blender/blenloader/intern/versioning_legacy.c
M	source/blender/editors/render/render_preview.c
M	source/blender/editors/space_view3d/drawobject.c
M	source/blender/makesdna/DNA_material_types.h
M	source/blender/makesrna/intern/rna_material.c
M	source/blender/render/intern/raytrace/rayobject.cpp
M	source/blender/render/intern/source/convertblender.c
M	source/blender/render/intern/source/shadbuf.c
M	source/blender/render/intern/source/strand.c
M	source/blender/render/intern/source/zbuf.c
M	source/gameengine/Converter/BL_BlenderDataConversion.cpp

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

diff --git a/release/scripts/startup/bl_ui/properties_material.py b/release/scripts/startup/bl_ui/properties_material.py
index ee3e905..9e56c26 100644
--- a/release/scripts/startup/bl_ui/properties_material.py
+++ b/release/scripts/startup/bl_ui/properties_material.py
@@ -222,7 +222,7 @@ class MATERIAL_PT_pipeline(MaterialButtonsPanel, Panel):
 
         col.prop(mat, "use_cast_shadows_only", text="Cast Only")
         col.prop(mat, "shadow_cast_alpha", text="Casting Alpha")
-        col.prop(mat, "use_cast_shadows")
+        col.prop(mat, "use_cast_buffer_shadows")
         col.prop(mat, "use_cast_approximate")
         col.prop(mat, "pass_index")
 
@@ -824,9 +824,9 @@ class MATERIAL_PT_shadow(MaterialButtonsPanel, Panel):
 
         col = split.column()
         if simple_material(base_mat):
-            col.prop(mat, "use_cast_shadows")
+            col.prop(mat, "use_cast_buffer_shadows")
         sub = col.column()
-        sub.active = mat.use_cast_shadows
+        sub.active = mat.use_cast_buffer_shadows
         sub.prop(mat, "shadow_buffer_bias", text="Buffer Bias")
         col.prop(mat, "use_ray_shadow_bias", text="Auto Ray Bias")
         sub = col.column()
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 4025714..5f63313 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -202,7 +202,7 @@ void init_material(Material *ma)
 	ma->game.alpha_blend = 0;
 	ma->game.face_orientation = 0;
 	
-	ma->mode = MA_TRACEBLE | MA_CASTSHADOW | MA_SHADOW | MA_RAYBIAS | MA_TANGENT_STR | MA_ZTRANSP;
+	ma->mode = MA_TRACEBLE | MA_SHADBUF | MA_SHADOW | MA_RAYBIAS | MA_TANGENT_STR | MA_ZTRANSP;
 	ma->shade_flag = MA_APPROX_OCCLUSION;
 	ma->preview = NULL;
 }
diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c
index e82e5b2..0283d9b 100644
--- a/source/blender/blenloader/intern/versioning_legacy.c
+++ b/source/blender/blenloader/intern/versioning_legacy.c
@@ -2171,7 +2171,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main)
 				ma->mode |= MA_TANGENT_STR;
 			}
 			if (ma->mode & MA_TRACEBLE)
-				ma->mode |= MA_CASTSHADOW;
+				ma->mode |= MA_SHADBUF;
 		}
 	}
 
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index aecd4e1..482c855 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -350,7 +350,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
 						if (base->object->id.name[2] == 'c') {
 							Material *shadmat = give_current_material(base->object, base->object->actcol);
 							if (shadmat) {
-								if (mat->mode & MA_CASTSHADOW) shadmat->septex = 0;
+								if (mat->mode & MA_SHADBUF) shadmat->septex = 0;
 								else shadmat->septex |= 1;
 							}
 						}
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 0a387af..8a4714e 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -3620,7 +3620,7 @@ static bool draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3
 	if (v3d->flag2 & V3D_RENDER_SHADOW) {
 		for (i = 0; i < ob->totcol; ++i) {
 			Material *ma = give_current_material(ob, i);
-			if (ma && !(ma->mode & MA_CASTSHADOW)) {
+			if (ma && !(ma->mode & MA_SHADBUF)) {
 				return true;
 			}
 		}
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h
index 8dc46ec..a6478f2 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -267,7 +267,7 @@ typedef struct Material {
 #define MA_RAYBIAS		0x400000
 #define MA_FULL_OSA		0x800000
 #define MA_TANGENT_STR	0x1000000
-#define MA_CASTSHADOW		0x2000000
+#define MA_SHADBUF		0x2000000
 		/* note; we drop MA_TANGENT_STR later to become tangent_u */
 #define MA_TANGENT_V	0x4000000
 /* qdn: a bit clumsy this, tangents needed for normal maps separated from shading */
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 76c115c..807d9fc 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -1937,16 +1937,10 @@ void RNA_def_material(BlenderRNA *brna)
 	                         "Force this material to render full shading/textures for all anti-aliasing samples");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop = RNA_def_property(srna, "use_cast_shadows", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_CASTSHADOW);
-	RNA_def_property_ui_text(prop, "Cast Shadows",
-	                         "Allow this material to cast shadows");
-	RNA_def_property_update(prop, 0, "rna_Material_update");
-
 	prop = RNA_def_property(srna, "use_cast_buffer_shadows", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_CASTSHADOW);
-	RNA_def_property_ui_text(prop, "Cast Shadows",
-	                         "This is obsolete RNA path, please use 'use_cast_shadows' instead");
+	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_SHADBUF);
+	RNA_def_property_ui_text(prop, "Cast Buffer Shadows",
+	                         "Allow this material to cast shadows from shadow buffer lamps");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
 	prop = RNA_def_property(srna, "use_cast_approximate", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/render/intern/raytrace/rayobject.cpp b/source/blender/render/intern/raytrace/rayobject.cpp
index fd3d2b5..9e63950 100644
--- a/source/blender/render/intern/raytrace/rayobject.cpp
+++ b/source/blender/render/intern/raytrace/rayobject.cpp
@@ -118,7 +118,7 @@ MALWAYS_INLINE int vlr_check_intersect(Isect *is, ObjectInstanceRen *obi, VlakRe
 	if (is->mode == RE_RAY_MIRROR)
 		return !(vlr->mat->mode & MA_ONLYCAST);
 	else
-		return (vlr->mat->mode & MA_CASTSHADOW) && (is->lay & obi->lay);
+		return (is->lay & obi->lay);
 }
 
 MALWAYS_INLINE int vlr_check_intersect_solid(Isect *UNUSED(is), ObjectInstanceRen *UNUSED(obi), VlakRen *vlr)
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 5608035..bcde98a 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -746,7 +746,7 @@ static Material *give_render_material(Render *re, Object *ob, short nr)
 	
 	if (ma->material_type == MA_TYPE_VOLUME) {
 		ma->mode |= MA_TRANSP;
-		ma->mode &= ~MA_CASTSHADOW;
+		ma->mode &= ~MA_SHADBUF;
 	}
 	if ((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP))
 		re->flag |= R_ZTRA;
diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c
index 676e043..0c3bf85 100644
--- a/source/blender/render/intern/source/shadbuf.c
+++ b/source/blender/render/intern/source/shadbuf.c
@@ -660,7 +660,7 @@ static void shadowbuf_autoclip(Render *re, LampRen *lar)
 			if (vlr->mat!= ma) {
 				ma= vlr->mat;
 				ok= 1;
-				if ((ma->mode & MA_CASTSHADOW)==0) ok= 0;
+				if ((ma->mode & MA_SHADBUF)==0) ok= 0;
 			}
 			
 			if (ok && (obi->lay & lay)) {
@@ -2013,7 +2013,7 @@ static void isb_bsp_fillfaces(Render *re, LampRen *lar, ISBBranch *root)
 			if (vlr->mat!= ma) {
 				ma= vlr->mat;
 				ok= 1;
-				if ((ma->mode & MA_CASTSHADOW)==0) ok= 0;
+				if ((ma->mode & MA_SHADBUF)==0) ok= 0;
 				if (ma->material_type == MA_TYPE_WIRE) ok= 0;
 				zspanstrand.shad_alpha= zspan.shad_alpha= ma->shad_alpha;
 			}
diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c
index 6c13bff..f2d4a7a 100644
--- a/source/blender/render/intern/source/strand.c
+++ b/source/blender/render/intern/source/strand.c
@@ -860,7 +860,7 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa
 		/* test if we should skip it */
 		ma = obr->strandbuf->ma;
 
-		if (shadow && !(ma->mode & MA_CASTSHADOW))
+		if (shadow && !(ma->mode & MA_SHADBUF))
 			continue;
 		else if (!shadow && (ma->mode & MA_ONLYCAST))
 			continue;
diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c
index 6885768..a8ccd1f 100644
--- a/source/blender/render/intern/source/zbuf.c
+++ b/source/blender/render/intern/source/zbuf.c
@@ -2368,7 +2368,7 @@ void zbuffer_shadow(Render *re, float winmat[4][4], LampRen *lar, int *rectz, in
 			if (vlr->mat!= ma) {
 				ma= vlr->mat;
 				ok= 1;
-				if ((ma->mode & MA_CASTSHADOW)==0) ok= 0;
+				if ((ma->mode & MA_SHADBUF)==0) ok= 0;
 			}
 
 			if (ok && (obi->lay & lay) && !(vlr->flag & R_HIDDEN)) {
@@ -2421,7 +2421,7 @@ void zbuffer_shadow(Render *re, float winmat[4][4], LampRen *lar, int *rectz, in
 					if (sseg.buffer->ma!= ma) {
 						ma= sseg.buffer->ma;
 						ok= 1;
-						if ((ma->mode & MA_CASTSHADOW)==0) ok= 0;
+						if ((ma->mode & MA_SHADBUF)==0) ok= 0;
 					}
 
 					if (ok && (sseg.buffer->lay & lay)) {
@@ -3349,7 +3349,7 @@ static int zbuffer_abuf(Render *re, RenderPart *pa, APixstr *APixbuf, ListBase *
 			if (vlr->mat!=ma) {
 				ma= vlr->mat;
 				if (shadow)
-					dofill= (ma->mode & MA_CASTSHADOW);
+					dofill= (ma->mode & MA_SHADBUF);
 				else
 					dofill= (((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP)) && !(ma->mode & MA_ONLYCAST));
 			}
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index c823665..0ec5441 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -610,7 +610,7 @@ static bool ConvertMaterial(
 		material->ras_mode |= ( mat->game.flag & GEMAT_BACKCULL )?0:TWOSIDED;
 
 		// cast shadows?
-		material->ras_mode |= ( mat->mode & MA_CASTSHADOW )?CAST_SHADOW:0;
+		material->ras_mode |= ( mat->mode & MA_SHADBUF )?CAST_SHADOW:0;
 		MTex *mttmp = 0;
 		int valid_index = 0;




More information about the Bf-blender-cvs mailing list