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/editors/transform | |
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/editors/transform')
-rw-r--r-- | source/blender/editors/transform/transform_orientations.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index f3b373f0e48..6d60c7602f4 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -358,8 +358,10 @@ void BIF_selectTransformOrientationValue(bContext *C, int orientation) { EnumPropertyItem *BIF_enumTransformOrientation(bContext *C) { - ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces; - TransformOrientation *ts = transform_spaces->first; + Scene *scene; + ListBase *transform_spaces; + TransformOrientation *ts= NULL; + EnumPropertyItem global = {V3D_MANIP_GLOBAL, "GLOBAL", 0, "Global", ""}; EnumPropertyItem normal = {V3D_MANIP_NORMAL, "NORMAL", 0, "Normal", ""}; EnumPropertyItem local = {V3D_MANIP_LOCAL, "LOCAL", 0, "Local", ""}; @@ -374,6 +376,15 @@ EnumPropertyItem *BIF_enumTransformOrientation(bContext *C) RNA_enum_item_add(&item, &totitem, &local); RNA_enum_item_add(&item, &totitem, &view); + if(C) { + scene= CTX_data_scene(C); + + if(scene) { + transform_spaces = &scene->transform_spaces; + ts = transform_spaces->first; + } + } + if(ts) RNA_enum_item_add(&item, &totitem, &sepr); |