diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-09-16 22:04:01 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-09-16 22:04:01 +0400 |
commit | feff78170d088bc2c2b5c0824c247895ea0987b1 (patch) | |
tree | 7eb6b3a175dd4d4e65098faa3d417ead3db23b5f /source | |
parent | 6b5ba700594051b834008020b9371601ee52268c (diff) |
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.
Diffstat (limited to 'source')
24 files changed, 208 insertions, 113 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index ca3ac62ba00..40f640473db 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -249,7 +249,6 @@ extern StructRNA RNA_LimitDistanceConstraint; 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_PointCache; 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; diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index e7fe86afd03..353c859cf27 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -110,9 +110,6 @@ typedef enum PropertySubType { PROP_XYZ = 28, PROP_RGB = 29, - /* pointers */ - PROP_NEVER_NULL = 30, - /* booleans */ PROP_LAYER = 40, PROP_LAYER_MEMBER = 41 @@ -149,6 +146,7 @@ typedef enum PropertyFlag { /* pointers */ PROP_ID_REFCOUNT = 64, + PROP_NEVER_NULL = 262144, /* internal flags */ PROP_BUILTIN = 128, diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index d0c7824dc9d..c734cdfec87 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -1419,7 +1419,6 @@ static const char *rna_property_subtypename(PropertyType type) 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: { diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 9472cdb300c..738d52bfbcd 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -1409,10 +1409,17 @@ PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop) void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr_value) { - PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop; + IDProperty *idprop; + + if((idprop=rna_idproperty_check(&prop, ptr))) { + /* not supported */ + } + else { + PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop; - if(pprop->set) - pprop->set(ptr, ptr_value); + 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) diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 70daa3690da..eea29381b92 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -219,7 +219,8 @@ static void rna_def_brush(BlenderRNA *brna) 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 */ diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 0b54d4a8e14..45517546c16 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -134,7 +134,7 @@ PropertyDefRNA *rna_find_struct_property_def(StructRNA *srna, PropertyRNA *prop) 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 @@ PropertyDefRNA *rna_find_struct_property_def(StructRNA *srna, PropertyRNA *prop) return NULL; } +#if 0 static PropertyDefRNA *rna_find_property_def(PropertyRNA *prop) { PropertyDefRNA *dprop; @@ -175,6 +176,7 @@ static PropertyDefRNA *rna_find_property_def(PropertyRNA *prop) return NULL; } +#endif FunctionDefRNA *rna_find_function_def(FunctionRNA *func) { diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c index fbe339fe7f3..e66ee683e61 100644 --- a/source/blender/makesrna/intern/rna_key.c +++ b/source/blender/makesrna/intern/rna_key.c @@ -414,7 +414,8 @@ static void rna_def_key(BlenderRNA *brna) 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 @@ static void rna_def_key(BlenderRNA *brna) 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."); diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c index dc59a75edbc..d00a0d61bf6 100644 --- a/source/blender/makesrna/intern/rna_lamp.c +++ b/source/blender/makesrna/intern/rna_lamp.c @@ -99,7 +99,7 @@ static StructRNA* rna_Lamp_refine(struct PointerRNA *ptr) 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 @@ static void rna_def_lamp_shadow(StructRNA *srna, int spot, int area) 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 @@ static void rna_def_area_lamp(BlenderRNA *brna) 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 @@ static void rna_def_spot_lamp(BlenderRNA *brna) 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 @@ static void rna_def_sun_lamp(BlenderRNA *brna) 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 @@ static void rna_def_hemi_lamp(BlenderRNA *brna) 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); diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index e23333713c4..18c0dc42e17 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -667,6 +667,7 @@ static void rna_def_material_colors(StructRNA *srna) 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 @@ static void rna_def_material_colors(StructRNA *srna) 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 @@ void RNA_def_material(BlenderRNA *brna) 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); RNA_def_property_ui_text(prop, "Raytrace Mirror", "Raytraced reflection settings for the material."); - prop= RNA_def_property(srna, "raytrace_transparency", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "raytrace_transparency", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "MaterialRaytraceTransparency"); RNA_def_property_pointer_funcs(prop, "rna_Material_transp_get", NULL, NULL); RNA_def_property_ui_text(prop, "Raytrace Transparency", "Raytraced reflection settings for the material."); - prop= RNA_def_property(srna, "volume", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "volume", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "vol"); RNA_def_property_struct_type(prop, "MaterialVolume"); RNA_def_property_ui_text(prop, "Volume", "Volume settings for the material."); - prop= RNA_def_property(srna, "halo", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "halo", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "MaterialHalo"); RNA_def_property_pointer_funcs(prop, "rna_Material_halo_get", NULL, NULL); RNA_def_property_ui_text(prop, "Halo", "Halo settings for the material."); - prop= RNA_def_property(srna, "subsurface_scattering", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "subsurface_scattering", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "MaterialSubsurfaceScattering"); RNA_def_property_pointer_funcs(prop, "rna_Material_sss_get", NULL, NULL); RNA_def_property_ui_text(prop, "Subsurface Scattering", "Subsurface scattering settings for the material."); - prop= RNA_def_property(srna, "strand", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "strand", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "MaterialStrand"); RNA_def_property_pointer_funcs(prop, "rna_Material_strand_get", NULL, NULL); RNA_def_property_ui_text(prop, "Strand", "Strand settings for the material."); - prop= RNA_def_property(srna, "physics", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "physics", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "MaterialPhysics"); RNA_def_property_pointer_funcs(prop, "rna_Material_physics_get", NULL, NULL); RNA_def_property_ui_text(prop, "Physics", "Game physics settings."); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 32e34559f1f..ffc2d78a6ce 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -930,12 +930,14 @@ static void rna_def_modifier_softbody(BlenderRNA *brna) RNA_def_struct_sdna(srna, "SoftbodyModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_SOFT); - prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "SoftBodySettings"); RNA_def_property_pointer_funcs(prop, "rna_SoftBodyModifier_settings_get", NULL, NULL); RNA_def_property_ui_text(prop, "Soft Body Settings", ""); - prop= RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "PointCache"); RNA_def_property_pointer_funcs(prop, "rna_SoftBodyModifier_point_cache_get", NULL, NULL); RNA_def_property_ui_text(prop, "Soft Body Point Cache", ""); @@ -1551,15 +1553,18 @@ static void rna_def_modifier_cloth(BlenderRNA *brna) RNA_def_struct_sdna(srna, "ClothModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_CLOTH); - prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "sim_parms"); RNA_def_property_ui_text(prop, "Cloth Settings", ""); - prop= RNA_def_property(srna, "collision_settings", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "collision_settings", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "coll_parms"); RNA_def_property_ui_text(prop, "Cloth Collision Settings", ""); - prop= RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_ui_text(prop, "Point Cache", ""); } @@ -1609,7 +1614,8 @@ static void rna_def_modifier_collision(BlenderRNA *brna) RNA_def_struct_sdna(srna, "CollisionModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_PHYSICS); - prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "CollisionSettings"); RNA_def_property_pointer_funcs(prop, "rna_CollisionModifier_settings_get", NULL, NULL); RNA_def_property_ui_text(prop, "Settings", ""); @@ -1780,7 +1786,8 @@ static void rna_def_modifier_fluidsim(BlenderRNA *brna) RNA_def_struct_sdna(srna, "FluidsimModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_FLUIDSIM); - prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "fss"); RNA_def_property_ui_text(prop, "Settings", "Settings for how this object is used in the fluid simulation."); } diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 3d43dfdfc2c..8e805597e11 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -1224,7 +1224,8 @@ static void rna_def_object(BlenderRNA *brna) /* game engine */ - prop= RNA_def_property(srna, "game", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "game", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "GameObjectSettings"); RNA_def_property_pointer_funcs(prop, "rna_Object_game_settings_get", NULL, NULL); RNA_def_property_ui_text(prop, "Game Settings", "Game engine related settings for the object."); diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index bbbb13c6e97..02fa0c25335 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -1871,10 +1871,10 @@ static void rna_def_particle_system(BlenderRNA *brna) /* access to particle settings is redirected through functions */ /* to allow proper id-buttons functionality */ - prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE); //RNA_def_property_pointer_sdna(prop, NULL, "part"); RNA_def_property_struct_type(prop, "ParticleSettings"); - RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_NULL); RNA_def_property_pointer_funcs(prop, "rna_particle_settings_get", "rna_particle_settings_set", NULL); RNA_def_property_ui_text(prop, "Settings", "Particle system settings."); RNA_def_property_update(prop, 0, "rna_Particle_reset"); @@ -1904,9 +1904,10 @@ static void rna_def_particle_system(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Hair Dynamics", "Enable hair dynamics using cloth simulation."); RNA_def_property_update(prop, 0, "rna_Particle_hair_dynamics"); - prop= RNA_def_property(srna, "cloth", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "cloth", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "clmd"); RNA_def_property_struct_type(prop, "ClothModifier"); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Cloth", "Cloth dynamics for hair"); @@ -2082,7 +2083,8 @@ static void rna_def_particle_system(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Particle_reset"); /* pointcache */ - prop= RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "pointcache"); RNA_def_property_struct_type(prop, "PointCache"); RNA_def_property_ui_text(prop, "Point Cache", ""); diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index b568fb38dfb..b5c0716bed1 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -428,7 +428,8 @@ static void rna_def_bone_group(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update"); // TODO: editing the colors for this should result in changes to the color type... - prop= RNA_def_property(srna, "colors", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "colors", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "ThemeBoneColorSet"); RNA_def_property_pointer_sdna(prop, NULL, "cs"); /* NOTE: the DNA data is not really a pointer, but this code works :) */ RNA_def_property_ui_text(prop, "Colors", "Copy of the colors associated with the group's color set."); @@ -486,7 +487,8 @@ static void rna_def_pose_channel(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT|ND_POSE|ND_TRANSFORM, "rna_Pose_update"); /* Relationships to other bones */ - prop= RNA_def_property(srna, "bone", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "bone", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "Bone"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Bone", "Bone associated with this Pose Channel."); diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 196d25ada86..37a1c9fb186 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -853,7 +853,6 @@ static void rna_def_property(BlenderRNA *brna) {PROP_QUATERNION, "QUATERNION", 0, "Quaternion", ""}, {PROP_XYZ, "XYZ", 0, "XYZ", ""}, {PROP_RGB, "RGB", 0, "RGB", ""}, - {PROP_NEVER_NULL, "NEVER_NULL", 0, "Never Null", ""}, {PROP_LAYER, "LAYER", 0, "Layer", ""}, {PROP_LAYER_MEMBER, "LAYER_MEMBERSHIP", 0, "Layer Membership", ""}, {0, NULL, 0, NULL, NULL}}; diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 15329b126d3..e82f25a11fd 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -2032,19 +2032,22 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL); /* Tool Settings */ - prop= RNA_def_property(srna, "tool_settings", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "tool_settings", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "toolsettings"); RNA_def_property_struct_type(prop, "ToolSettings"); RNA_def_property_ui_text(prop, "Tool Settings", ""); /* Unit Settings */ - prop= RNA_def_property(srna, "unit_settings", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "unit_settings", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "unit"); RNA_def_property_struct_type(prop, "UnitSettings"); RNA_def_property_ui_text(prop, "Unit Settings", "Unit editing settings"); /* Render Data */ - prop= RNA_def_property(srna, "render_data", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "render_data", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "r"); RNA_def_property_struct_type(prop, "SceneRenderData"); RNA_def_property_ui_text(prop, "Render Data", ""); @@ -2056,7 +2059,8 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Timeline Markers", "Markers used in all timelines for the current scene."); /* Game Settings */ - prop= RNA_def_property(srna, "game_data", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "game_data", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "gm"); RNA_def_property_struct_type(prop, "SceneGameData"); RNA_def_property_ui_text(prop, "Game Data", ""); diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index 7a243327bd1..2a72845dd42 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -135,10 +135,10 @@ static void rna_def_screen(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Screen", "Screen datablock, defining the layout of areas in a window."); RNA_def_struct_ui_icon(srna, ICON_SPLITSCREEN); - prop= RNA_def_property(srna, "scene", PROP_POINTER, PROP_NEVER_NULL); - RNA_def_property_ui_text(prop, "Scene", "Active scene to be edited in the screen."); - RNA_def_property_flag(prop, PROP_EDITABLE); + prop= RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_NULL); RNA_def_property_pointer_funcs(prop, NULL, "rna_Screen_scene_set", NULL); + RNA_def_property_ui_text(prop, "Scene", "Active scene to be edited in the screen."); RNA_def_property_update(prop, 0, "rna_Screen_scene_update"); prop= RNA_def_property(srna, "areas", PROP_COLLECTION, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index 943129c7169..7bccd685c1d 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -211,11 +211,13 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Logarithmic dissolve", "Using 1/x "); RNA_def_property_update(prop, 0, NULL); - prop= RNA_def_property(srna, "point_cache_low", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "point_cache_low", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "point_cache[0]"); RNA_def_property_ui_text(prop, "Point Cache", ""); - prop= RNA_def_property(srna, "point_cache_high", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "point_cache_high", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "point_cache[1]"); RNA_def_property_ui_text(prop, "Point Cache", ""); } diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index bb01ab9a9c7..c2f565e4912 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -491,7 +491,8 @@ static void rna_def_background_image(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); - prop= RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "iuser"); RNA_def_property_ui_text(prop, "Image User", "Parameters defining which layer, pass and frame of the image is displayed."); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); @@ -779,7 +780,8 @@ static void rna_def_space_image(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL); - prop= RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "iuser"); RNA_def_property_ui_text(prop, "Image User", "Parameters defining which layer, pass and frame of the image is displayed."); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL); @@ -808,7 +810,8 @@ static void rna_def_space_image(BlenderRNA *brna) RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL); /* uv */ - prop= RNA_def_property(srna, "uv_editor", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "uv_editor", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "SpaceUVEditor"); RNA_def_property_pointer_funcs(prop, "rna_SpaceImageEditor_uvedit_get", NULL, NULL); RNA_def_property_ui_text(prop, "UV Editor", "UV editor settings."); diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c index 22cf7e7aeae..8c9b2b58887 100644 --- a/source/blender/makesrna/intern/rna_text.c +++ b/source/blender/makesrna/intern/rna_text.c @@ -198,7 +198,8 @@ static void rna_def_text(BlenderRNA *brna) RNA_def_property_struct_type(prop, "TextLine"); RNA_def_property_ui_text(prop, "Lines", "Lines of text."); - prop= RNA_def_property(srna, "current_line", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "current_line", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "curl"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "TextLine"); @@ -209,7 +210,8 @@ static void rna_def_text(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Current Character", "Index of current character in current line, and also start index of character in selection if one exists."); - prop= RNA_def_property(srna, "selection_end_line", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "selection_end_line", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "sell"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "TextLine"); diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index e3cae8ab453..16bc988a54b 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -89,7 +89,7 @@ static void api_ui_item_rna_common(FunctionRNA *func) PropertyRNA *parm; parm= RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property."); - RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL); parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in data."); RNA_def_property_flag(parm, PROP_REQUIRED); } @@ -146,7 +146,7 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail."); RNA_def_boolean(func, "slider", 0, "", "Use slider widget for numeric values."); RNA_def_boolean(func, "toggle", 0, "", "Use toggle widget for boolean values."); - RNA_def_boolean(func, "icon_only", 0, "", "Only show the property's icon, with no text"); + RNA_def_boolean(func, "icon_only", 0, "", "Draw only icons in buttons, no text."); func= RNA_def_function(srna, "items_enumR", "uiItemsEnumR"); api_ui_item_rna_common(func); @@ -165,7 +165,7 @@ void RNA_api_ui_layout(StructRNA *srna) api_ui_item_common(func); api_ui_item_rna_common(func); parm= RNA_def_pointer(func, "search_data", "AnyType", "", "Data from which to take collection to search in."); - RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL); parm= RNA_def_string(func, "search_property", "", 0, "", "Identifier of search collection property."); RNA_def_property_flag(parm, PROP_REQUIRED); @@ -254,21 +254,21 @@ void RNA_api_ui_layout(StructRNA *srna) func= RNA_def_function(srna, "template_modifier", "uiTemplateModifier"); parm= RNA_def_pointer(func, "data", "Modifier", "", "Modifier data."); - RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL); parm= RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in."); RNA_def_function_return(func, parm); func= RNA_def_function(srna, "template_constraint", "uiTemplateConstraint"); parm= RNA_def_pointer(func, "data", "Constraint", "", "Constraint data."); - RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL); parm= RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in."); RNA_def_function_return(func, parm); func= RNA_def_function(srna, "template_preview", "uiTemplatePreview"); parm= RNA_def_pointer(func, "id", "ID", "", "ID datablock."); RNA_def_property_flag(parm, PROP_REQUIRED); - parm= RNA_def_pointer(func, "parent", "ID", "", "ID datablock."); - parm= RNA_def_pointer(func, "slot", "TextureSlot", "", "Texture slot."); + RNA_def_pointer(func, "parent", "ID", "", "ID datablock."); + RNA_def_pointer(func, "slot", "TextureSlot", "", "Texture slot."); func= RNA_def_function(srna, "template_curve_mapping", "uiTemplateCurveMapping"); parm= RNA_def_pointer(func, "curvemap", "CurveMapping", "", "Curve mapping pointer."); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 1a000525fda..b38475469b0 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -197,25 +197,29 @@ static void rna_def_userdef_theme_ui_style(BlenderRNA *brna) RNA_def_property_range(prop, 0.5, 2.0); RNA_def_property_ui_text(prop, "Panel Zoom", "Default zoom level for panel areas."); - prop= RNA_def_property(srna, "paneltitle", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "paneltitle", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "paneltitle"); RNA_def_property_struct_type(prop, "ThemeFontStyle"); RNA_def_property_ui_text(prop, "Panel Font", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop= RNA_def_property(srna, "grouplabel", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "grouplabel", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "grouplabel"); RNA_def_property_struct_type(prop, "ThemeFontStyle"); RNA_def_property_ui_text(prop, "Group Label Font", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop= RNA_def_property(srna, "widgetlabel", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "widgetlabel", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "widgetlabel"); RNA_def_property_struct_type(prop, "ThemeFontStyle"); RNA_def_property_ui_text(prop, "Widget Label Font", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop= RNA_def_property(srna, "widget", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "widget", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "widget"); RNA_def_property_struct_type(prop, "ThemeFontStyle"); RNA_def_property_ui_text(prop, "Widget Font", ""); @@ -334,97 +338,113 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna) RNA_def_struct_sdna(srna, "ThemeUI"); RNA_def_struct_ui_text(srna, "Theme User Interface", "Theme settings for user interface elements."); - prop= RNA_def_property(srna, "wcol_regular", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "wcol_regular", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "wcol_regular"); RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Regular Widget Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop= RNA_def_property(srna, "wcol_tool", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "wcol_tool", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "wcol_tool"); RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Tool Widget Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop= RNA_def_property(srna, "wcol_radio", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "wcol_radio", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "wcol_radio"); RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Radio Widget Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop= RNA_def_property(srna, "wcol_text", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "wcol_text", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "wcol_text"); RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Text Widget Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop= RNA_def_property(srna, "wcol_option", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "wcol_option", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "wcol_option"); RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Option Widget Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop= RNA_def_property(srna, "wcol_toggle", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "wcol_toggle", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "wcol_toggle"); RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Toggle Widget Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop= RNA_def_property(srna, "wcol_num", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "wcol_num", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "wcol_num"); RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Number Widget Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop= RNA_def_property(srna, "wcol_numslider", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "wcol_numslider", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "wcol_numslider"); RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Slider Widget Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop= RNA_def_property(srna, "wcol_box", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "wcol_box", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "wcol_box"); RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Box Backdrop Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop= RNA_def_property(srna, "wcol_menu", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "wcol_menu", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "wcol_menu"); RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Menu Widget Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop= RNA_def_property(srna, "wcol_pulldown", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "wcol_pulldown", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "wcol_pulldown"); RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Pulldown Widget Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop= RNA_def_property(srna, "wcol_menu_back", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "wcol_menu_back", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "wcol_menu_back"); RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Menu Backdrop Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop= RNA_def_property(srna, "wcol_menu_item", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "wcol_menu_item", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "wcol_menu_item"); RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Menu Item Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop= RNA_def_property(srna, "wcol_scroll", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "wcol_scroll", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "wcol_scroll"); RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "Scroll Widget Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop= RNA_def_property(srna, "wcol_list_item", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "wcol_list_item", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "wcol_list_item"); RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_ui_text(prop, "List Item Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop= RNA_def_property(srna, "wcol_state", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "wcol_state", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "wcol_state"); RNA_def_property_struct_type(prop, "ThemeWidgetStateColors"); RNA_def_property_ui_text(prop, "State Colors", ""); @@ -1380,87 +1400,104 @@ static void rna_def_userdef_themes(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Name", "Name of the theme."); RNA_def_struct_name_property(srna, prop); - prop= RNA_def_property(srna, "user_interface", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "user_interface", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "tui"); RNA_def_property_struct_type(prop, "ThemeUserInterface"); RNA_def_property_ui_text(prop, "User Interface", ""); - prop= RNA_def_property(srna, "view_3d", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "view_3d", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "tv3d"); RNA_def_property_struct_type(prop, "ThemeView3D"); RNA_def_property_ui_text(prop, "3D View", ""); - prop= RNA_def_property(srna, "graph_editor", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "graph_editor", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "tipo"); RNA_def_property_struct_type(prop, "ThemeGraphEditor"); RNA_def_property_ui_text(prop, "Graph Editor", ""); - prop= RNA_def_property(srna, "file_browser", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "file_browser", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "tfile"); RNA_def_property_struct_type(prop, "ThemeFileBrowser"); RNA_def_property_ui_text(prop, "File Browser", ""); - prop= RNA_def_property(srna, "nla_editor", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "nla_editor", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "tnla"); RNA_def_property_struct_type(prop, "ThemeNLAEditor"); RNA_def_property_ui_text(prop, "NLA Editor", ""); - prop= RNA_def_property(srna, "dopesheet_editor", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "dopesheet_editor", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "tact"); RNA_def_property_struct_type(prop, "ThemeDopeSheet"); RNA_def_property_ui_text(prop, "DopeSheet", ""); - prop= RNA_def_property(srna, "image_editor", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "image_editor", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "tima"); RNA_def_property_struct_type(prop, "ThemeImageEditor"); RNA_def_property_ui_text(prop, "Image Editor", ""); - prop= RNA_def_property(srna, "sequence_editor", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "sequence_editor", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "tseq"); RNA_def_property_struct_type(prop, "ThemeSequenceEditor"); RNA_def_property_ui_text(prop, "Sequence Editor", ""); - prop= RNA_def_property(srna, "properties", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "tbuts"); RNA_def_property_struct_type(prop, "ThemeProperties"); RNA_def_property_ui_text(prop, "Properties", ""); - prop= RNA_def_property(srna, "text_editor", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "text_editor", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "text"); RNA_def_property_struct_type(prop, "ThemeTextEditor"); RNA_def_property_ui_text(prop, "Text Editor", ""); - prop= RNA_def_property(srna, "timeline", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "timeline", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "ttime"); RNA_def_property_struct_type(prop, "ThemeTimeline"); RNA_def_property_ui_text(prop, "Timeline", ""); - prop= RNA_def_property(srna, "node_editor", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "node_editor", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "tnode"); RNA_def_property_struct_type(prop, "ThemeNodeEditor"); RNA_def_property_ui_text(prop, "Node Editor", ""); - prop= RNA_def_property(srna, "logic_editor", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "logic_editor", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "tlogic"); RNA_def_property_struct_type(prop, "ThemeLogicEditor"); RNA_def_property_ui_text(prop, "Logic Editor", ""); - prop= RNA_def_property(srna, "outliner", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "outliner", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "toops"); RNA_def_property_struct_type(prop, "ThemeOutliner"); RNA_def_property_ui_text(prop, "Outliner", ""); - prop= RNA_def_property(srna, "info", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "info", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "tinfo"); RNA_def_property_struct_type(prop, "ThemeInfo"); RNA_def_property_ui_text(prop, "Info", ""); - prop= RNA_def_property(srna, "user_preferences", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "user_preferences", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "tuserpref"); RNA_def_property_struct_type(prop, "ThemeUserPreferences"); RNA_def_property_ui_text(prop, "User Preferences", ""); - prop= RNA_def_property(srna, "bone_color_sets", PROP_COLLECTION, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "bone_color_sets", PROP_COLLECTION, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_collection_sdna(prop, NULL, "tarm", ""); RNA_def_property_struct_type(prop, "ThemeBoneColorSet"); RNA_def_property_ui_text(prop, "Bone Color Sets", ""); @@ -2100,7 +2137,8 @@ static void rna_def_userdef_system(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_CUSTOM_RANGE); RNA_def_property_ui_text(prop, "Use Weight Color Range", "Enable color range used for weight visualization in weight painting mode."); - prop= RNA_def_property(srna, "weight_color_range", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "weight_color_range", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "coba_weight"); RNA_def_property_struct_type(prop, "ColorRamp"); RNA_def_property_ui_text(prop, "Weight Color Range", "Color range used for weight visualization in weight painting mode."); @@ -2331,27 +2369,32 @@ void RNA_def_userdef(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Styles", ""); /* nested structs */ - prop= RNA_def_property(srna, "view", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "view", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "UserPreferencesView"); RNA_def_property_pointer_funcs(prop, "rna_UserDef_view_get", NULL, NULL); RNA_def_property_ui_text(prop, "View & Controls", "Preferences related to viewing data."); - prop= RNA_def_property(srna, "edit", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "edit", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "UserPreferencesEdit"); RNA_def_property_pointer_funcs(prop, "rna_UserDef_edit_get", NULL, NULL); RNA_def_property_ui_text(prop, "Edit Methods", "Settings for interacting with Blender data."); - prop= RNA_def_property(srna, "language", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "language", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "UserPreferencesLanguage"); RNA_def_property_pointer_funcs(prop, "rna_UserDef_language_get", NULL, NULL); RNA_def_property_ui_text(prop, "Language & Font", "User interface translation settings."); - prop= RNA_def_property(srna, "filepaths", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "filepaths", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "UserPreferencesFilePaths"); RNA_def_property_pointer_funcs(prop, "rna_UserDef_filepaths_get", NULL, NULL); RNA_def_property_ui_text(prop, "File Paths", "Default paths for external files."); - prop= RNA_def_property(srna, "system", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "system", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "UserPreferencesSystem"); RNA_def_property_pointer_funcs(prop, "rna_UserDef_system_get", NULL, NULL); RNA_def_property_ui_text(prop, "System & OpenGL", "Graphics driver and operating system settings."); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 53532e3f383..fff51ad8ade 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -278,7 +278,8 @@ static void rna_def_operator(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Name", ""); RNA_def_struct_name_property(srna, prop); - prop= RNA_def_property(srna, "properties", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "OperatorProperties"); RNA_def_property_ui_text(prop, "Properties", ""); RNA_def_property_pointer_funcs(prop, "rna_Operator_properties_get", NULL, NULL); @@ -404,7 +405,8 @@ static void rna_def_window(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Window", "Open window."); RNA_def_struct_sdna(srna, "wmWindow"); - prop= RNA_def_property(srna, "screen", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "screen", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "Screen"); RNA_def_property_ui_text(prop, "Screen", "Active screen showing in the window."); RNA_def_property_flag(prop, PROP_EDITABLE); diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index d2eebbc61aa..c6068d0a650 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -461,17 +461,20 @@ void RNA_def_world(BlenderRNA *brna) RNA_def_property_update(prop, NC_WORLD, NULL); /* nested structs */ - prop= RNA_def_property(srna, "ambient_occlusion", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "ambient_occlusion", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "WorldAmbientOcclusion"); RNA_def_property_pointer_funcs(prop, "rna_World_ambient_occlusion_get", NULL, NULL); RNA_def_property_ui_text(prop, "Ambient Occlusion", "World ambient occlusion settings."); - prop= RNA_def_property(srna, "mist", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "mist", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "WorldMistSettings"); RNA_def_property_pointer_funcs(prop, "rna_World_mist_get", NULL, NULL); RNA_def_property_ui_text(prop, "Mist", "World mist settings."); - prop= RNA_def_property(srna, "stars", PROP_POINTER, PROP_NEVER_NULL); + prop= RNA_def_property(srna, "stars", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "WorldStarsSettings"); RNA_def_property_pointer_funcs(prop, "rna_World_stars_get", NULL, NULL); RNA_def_property_ui_text(prop, "Stars", "World stars settings."); diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index c2335bea995..65c701c0041 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -628,17 +628,18 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *v case PROP_POINTER: { StructRNA *ptype= RNA_property_pointer_type(ptr, prop); + int flag = RNA_property_flag(prop); if(!BPy_StructRNA_Check(value) && value != Py_None) { - PointerRNA tmp; - RNA_pointer_create(NULL, ptype, NULL, &tmp); - PyErr_Format(PyExc_TypeError, "%.200s expected a %.200s type", error_prefix, RNA_struct_identifier(tmp.type)); + PyErr_Format(PyExc_TypeError, "%.200s expected a %.200s type", error_prefix, RNA_struct_identifier(ptype)); + return -1; + } else if((flag & PROP_NEVER_NULL) && value == Py_None) { + PyErr_Format(PyExc_TypeError, "property can't be assigned a None value"); return -1; } else { BPy_StructRNA *param= (BPy_StructRNA*)value; int raise_error= FALSE; if(data) { - int flag = RNA_property_flag(prop); if(flag & PROP_RNAPTR) { if(value == Py_None) |