Revision: 18281
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18281
Author:   broken
Date:     2009-01-03 06:41:58 +0100 (Sat, 03 Jan 2009)

Log Message:
-----------
* Added some notifications to object/lamp/material RNA properties

For now, I've made a distinction between (eg.) ND_LIGHTING and ND_LIGHTING_DRAW,
with the 'draw' variety being properties that get displayed in the 3D View

* Also did some cleaning in lamp RNA, moved sun/sky settings to its own struct

Modified Paths:
--------------
    
branches/blender2.5/blender/source/blender/editors/space_view3d/space_view3d.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_lamp.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_material.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_object.c
    branches/blender2.5/blender/source/blender/windowmanager/WM_types.h

Modified: 
branches/blender2.5/blender/source/blender/editors/space_view3d/space_view3d.c
===================================================================
--- 
branches/blender2.5/blender/source/blender/editors/space_view3d/space_view3d.c  
    2009-01-03 05:18:11 UTC (rev 18280)
+++ 
branches/blender2.5/blender/source/blender/editors/space_view3d/space_view3d.c  
    2009-01-03 05:41:58 UTC (rev 18281)
@@ -251,9 +251,22 @@
                                case ND_BONE_SELECT:
                                case ND_TRANSFORM:
                                case ND_GEOM_SELECT:
+                               case ND_DRAW:
                                        ED_region_tag_redraw(ar);
                                        break;
                        }
+               case NC_MATERIAL:
+                       switch(wmn->data) {
+                               case ND_SHADING_DRAW:
+                                       ED_region_tag_redraw(ar);
+                                       break;
+                       }
+               case NC_LAMP:
+                       switch(wmn->data) {
+                               case ND_LIGHTING_DRAW:
+                                       ED_region_tag_redraw(ar);
+                                       break;
+                       }
        }
 }
 

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_lamp.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_lamp.c       
2009-01-03 05:18:11 UTC (rev 18280)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_lamp.c       
2009-01-03 05:41:58 UTC (rev 18281)
@@ -31,6 +31,8 @@
 
 #include "DNA_lamp_types.h"
 
+#include "WM_types.h"
+
 #ifdef RNA_RUNTIME
 
 static void rna_Lamp_buffer_size_set(PointerRNA *ptr, int value)
@@ -42,15 +44,141 @@
        la->bufsize &= (~15); /* round to multiple of 16 */
 }
 
+static void *rna_Lamp_sunsky_settings_get(PointerRNA *ptr)
+{
+       return ptr->id.data;
+}
 
+
 #else
 
