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_armature.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_armature.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_armature.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index 8b21fd2c80a..f2abe690218 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -108,6 +108,12 @@ void rna_Armature_edit_bone_remove(bArmature *arm, ReportList *reports, EditBone BKE_reportf(reports, RPT_ERROR, "Armature '%s' not in editmode, cant remove an editbone.", arm->id.name+2); return; } + + if(BLI_findindex(arm->edbo, ebone) == -1) { + BKE_reportf(reports, RPT_ERROR, "Armature '%s' doesn't contain bone '%s'.", arm->id.name+2, ebone->name); + return; + } + ED_armature_edit_bone_remove(arm, ebone); } @@ -712,7 +718,7 @@ static void rna_def_armature_edit_bones(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Remove an existing bone from the armature"); /* target to remove*/ parm= RNA_def_pointer(func, "bone", "EditBone", "", "EditBone to remove"); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } static void rna_def_armature(BlenderRNA *brna) |