diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-08-24 10:40:28 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-08-24 10:40:28 +0400 |
commit | adae794233e168aa4046b560c43db6b48725cc08 (patch) | |
tree | 07760de7ef9a04b9912250d77b6450f05ac1be4c /source/blender/makesrna/intern/rna_main_api.c | |
parent | 70e99a3476aa66fa3ef1238643e9cf37e41ce0cd (diff) |
py/rna remove functions now all work in a similar way.
- some remove() functions took an int argument rather then the item to remove.
- disallow None argument.
- raise an error if the item isnt in the collection.
Diffstat (limited to 'source/blender/makesrna/intern/rna_main_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_main_api.c | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 49359e03985..4d77bfb9351 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -517,7 +517,7 @@ void RNA_def_main_cameras(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Remove a camera from the current blendfile."); parm= RNA_def_pointer(func, "camera", "Camera", "", "Camera to remove."); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop) @@ -540,10 +540,9 @@ void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "remove", "rna_Main_scenes_remove"); RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS); - parm= RNA_def_pointer(func, "scene", "Scene", "", "Scene to remove."); - RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_function_ui_description(func, "Remove a scene from the current blendfile."); - RNA_def_property_flag(parm, PROP_REQUIRED); + parm= RNA_def_pointer(func, "scene", "Scene", "", "Scene to remove."); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop) @@ -569,10 +568,10 @@ void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_return(func, parm); func= RNA_def_function(srna, "remove", "rna_Main_objects_remove"); + RNA_def_function_ui_description(func, "Remove a object from the current blendfile."); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm= RNA_def_pointer(func, "object", "Object", "", "Object to remove."); - RNA_def_property_flag(parm, PROP_REQUIRED); - RNA_def_function_ui_description(func, "Remove a object from the current blendfile."); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop) @@ -597,7 +596,7 @@ void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Remove a material from the current blendfile."); parm= RNA_def_pointer(func, "material", "Material", "", "Material to remove."); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop) { @@ -628,7 +627,7 @@ void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Remove a node tree from the current blendfile."); parm= RNA_def_pointer(func, "tree", "NodeTree", "", "Node tree to remove."); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); #endif } void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop) @@ -653,7 +652,7 @@ void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Remove a mesh from the current blendfile."); parm= RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to remove."); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } void RNA_def_main_lamps(BlenderRNA *brna, PropertyRNA *cprop) { @@ -677,7 +676,7 @@ void RNA_def_main_lamps(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Remove a lamp from the current blendfile."); parm= RNA_def_pointer(func, "lamp", "Lamp", "", "Lamp to remove."); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } void RNA_def_main_libraries(BlenderRNA *brna, PropertyRNA *cprop) { @@ -726,7 +725,7 @@ void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Remove an image from the current blendfile."); parm= RNA_def_pointer(func, "image", "Image", "", "Image to remove."); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop) @@ -751,7 +750,7 @@ void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Remove a lattice from the current blendfile."); parm= RNA_def_pointer(func, "lattice", "Lattice", "", "Lattice to remove."); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop) { @@ -777,7 +776,7 @@ void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Remove a curve from the current blendfile."); parm= RNA_def_pointer(func, "curve", "Curve", "", "Curve to remove."); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop) { @@ -801,7 +800,7 @@ void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Remove a metaball from the current blendfile."); parm= RNA_def_pointer(func, "metaball", "MetaBall", "", "MetaBall to remove."); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop) { @@ -826,7 +825,7 @@ void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Remove a font from the current blendfile."); parm= RNA_def_pointer(func, "vfont", "VectorFont", "", "Font to remove."); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop) { @@ -850,7 +849,7 @@ void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Remove a texture from the current blendfile."); parm= RNA_def_pointer(func, "texture", "Texture", "", "Texture to remove."); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop) { @@ -874,7 +873,7 @@ void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Remove a brush from the current blendfile."); parm= RNA_def_pointer(func, "brush", "Brush", "", "Brush to remove."); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop) @@ -899,7 +898,7 @@ void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Remove a world from the current blendfile."); parm= RNA_def_pointer(func, "world", "World", "", "World to remove."); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } void RNA_def_main_groups(BlenderRNA *brna, PropertyRNA *cprop) @@ -924,7 +923,7 @@ void RNA_def_main_groups(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Remove a group from the current blendfile."); parm= RNA_def_pointer(func, "group", "Group", "", "Group to remove."); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop) { @@ -948,7 +947,7 @@ void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Remove a text from the current blendfile."); parm= RNA_def_pointer(func, "text", "Text", "", "Text to remove."); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); /* load func */ func= RNA_def_function(srna, "load", "rna_Main_texts_load"); @@ -986,7 +985,7 @@ void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Remove a armature from the current blendfile."); parm= RNA_def_pointer(func, "armature", "Armature", "", "Armature to remove."); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop) { @@ -1010,7 +1009,7 @@ void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Remove a action from the current blendfile."); parm= RNA_def_pointer(func, "action", "Action", "", "Action to remove."); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop) { @@ -1034,7 +1033,7 @@ void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Remove a particle settings instance from the current blendfile."); parm= RNA_def_pointer(func, "particle", "ParticleSettings", "", "Particle Settings to remove."); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop) { |