diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-07-13 23:33:59 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-07-13 23:33:59 +0400 |
commit | 2ba8b72157d22ee92359e87e88860443a1f5cef2 (patch) | |
tree | b2347faeae5aed1c99681fe1803969ff8af57e8b /source/blender/makesrna/intern/rna_constraint.c | |
parent | 1334ed303816531240294d17457575736bdd212b (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/makesrna/intern/rna_constraint.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_constraint.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 56c0ca1b491..0e3dd799612 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -181,6 +181,20 @@ static EnumPropertyItem *rna_Constraint_owner_space_itemf(bContext *C, PointerRN { Object *ob= (Object*)ptr->id.data; bConstraint *con= (bConstraint*)ptr->data; + + if(C==NULL) { + EnumPropertyItem *item= NULL; + int totitem= 0; + + /* needed for doc generation */ + RNA_enum_items_add(&item, &totitem, space_object_items); + RNA_enum_items_add(&item, &totitem, space_pchan_items); + RNA_enum_item_end(&item, &totitem); + + *free= 1; + + return item; + } if(BLI_findindex(&ob->constraints, con) == -1) return space_pchan_items; @@ -195,6 +209,20 @@ static EnumPropertyItem *rna_Constraint_target_space_itemf(bContext *C, PointerR ListBase targets = {NULL, NULL}; bConstraintTarget *ct; + if(C==NULL) { + EnumPropertyItem *item= NULL; + int totitem= 0; + + /* needed for doc generation */ + RNA_enum_items_add(&item, &totitem, space_object_items); + RNA_enum_items_add(&item, &totitem, space_pchan_items); + RNA_enum_item_end(&item, &totitem); + + *free= 1; + + return item; + } + if(cti && cti->get_constraint_targets) { cti->get_constraint_targets(con, &targets); |