Revision: 23279 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23279 Author: blendix Date: 2009-09-16 20:04:01 +0200 (Wed, 16 Sep 2009)
Log Message: ----------- RNA * PROP_NEVER_NULL is now a flag instead of a subtype. * It works for function parameters too now, so setting this flag can help avoid NULL checks in the function. * Renamed LocalLamp to PointLamp, making it consistent with the UI name. * Set icons for the different lamp struct types. Modified Paths: -------------- trunk/blender/source/blender/makesrna/RNA_access.h trunk/blender/source/blender/makesrna/RNA_types.h trunk/blender/source/blender/makesrna/intern/makesrna.c trunk/blender/source/blender/makesrna/intern/rna_access.c trunk/blender/source/blender/makesrna/intern/rna_brush.c trunk/blender/source/blender/makesrna/intern/rna_define.c trunk/blender/source/blender/makesrna/intern/rna_key.c trunk/blender/source/blender/makesrna/intern/rna_lamp.c trunk/blender/source/blender/makesrna/intern/rna_material.c trunk/blender/source/blender/makesrna/intern/rna_modifier.c trunk/blender/source/blender/makesrna/intern/rna_object.c trunk/blender/source/blender/makesrna/intern/rna_particle.c trunk/blender/source/blender/makesrna/intern/rna_pose.c trunk/blender/source/blender/makesrna/intern/rna_rna.c trunk/blender/source/blender/makesrna/intern/rna_scene.c trunk/blender/source/blender/makesrna/intern/rna_screen.c trunk/blender/source/blender/makesrna/intern/rna_smoke.c trunk/blender/source/blender/makesrna/intern/rna_space.c trunk/blender/source/blender/makesrna/intern/rna_text.c trunk/blender/source/blender/makesrna/intern/rna_ui_api.c trunk/blender/source/blender/makesrna/intern/rna_userdef.c trunk/blender/source/blender/makesrna/intern/rna_wm.c trunk/blender/source/blender/makesrna/intern/rna_world.c trunk/blender/source/blender/python/intern/bpy_rna.c Modified: trunk/blender/source/blender/makesrna/RNA_access.h =================================================================== --- trunk/blender/source/blender/makesrna/RNA_access.h 2009-09-16 17:43:09 UTC (rev 23278) +++ trunk/blender/source/blender/makesrna/RNA_access.h 2009-09-16 18:04:01 UTC (rev 23279) @@ -249,7 +249,6 @@ extern StructRNA RNA_LimitLocationConstraint; extern StructRNA RNA_LimitRotationConstraint; extern StructRNA RNA_LimitScaleConstraint; -extern StructRNA RNA_LocalLamp; extern StructRNA RNA_LockedTrackConstraint; extern StructRNA RNA_MagicTexture; extern StructRNA RNA_Main; @@ -329,6 +328,7 @@ extern StructRNA RNA_PointDensity; extern StructRNA RNA_PointDensityTexture; extern StructRNA RNA_PointerProperty; +extern StructRNA RNA_PointLamp; extern StructRNA RNA_Pose; extern StructRNA RNA_PoseChannel; extern StructRNA RNA_Property; Modified: trunk/blender/source/blender/makesrna/RNA_types.h =================================================================== --- trunk/blender/source/blender/makesrna/RNA_types.h 2009-09-16 17:43:09 UTC (rev 23278) +++ trunk/blender/source/blender/makesrna/RNA_types.h 2009-09-16 18:04:01 UTC (rev 23279) @@ -110,9 +110,6 @@ PROP_XYZ = 28, PROP_RGB = 29, - /* pointers */ - PROP_NEVER_NULL = 30, - /* booleans */ PROP_LAYER = 40, PROP_LAYER_MEMBER = 41 @@ -149,6 +146,7 @@ /* pointers */ PROP_ID_REFCOUNT = 64, + PROP_NEVER_NULL = 262144, /* internal flags */ PROP_BUILTIN = 128, Modified: trunk/blender/source/blender/makesrna/intern/makesrna.c =================================================================== --- trunk/blender/source/blender/makesrna/intern/makesrna.c 2009-09-16 17:43:09 UTC (rev 23278) +++ trunk/blender/source/blender/makesrna/intern/makesrna.c 2009-09-16 18:04:01 UTC (rev 23279) @@ -1419,7 +1419,6 @@ case PROP_ACCELERATION: return "PROP_ACCELERATION"; case PROP_XYZ: return "PROP_XYZ"; case PROP_RGB: return "PROP_RGB"; - case PROP_NEVER_NULL: return "PROP_NEVER_NULL"; case PROP_LAYER: return "PROP_LAYER"; case PROP_LAYER_MEMBER: return "PROP_LAYER_MEMBER"; default: { Modified: trunk/blender/source/blender/makesrna/intern/rna_access.c =================================================================== --- trunk/blender/source/blender/makesrna/intern/rna_access.c 2009-09-16 17:43:09 UTC (rev 23278) +++ trunk/blender/source/blender/makesrna/intern/rna_access.c 2009-09-16 18:04:01 UTC (rev 23279) @@ -1409,10 +1409,17 @@ void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr_value) { - PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop; + IDProperty *idprop; - if(pprop->set) - pprop->set(ptr, ptr_value); + if((idprop=rna_idproperty_check(&prop, ptr))) { + /* not supported */ + } + else { + PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop; + + if(pprop->set && !((prop->flag & PROP_NEVER_NULL) && ptr_value.data == NULL)) + pprop->set(ptr, ptr_value); + } } void RNA_property_pointer_add(PointerRNA *ptr, PropertyRNA *prop) Modified: trunk/blender/source/blender/makesrna/intern/rna_brush.c =================================================================== --- trunk/blender/source/blender/makesrna/intern/rna_brush.c 2009-09-16 17:43:09 UTC (rev 23278) +++ trunk/blender/source/blender/makesrna/intern/rna_brush.c 2009-09-16 18:04:01 UTC (rev 23279) @@ -219,7 +219,8 @@ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_FIXED_TEX); RNA_def_property_ui_text(prop, "Fixed Texture", "Keep texture origin in fixed position.");*/ - prop= RNA_def_property(srna, "curve", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_ui_text(prop, "Curve", "Editable falloff curve."); /* texture */ Modified: trunk/blender/source/blender/makesrna/intern/rna_define.c =================================================================== --- trunk/blender/source/blender/makesrna/intern/rna_define.c 2009-09-16 17:43:09 UTC (rev 23278) +++ trunk/blender/source/blender/makesrna/intern/rna_define.c 2009-09-16 18:04:01 UTC (rev 23279) @@ -134,7 +134,7 @@ if(!DefRNA.preprocess) { /* we should never get here */ - fprintf(stderr, "rna_find_property_def: only at preprocess time.\n"); + fprintf(stderr, "rna_find_struct_property_def: only at preprocess time.\n"); return NULL; } @@ -155,6 +155,7 @@ return NULL; } +#if 0 static PropertyDefRNA *rna_find_property_def(PropertyRNA *prop) { PropertyDefRNA *dprop; @@ -175,6 +176,7 @@ return NULL; } +#endif FunctionDefRNA *rna_find_function_def(FunctionRNA *func) { Modified: trunk/blender/source/blender/makesrna/intern/rna_key.c =================================================================== --- trunk/blender/source/blender/makesrna/intern/rna_key.c 2009-09-16 17:43:09 UTC (rev 23278) +++ trunk/blender/source/blender/makesrna/intern/rna_key.c 2009-09-16 18:04:01 UTC (rev 23279) @@ -414,7 +414,8 @@ RNA_def_struct_ui_text(srna, "Key", "Shape keys datablock containing different shapes of geometric datablocks."); RNA_def_struct_ui_icon(srna, ICON_SHAPEKEY_DATA); - prop= RNA_def_property(srna, "reference_key", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "reference_key", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_pointer_sdna(prop, NULL, "refkey"); RNA_def_property_ui_text(prop, "Reference Key", ""); @@ -426,7 +427,8 @@ rna_def_animdata_common(srna); - prop= RNA_def_property(srna, "user", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "user", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "from"); RNA_def_property_ui_text(prop, "User", "Datablock using these shape keys."); Modified: trunk/blender/source/blender/makesrna/intern/rna_lamp.c =================================================================== --- trunk/blender/source/blender/makesrna/intern/rna_lamp.c 2009-09-16 17:43:09 UTC (rev 23278) +++ trunk/blender/source/blender/makesrna/intern/rna_lamp.c 2009-09-16 18:04:01 UTC (rev 23279) @@ -99,7 +99,7 @@ switch(la->type) { case LA_LOCAL: - return &RNA_LocalLamp; + return &RNA_PointLamp; case LA_SUN: return &RNA_SunLamp; case LA_SPOT: @@ -477,13 +477,14 @@ RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL); } -static void rna_def_local_lamp(BlenderRNA *brna) +static void rna_def_point_lamp(BlenderRNA *brna) { StructRNA *srna; - srna= RNA_def_struct(brna, "LocalLamp", "Lamp"); + srna= RNA_def_struct(brna, "PointLamp", "Lamp"); RNA_def_struct_sdna(srna, "Lamp"); - RNA_def_struct_ui_text(srna, "Local Lamp", "Omnidirectional point lamp."); + RNA_def_struct_ui_text(srna, "Point Lamp", "Omnidirectional point lamp."); + RNA_def_struct_ui_icon(srna, ICON_LAMP_POINT); rna_def_lamp_falloff(srna); rna_def_lamp_shadow(srna, 0, 0); @@ -502,6 +503,7 @@ srna= RNA_def_struct(brna, "AreaLamp", "Lamp"); RNA_def_struct_sdna(srna, "Lamp"); RNA_def_struct_ui_text(srna, "Area Lamp", "Directional area lamp."); + RNA_def_struct_ui_icon(srna, ICON_LAMP_AREA); rna_def_lamp_shadow(srna, 0, 1); @@ -571,6 +573,7 @@ srna= RNA_def_struct(brna, "SpotLamp", "Lamp"); RNA_def_struct_sdna(srna, "Lamp"); RNA_def_struct_ui_text(srna, "Spot Lamp", "Directional cone lamp."); + RNA_def_struct_ui_icon(srna, ICON_LAMP_SPOT); rna_def_lamp_falloff(srna); rna_def_lamp_shadow(srna, 1, 0); @@ -683,11 +686,13 @@ srna= RNA_def_struct(brna, "SunLamp", "Lamp"); RNA_def_struct_sdna(srna, "Lamp"); RNA_def_struct_ui_text(srna, "Sun Lamp", "Constant direction parallel ray lamp."); + RNA_def_struct_ui_icon(srna, ICON_LAMP_SUN); rna_def_lamp_shadow(srna, 0, 0); /* sky */ - prop= RNA_def_property(srna, "sky", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "sky", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "LampSkySettings"); RNA_def_property_pointer_funcs(prop, "rna_Lamp_sky_settings_get", NULL, NULL); RNA_def_property_ui_text(prop, "Sky Settings", "Sky related settings for sun lamps."); @@ -702,12 +707,13 @@ srna= RNA_def_struct(brna, "HemiLamp", "Lamp"); RNA_def_struct_sdna(srna, "Lamp"); RNA_def_struct_ui_text(srna, "Hemi Lamp", "180 degree constant lamp."); + RNA_def_struct_ui_icon(srna, ICON_LAMP_HEMI); } void RNA_def_lamp(BlenderRNA *brna) { rna_def_lamp(brna); - rna_def_local_lamp(brna); + rna_def_point_lamp(brna); rna_def_area_lamp(brna); rna_def_spot_lamp(brna); rna_def_sun_lamp(brna); Modified: trunk/blender/source/blender/makesrna/intern/rna_material.c =================================================================== --- trunk/blender/source/blender/makesrna/intern/rna_material.c 2009-09-16 17:43:09 UTC (rev 23278) +++ trunk/blender/source/blender/makesrna/intern/rna_material.c 2009-09-16 18:04:01 UTC (rev 23279) @@ -667,6 +667,7 @@ RNA_def_property_pointer_sdna(prop, NULL, "ramp_col"); RNA_def_property_struct_type(prop, "ColorRamp"); RNA_def_property_ui_text(prop, "Diffuse Ramp", "Color ramp used to affect diffuse shading."); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW, NULL); prop= RNA_def_property(srna, "use_specular_ramp", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_RAMP_SPEC); @@ -678,6 +679,7 @@ RNA_def_property_pointer_sdna(prop, NULL, "ramp_spec"); RNA_def_property_struct_type(prop, "ColorRamp"); RNA_def_property_ui_text(prop, "Specular Ramp", "Color ramp used to affect specular shading."); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW, NULL); prop= RNA_def_property(srna, "diffuse_ramp_blend", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "rampblend_col"); @@ -1615,37 +1617,44 @@ RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); /* nested structs */ - prop= RNA_def_property(srna, "raytrace_mirror", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "raytrace_mirror", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "MaterialRaytraceMirror"); RNA_def_property_pointer_funcs(prop, "rna_Material_mirror_get", NULL, NULL); @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs