diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 27 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_orientations.c | 3 | ||||
-rw-r--r-- | source/blender/makesrna/RNA_define.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_define.c | 13 |
4 files changed, 26 insertions, 19 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index efb68f69dac..6993efefe21 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -5796,19 +5796,12 @@ static EnumPropertyItem merge_type_items[]= { static EnumPropertyItem *merge_type_itemf(bContext *C, PointerRNA *ptr, int *free) { + Object *obedit; EnumPropertyItem *item= NULL; int totitem= 0; - Object *obedit; - - if(C==NULL) { - /* needed for doc generation */ - RNA_enum_items_add(&item, &totitem, merge_type_items); - RNA_enum_item_end(&item, &totitem); - - *free= 1; - return item; - } + if(!C) /* needed for docs */ + return merge_type_items; obedit= CTX_data_edit_object(C); if(obedit && obedit->type == OB_MESH) { @@ -5817,18 +5810,18 @@ static EnumPropertyItem *merge_type_itemf(bContext *C, PointerRNA *ptr, int *fre if(em->selectmode & SCE_SELECT_VERTEX) { if(em->selected.first && em->selected.last && ((EditSelection*)em->selected.first)->type == EDITVERT && ((EditSelection*)em->selected.last)->type == EDITVERT) { - RNA_enum_item_add(&item, &totitem, &merge_type_items[0]); - RNA_enum_item_add(&item, &totitem, &merge_type_items[1]); + RNA_enum_items_add_value(&item, &totitem, merge_type_items, 6); + RNA_enum_items_add_value(&item, &totitem, merge_type_items, 1); } else if(em->selected.first && ((EditSelection*)em->selected.first)->type == EDITVERT) - RNA_enum_item_add(&item, &totitem, &merge_type_items[1]); + RNA_enum_items_add_value(&item, &totitem, merge_type_items, 1); else if(em->selected.last && ((EditSelection*)em->selected.last)->type == EDITVERT) - RNA_enum_item_add(&item, &totitem, &merge_type_items[0]); + RNA_enum_items_add_value(&item, &totitem, merge_type_items, 6); } - RNA_enum_item_add(&item, &totitem, &merge_type_items[2]); - RNA_enum_item_add(&item, &totitem, &merge_type_items[3]); - RNA_enum_item_add(&item, &totitem, &merge_type_items[4]); + RNA_enum_items_add_value(&item, &totitem, merge_type_items, 3); + RNA_enum_items_add_value(&item, &totitem, merge_type_items, 4); + RNA_enum_items_add_value(&item, &totitem, merge_type_items, 5); RNA_enum_item_end(&item, &totitem); *free= 1; diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 6d60c7602f4..605eb6996a5 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -366,7 +366,6 @@ EnumPropertyItem *BIF_enumTransformOrientation(bContext *C) EnumPropertyItem normal = {V3D_MANIP_NORMAL, "NORMAL", 0, "Normal", ""}; EnumPropertyItem local = {V3D_MANIP_LOCAL, "LOCAL", 0, "Local", ""}; EnumPropertyItem view = {V3D_MANIP_VIEW, "VIEW", 0, "View", ""}; - EnumPropertyItem sepr = {0, "", 0, NULL, NULL}; EnumPropertyItem tmp = {0, "", 0, "", ""}; EnumPropertyItem *item= NULL; int i = V3D_MANIP_CUSTOM, totitem= 0; @@ -386,7 +385,7 @@ EnumPropertyItem *BIF_enumTransformOrientation(bContext *C) } if(ts) - RNA_enum_item_add(&item, &totitem, &sepr); + RNA_enum_item_add_separator(&item, &totitem); for(; ts; ts = ts->next) { tmp.identifier = "CUSTOM"; diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h index a3fa97bf4b1..aeb6c8edf2d 100644 --- a/source/blender/makesrna/RNA_define.h +++ b/source/blender/makesrna/RNA_define.h @@ -164,7 +164,9 @@ void RNA_def_function_ui_description(FunctionRNA *func, const char *description) * strings are not freed, assumed pointing to static location. */ void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, EnumPropertyItem *item); +void RNA_enum_item_add_separator(EnumPropertyItem **items, int *totitem); void RNA_enum_items_add(EnumPropertyItem **items, int *totitem, EnumPropertyItem *item); +void RNA_enum_items_add_value(EnumPropertyItem **items, int *totitem, EnumPropertyItem *item, int value); void RNA_enum_item_end(EnumPropertyItem **items, int *totitem); #ifdef __cplusplus diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 07515d3ad56..b651360eda0 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -2284,12 +2284,25 @@ void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, EnumPropertyItem *totitem= tot+1; } +void RNA_enum_item_add_separator(EnumPropertyItem **items, int *totitem) +{ + static EnumPropertyItem sepr = {0, "", 0, NULL, NULL}; + RNA_enum_item_add(items, totitem, &sepr); +} + void RNA_enum_items_add(EnumPropertyItem **items, int *totitem, EnumPropertyItem *item) { for(; item->identifier; item++) RNA_enum_item_add(items, totitem, item); } +void RNA_enum_items_add_value(EnumPropertyItem **items, int *totitem, EnumPropertyItem *item, int value) +{ + for(; item->identifier; item++) + if(item->value == value) + RNA_enum_item_add(items, totitem, item); +} + void RNA_enum_item_end(EnumPropertyItem **items, int *totitem) { static EnumPropertyItem empty = {0, NULL, 0, NULL, NULL}; |