[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42279] branches/ge_harmony: Simplifying the shadow panel while the Game Engine renderer is active.

Daniel Stokes kupomail at gmail.com
Wed Nov 30 01:43:34 CET 2011


Revision: 42279
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42279
Author:   kupoman
Date:     2011-11-30 00:43:33 +0000 (Wed, 30 Nov 2011)
Log Message:
-----------
Simplifying the shadow panel while the Game Engine renderer is active. Now it only shows options supported by the game engine.

Modified Paths:
--------------
    branches/ge_harmony/release/scripts/startup/bl_ui/properties_data_lamp.py
    branches/ge_harmony/source/blender/makesrna/intern/rna_lamp.c

Modified: branches/ge_harmony/release/scripts/startup/bl_ui/properties_data_lamp.py
===================================================================
--- branches/ge_harmony/release/scripts/startup/bl_ui/properties_data_lamp.py	2011-11-30 00:32:13 UTC (rev 42278)
+++ branches/ge_harmony/release/scripts/startup/bl_ui/properties_data_lamp.py	2011-11-30 00:43:33 UTC (rev 42279)
@@ -186,11 +186,54 @@
         sub = col.column(align=True)
         sub.prop(lamp, "atmosphere_inscattering", slider=True, text="Inscattering")
         sub.prop(lamp, "atmosphere_extinction", slider=True, text="Extinction")
+        
+class DATA_PT_shadow_game(DataButtonsPanel, bpy.types.Panel):
+    bl_label = "Shadow"
+    COMPAT_ENGINES = {'BLENDER_GAME'}
 
+    @classmethod
+    def poll(cls, context):
+        COMPAT_LIGHTS = {'SPOT', 'POINT'}
+        lamp = context.lamp
+        engine = context.scene.render.engine
+        return (lamp and lamp.type in COMPAT_LIGHTS) and (engine in cls.COMPAT_ENGINES)
+        
+    def draw_header(self, context):
+        lamp = context.lamp
+        
+        self.layout.prop(lamp, "use_shadow", text="")
 
+    def draw(self, context):
+        layout = self.layout
+
+        lamp = context.lamp
+        
+        split = layout.split()
+
+        col = split.column()
+        col.prop(lamp, "shadow_color", text="")
+
+        col = split.column()
+        col.prop(lamp, "use_shadow_layer", text="This Layer Only")
+        col.prop(lamp, "use_only_shadow")
+    
+        col = layout.column()
+        col.label("Quality:")
+        col = layout.column(align=True)
+        col.prop(lamp, "shadow_buffer_size", text="Size")
+        col.prop(lamp, "shadow_buffer_bias", text="Bias")
+        
+        row = layout.row()
+        row.label("Clipping:")
+        row = layout.row(align=True)
+        row.prop(lamp, "shadow_buffer_clip_start", text="Clip Start")
+        row.prop(lamp, "shadow_buffer_clip_end", text=" Clip End")
+        
+        layout.active = lamp.use_shadow
+
 class DATA_PT_shadow(DataButtonsPanel, Panel):
     bl_label = "Shadow"
-    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+    COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     @classmethod
     def poll(cls, context):

Modified: branches/ge_harmony/source/blender/makesrna/intern/rna_lamp.c
===================================================================
--- branches/ge_harmony/source/blender/makesrna/intern/rna_lamp.c	2011-11-30 00:32:13 UTC (rev 42278)
+++ branches/ge_harmony/source/blender/makesrna/intern/rna_lamp.c	2011-11-30 00:43:33 UTC (rev 42279)
@@ -86,6 +86,24 @@
 	set_current_lamp_texture(la, value.data);
 }
 
+static int rna_use_shadow_get(PointerRNA *ptr)
+{
+	Lamp *la = (Lamp*)ptr->data;
+	return la->mode & LA_SHAD_BUF;
+}
+
+static void rna_use_shadow_set(PointerRNA *ptr, int value)
+{
+	Lamp *la = (Lamp*)ptr->data;
+	if (value)
+	{
+		la->mode |= LA_SHAD_BUF;
+		la->mode &= ~LA_SHAD_RAY;
+	}
+	else
+		la->mode &= ~(LA_SHAD_BUF + LA_SHAD_RAY);
+}
+
 static StructRNA* rna_Lamp_refine(struct PointerRNA *ptr)
 {
 	Lamp *la= (Lamp*)ptr->data;
@@ -462,12 +480,105 @@
 		{LA_SAMP_CONSTANT, "CONSTANT_JITTERED", 0, "Constant Jittered", ""},
 		{0, NULL, 0, NULL, NULL}};
 