-void RNA_def_lamp(BlenderRNA *brna)
+static void rna_def_lamp_sunsky_settings(BlenderRNA *brna)
 {
        StructRNA *srna;
        PropertyRNA *prop;
+
+       static EnumPropertyItem prop_skycolorspace_items[] = {
+               {0, "SMPTE", "SMPTE", ""},
+               {1, "REC709", "REC709", ""},
+               {2, "CIE", "CIE", ""},
+               {0, NULL, NULL, NULL}};
+               
+       static EnumPropertyItem prop_blendmode_items[] = {
+               {0, "MIX", "Mix", ""},
+               {1, "ADD", "Add", ""},
+               {2, "MULTIPLY", "Multiply", ""},
+               {3, "SUBTRACT", "Subtract", ""},
+               {4, "SCREEN", "Screen", ""},
+               {5, "DIVIDE", "Divide", ""},
+               {6, "DIFFERENCE", "Difference", ""},
+               {7, "DARKEN", "Darken", ""},
+               {8, "LIGHTEN", "Lighten", ""},
+               {9, "OVERLAY", "Overlay", ""},
+               {10, "DODGE", "Dodge", ""},
+               {11, "BURN", "Burn", ""},
+               {12, "HUE", "Hue", ""},
+               {13, "SATURATION", "Saturation", ""},
+               {14, "VALUE", "Value", ""},
+               {15, "COLOR", "Color", ""},
+               {0, NULL, NULL, NULL}};
+               
+       srna= RNA_def_struct(brna, "SunskySettings", NULL);
+       RNA_def_struct_sdna(srna, "Lamp");
+       RNA_def_struct_ui_text(srna, "Sun/Sky Settings", "Sun/Sky related 
settings for the lamp.");
+               
+       prop= RNA_def_property(srna, "sky_colorspace", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_items(prop, prop_skycolorspace_items);
+       RNA_def_property_ui_text(prop, "Sky Color Space", "");
+       RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
+
+       prop= RNA_def_property(srna, "sky_blend_type", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "skyblendtype");
+       RNA_def_property_enum_items(prop, prop_blendmode_items);
+       RNA_def_property_ui_text(prop, "Sky Blend Mode", "Blend mode for 
combining sun sky with world sky");
+       RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
+       
+       /* Number values */
+       
+       prop= RNA_def_property(srna, "horizon_brightness", PROP_FLOAT, 
PROP_NONE);
+       RNA_def_property_range(prop, 0.0f, 20.0f);
+       RNA_def_property_ui_text(prop, "Horizon Brightness", "horizon 
brightness");
+       RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
+
+       prop= RNA_def_property(srna, "spread", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_range(prop, 0.0f, 10.0f);
+       RNA_def_property_ui_text(prop, "Horizon Spread", "horizon Spread");
+       RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
+
+       prop= RNA_def_property(srna, "sun_brightness", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_range(prop, 0.0f, 10.0f);
+       RNA_def_property_ui_text(prop, "Sun Brightness", "Sun Brightness");
+       RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
+
+       prop= RNA_def_property(srna, "sun_size", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_range(prop, 0.0f, 10.0f);
+       RNA_def_property_ui_text(prop, "Sun Size", "Sun Size");
+       RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
+
+       prop= RNA_def_property(srna, "backscattered_light", PROP_FLOAT, 
PROP_NONE);
+       RNA_def_property_range(prop, 0.0f, 1.0f);
+       RNA_def_property_ui_text(prop, "Back Light", "Backscatter Light");
+       RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
+
+       prop= RNA_def_property(srna, "sun_intensity", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_range(prop, 0.0f, 10.0f);
+       RNA_def_property_ui_text(prop, "Sun Intensity", "Sun Intensity");
+       RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
+
+       prop= RNA_def_property(srna, "atm_turbidity", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_range(prop, 0.0f, 30.0f);
+       RNA_def_property_ui_text(prop, "Turbidity", "Sky Turbidity");
+       RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
+
+       prop= RNA_def_property(srna, "atm_inscattering_factor", PROP_FLOAT, 
PROP_NONE);
+       RNA_def_property_range(prop, 0.0f, 1.0f);
+       RNA_def_property_ui_text(prop, "Inscatter", "Scatter contribution 
factor");
+       RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
+
+       prop= RNA_def_property(srna, "atm_extinction_factor", PROP_FLOAT, 
PROP_NONE);
+       RNA_def_property_range(prop, 0.0f, 1.0f);
+       RNA_def_property_ui_text(prop, "Extinction", "Extinction scattering 
contribution factor");
+       RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
+
+       prop= RNA_def_property(srna, "atm_distance_factor", PROP_FLOAT, 
PROP_NONE);
+       RNA_def_property_range(prop, 0.0f, 500.0f);
+       RNA_def_property_ui_text(prop, "Distance", "Multiplier to convert 
blender units to physical distance");
+       RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
+
+       prop= RNA_def_property(srna, "sky_blend_factor", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "skyblendfac");
+       RNA_def_property_range(prop, 0.0f, 2.0f);
+       RNA_def_property_ui_text(prop, "Sky Blend Factor", "Blend factor with 
sky");
+       RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
+
+       prop= RNA_def_property(srna, "sky_exposure", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_range(prop, 0.0f, 20.0f);
+       RNA_def_property_ui_text(prop, "Sky Exposure", "Strength of sky shading 
exponential exposure correction.");
+       RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
+
+       /* boolean */
+       
+       prop= RNA_def_property(srna, "sky", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "sun_effect_type", 
LA_SUN_EFFECT_SKY);
+       RNA_def_property_ui_text(prop, "Sky", "Apply sun effect on sky");
+       RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
+
+       prop= RNA_def_property(srna, "atmosphere", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "sun_effect_type", 
LA_SUN_EFFECT_AP);
+       RNA_def_property_ui_text(prop, "Atmosphere", "Apply sun effect on 
Atmosphere");
+       RNA_def_property_update(prop, NC_LAMP|ND_SKY, NULL);
+}
+
+void rna_def_lamp(BlenderRNA *brna)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
        static EnumPropertyItem prop_type_items[] = {
-               {LA_LOCAL, "LOCAL", "Local", ""},
+               {LA_LOCAL, "OMNI", "Omni", ""},
                {LA_SUN, "SUN", "Sun", ""},
                {LA_SPOT, "SPOT", "Spot", ""},
                {LA_HEMI, "HEMI", "Hemi", ""},
@@ -62,9 +190,9 @@
                {LA_SHAD_RAY, "RAYSHADOW", "Ray Shadow", "Use ray tracing for 
shadow."},
                {0, NULL, NULL, NULL}};
        static EnumPropertyItem prop_raysampmethod_items[] = {
-               {LA_SAMP_CONSTANT, "CONSTANT", "Constant", ""},
-               {LA_SAMP_HALTON, "HALTON", "Halton", ""},
-               {LA_SHAD_RAY, "LA_SAMP_HAMMERSLEY", "Hammersley", ""},
+               {LA_SAMP_CONSTANT, "CONSTANT_JITTERED", "Constant Jittered", 
""},
+               {LA_SAMP_HALTON, "ADAPTIVE_QMC", "Adaptive QMC", ""},
+               {LA_SAMP_HAMMERSLEY, "CONSTANT_QMC", "Constant QMC", ""},
                {0, NULL, NULL, NULL}};
        static EnumPropertyItem prop_areashape_items[] = {
                {LA_AREA_SQUARE, "SQUARE", "Square", ""},
@@ -85,29 +213,6 @@
                {4, "4BUFF", "4", "Sample 4 Shadow Buffers."},
                {9, "9BUFF", "9", "Sample 9 Shadow Buffers."},
                {0, NULL, NULL, NULL}};
-       static EnumPropertyItem prop_skycolorspace_items[] = {
-               {0, "SMPTE", "SMPTE", ""},
-               {1, "REC709", "REC709", ""},
-               {2, "CIE", "CIE", ""},
-               {0, NULL, NULL, NULL}};
-       static EnumPropertyItem prop_blendmode_items[] = {
-               {0, "MIX", "Mix", ""},
-               {1, "ADD", "Add", ""},
-               {2, "MULTIPLY", "Multiply", ""},
-               {3, "SUBTRACT", "Subtract", ""},
-               {4, "SCREEN", "Screen", ""},
-               {5, "DIVIDE", "Divide", ""},
-               {6, "DIFFERENCE", "Difference", ""},
-               {7, "DARKEN", "Darken", ""},
-               {8, "LIGHTEN", "Lighten", ""},
-               {9, "OVERLAY", "Overlay", ""},
-               {10, "DODGE", "Dodge", ""},
-               {11, "BURN", "Burn", ""},
-               {12, "HUE", "Hue", ""},
-               {13, "SATURATION", "Saturation", ""},
-               {14, "VALUE", "Value", ""},
-               {15, "COLOR", "Color", ""},
-               {0, NULL, NULL, NULL}};
        static EnumPropertyItem prop_fallofftype_items[] = {
                {LA_FALLOFF_CONSTANT, "CONSTANT", "Constant", ""},
                {LA_FALLOFF_INVLINEAR, "INVLINEAR", "Inverse Linear", ""},
@@ -123,182 +228,149 @@
        prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_items(prop, prop_type_items);
        RNA_def_property_ui_text(prop, "Type", "Type of Lamp.");
+       RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
 
-       prop= RNA_def_property(srna, "sky_colorspace", PROP_ENUM, PROP_NONE);
-       RNA_def_property_enum_items(prop, prop_skycolorspace_items);
-       RNA_def_property_ui_text(prop, "Sky Color Space", "");
-
-       prop= RNA_def_property(srna, "sky_blend_type", PROP_ENUM, PROP_NONE);
-       RNA_def_property_enum_sdna(prop, NULL, "skyblendtype");
-       RNA_def_property_enum_items(prop, prop_blendmode_items);
-       RNA_def_property_ui_text(prop, "Sky Blend Type", "Blend type for how 
sky is combined with world sky");
-
        prop= RNA_def_property(srna, "area_shape", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_items(prop, prop_areashape_items);
        RNA_def_property_ui_text(prop, "Area Shape", "Shape of the Area lamp");
+       RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING_DRAW, NULL);
 
        prop= RNA_def_property(srna, "ray_samp_method", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_items(prop, prop_raysampmethod_items);
        RNA_def_property_ui_text(prop, "Ray Sample Method", "The Method in how 
rays are sampled");
+       RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
 
        prop= RNA_def_property(srna, "buffer_type", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "buftype");
        RNA_def_property_enum_items(prop, prop_shadbuftype_items);

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to