Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-07-13 23:33:59 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-07-13 23:33:59 +0400
commit2ba8b72157d22ee92359e87e88860443a1f5cef2 (patch)
treeb2347faeae5aed1c99681fe1803969ff8af57e8b /source/blender/editors/mesh/editmesh_mods.c
parent1334ed303816531240294d17457575736bdd212b (diff)
RNA & PyAPI
* support for dynamic enums to be inspected enumProp.items() from python. * fix, enums check for a separator was flipped, meant no enums were in docs. * dynamic enum functions now check for a NULL context and return all possible options for the "items" attribute used for docs. * added an arg for rna arrays to free the array there looping over (needed to free dynamically allocated enum items) * python api checks for NULL items since this can happen in some cases. * python api, When getting an enum ID from an int in an array - If it failed it would get the first enum identifier and return that. Brecht? dont understand, making it return an empty string in these cases.
Diffstat (limited to 'source/blender/editors/mesh/editmesh_mods.c')
-rw-r--r--source/blender/editors/mesh/editmesh_mods.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c
index 2995e2d895b..5fc2ce46792 100644
--- a/source/blender/editors/mesh/editmesh_mods.c
+++ b/source/blender/editors/mesh/editmesh_mods.c
@@ -1229,12 +1229,25 @@ static int select_similar_exec(bContext *C, wmOperator *op)
static EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *ptr, int *free)
{
- Object *obedit= CTX_data_edit_object(C);
-
+ Object *obedit;
+ EnumPropertyItem *item= NULL;
+ int totitem= 0;
+
+ if(C==NULL) {
+ /* needed for doc generation */
+ RNA_enum_items_add(&item, &totitem, prop_simvertex_types);
+ RNA_enum_items_add(&item, &totitem, prop_simedge_types);
+ RNA_enum_items_add(&item, &totitem, prop_simface_types);
+ RNA_enum_item_end(&item, &totitem);
+ *free= 1;
+
+ return item;
+ }
+
+ obedit= CTX_data_edit_object(C);
+
if(obedit && obedit->type == OB_MESH) {
EditMesh *em= BKE_mesh_get_editmesh(obedit->data);
- EnumPropertyItem *item= NULL;
- int totitem= 0;
if(em->selectmode & SCE_SELECT_VERTEX)
RNA_enum_items_add(&item, &totitem, prop_simvertex_types);
@@ -1248,7 +1261,7 @@ static EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *ptr,
return item;
}
-
+
return NULL;
}