+	static EnumPropertyItem prop_shadbuftype_items[] = {
+		{LA_SHADBUF_REGULAR	, "REGULAR", 0, "Classical", "Classic shadow buffer"},
+		{LA_SHADBUF_HALFWAY, "HALFWAY", 0, "Classic-Halfway", "Regular buffer, averaging the closest and 2nd closest Z value to reducing bias artifacts"},
+		{LA_SHADBUF_IRREGULAR, "IRREGULAR", 0, "Irregular", "Irregular buffer produces sharp shadow always, but it doesn't show up for raytracing"},
+		{LA_SHADBUF_DEEP, "DEEP", 0, "Deep", "Deep shadow buffer supports transparency and better filtering, at the cost of more memory usage and processing time"},
+		{0, NULL, 0, NULL, NULL}};
+
+	static EnumPropertyItem prop_shadbuffiltertype_items[] = {
+		{LA_SHADBUF_BOX	, "BOX", 0, "Box", "Apply the Box filter to shadow buffer samples"},
+		{LA_SHADBUF_TENT, "TENT", 0, "Tent", "Apply the Tent Filter to shadow buffer samples"},
+		{LA_SHADBUF_GAUSS, "GAUSS", 0, "Gauss", "Apply the Gauss filter to shadow buffer samples"},
+		{0, NULL, 0, NULL, NULL}};
+
+	static EnumPropertyItem prop_numbuffer_items[] = {
+		{1, "BUFFERS_1", 0, "1", "Only one buffer rendered"},
+		{4, "BUFFERS_4", 0, "4", "Renders 4 buffers for better AA, this quadruples memory usage"},
+		{9, "BUFFERS_9", 0, "9", "Renders 9 buffers for better AA, this uses nine times more memory"},
+		{0, NULL, 0, NULL, NULL}};
+
+	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_update(prop, 0, "rna_Lamp_draw_update");
+
 	prop= RNA_def_property(srna, "shadow_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode");
 	RNA_def_property_enum_items(prop, (spot)? prop_spot_shadow_items: prop_shadow_items);
-	RNA_def_property_ui_text(prop, "Shadow Method", "Method to compute lamp shadow with");
+	RNA_def_property_update(prop, 0, "rna_Lamp_update");
+
+	prop= RNA_def_property(srna, "shadow_buffer_size", PROP_INT, PROP_NONE);
+	RNA_def_property_int_sdna(prop, NULL, "bufsize");
+	RNA_def_property_range(prop, 512, 10240);
+	RNA_def_property_ui_text(prop, "Shadow Buffer Size", "Resolution of the shadow buffer, higher values give crisper shadows but use more memory");
+	RNA_def_property_int_funcs(prop, NULL, "rna_Lamp_buffer_size_set", NULL);
+	RNA_def_property_update(prop, 0, "rna_Lamp_update");
+
+	prop= RNA_def_property(srna, "shadow_filter_type", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_sdna(prop, NULL, "filtertype");
+	RNA_def_property_enum_items(prop, prop_shadbuffiltertype_items);
+	RNA_def_property_ui_text(prop, "Shadow Filter Type", "Type of shadow filter (Buffer Shadows)");
+	RNA_def_property_update(prop, 0, "rna_Lamp_update");
+
+	prop= RNA_def_property(srna, "shadow_sample_buffers", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_sdna(prop, NULL, "buffers");
+	RNA_def_property_enum_items(prop, prop_numbuffer_items);
+	RNA_def_property_ui_text(prop, "Shadow Sample Buffers", "Number of shadow buffers to render for better AA, this increases memory usage");
+	RNA_def_property_update(prop, 0, "rna_Lamp_update");
+
+	prop= RNA_def_property(srna, "shadow_buffer_clip_start", PROP_FLOAT, PROP_DISTANCE);
+	RNA_def_property_float_sdna(prop, NULL, "clipsta");
+	RNA_def_property_range(prop, 0.0f, 9999.0f);
+	RNA_def_property_ui_text(prop, "Shadow Buffer Clip Start", "Shadow map clip start: objects closer will not generate shadows");
 	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
 
+	prop= RNA_def_property(srna, "shadow_buffer_clip_end", PROP_FLOAT, PROP_DISTANCE);
+	RNA_def_property_float_sdna(prop, NULL, "clipend");
+	RNA_def_property_range(prop, 0.0f, 9999.0f);
+	RNA_def_property_ui_text(prop, "Shadow Buffer Clip End", "Shadow map clip end beyond which objects will not generate shadows");
+	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
+
+	prop= RNA_def_property(srna, "shadow_buffer_bias", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "bias");
+	RNA_def_property_range(prop, 0.001f, 5.0f);
+	RNA_def_property_ui_text(prop, "Shadow Buffer Bias", "Shadow buffer sampling bias");
+	RNA_def_property_update(prop, 0, "rna_Lamp_update");
+
+	prop= RNA_def_property(srna, "shadow_buffer_soft", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "soft");
+	RNA_def_property_range(prop, 0.0f, 100.0f);
+	RNA_def_property_ui_text(prop, "Shadow Buffer Soft", "Size of shadow buffer sampling area");
+	RNA_def_property_update(prop, 0, "rna_Lamp_update");
+
+	prop= RNA_def_property(srna, "shadow_buffer_samples", PROP_INT, PROP_NONE);
+	RNA_def_property_int_sdna(prop, NULL, "samp");
+	RNA_def_property_range(prop, 1, 16);
+	RNA_def_property_ui_text(prop, "Samples", "Number of shadow buffer samples");
+	RNA_def_property_update(prop, 0, "rna_Lamp_update");
+
+	prop= RNA_def_property(srna, "shadow_buffer_type", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_sdna(prop, NULL, "buftype");
+	RNA_def_property_enum_items(prop, prop_shadbuftype_items);
+	RNA_def_property_ui_text(prop, "Shadow Buffer Type", "Type of shadow buffer");
+	RNA_def_property_update(prop, 0, "rna_Lamp_update");
+
+	prop= RNA_def_property(srna, "use_auto_clip_start", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "bufflag", LA_SHADBUF_AUTO_START);
+	RNA_def_property_ui_text(prop, "Autoclip Start",  "Automatic calculation of clipping-start, based on visible vertices");
+	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
+
+	prop= RNA_def_property(srna, "use_auto_clip_end", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "bufflag", LA_SHADBUF_AUTO_END);
+	RNA_def_property_ui_text(prop, "Autoclip End", "Automatic calculation of clipping-end, based on visible vertices");
+	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
+
+	prop= RNA_def_property(srna, "compression_threshold", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "compressthresh");
+	RNA_def_property_range(prop, 0.0f, 1.0f);
+	RNA_def_property_ui_text(prop, "Compress", "Deep shadow map compression threshold");
+	RNA_def_property_update(prop, 0, "rna_Lamp_update");
+
 	prop= RNA_def_property(srna, "shadow_color", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "shdwr");
 	RNA_def_property_array(prop, 3);
@@ -641,25 +752,6 @@
 	RNA_def_property_ui_text(prop, "Halo Step", "Volumetric halo sampling frequency");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
-	prop= RNA_def_property(srna, "shadow_buffer_size", PROP_INT, PROP_NONE);
-	RNA_def_property_int_sdna(prop, NULL, "bufsize");
-	RNA_def_property_range(prop, 512, 10240);
-	RNA_def_property_ui_text(prop, "Shadow Buffer Size", "Resolution of the shadow buffer, higher values give crisper shadows but use more memory");
-	RNA_def_property_int_funcs(prop, NULL, "rna_Lamp_buffer_size_set", NULL);
-	RNA_def_property_update(prop, 0, "rna_Lamp_update");
-
-	prop= RNA_def_property(srna, "shadow_filter_type", PROP_ENUM, PROP_NONE);
-	RNA_def_property_enum_sdna(prop, NULL, "filtertype");
-	RNA_def_property_enum_items(prop, prop_shadbuffiltertype_items);
-	RNA_def_property_ui_text(prop, "Shadow Filter Type", "Type of shadow filter (Buffer Shadows)");

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list