diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2013-06-10 14:37:24 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2013-06-10 14:37:24 +0400 |
commit | 93c1bf6d88f24a293907ee4327cefaf851b4ff94 (patch) | |
tree | 1b485dc71695b703967adb9891d07e44e3424cdc /source/blender/makesrna/intern/rna_screen.c | |
parent | 00f37e911bb8fe2b3c2262909ad7ed5565fdb69e (diff) |
Fix for r57316: SPACE_EMPTY *is* needed in RNA enum for now, exported keymaps abuse it...
So for now, static enum is back to its previous form, and the menu one is dynamically generated by a callback. Not nice, but works.
Diffstat (limited to 'source/blender/makesrna/intern/rna_screen.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_screen.c | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index 7db522d7f5e..15fe399f608 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -106,6 +106,55 @@ static int rna_Screen_fullscreen_get(PointerRNA *ptr) } +/* Returns an UI-compatible list */ +/* Note: Should not be needed, but for now we need to keep EMPTY at least in the static version of this enum, so... */ +static EnumPropertyItem *rna_Area_type_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), + PropertyRNA *UNUSED(prop), int *free) +{ + EnumPropertyItem *item = NULL; + EnumPropertyItem sep = {0, "", ICON_NONE, NULL, NULL}; + int totitem = 0; + + RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_VIEW3D); + + RNA_enum_item_add(&item, &totitem, &sep); + + RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_TIME); + RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_IPO); + RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_ACTION); + RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_NLA); + + RNA_enum_item_add(&item, &totitem, &sep); + + RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_IMAGE); + RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_SEQ); + RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_CLIP); + RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_TEXT); + RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_NODE); + RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_LOGIC); + + RNA_enum_item_add(&item, &totitem, &sep); + + RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_BUTS); + RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_OUTLINER); + RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_USERPREF); + RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_INFO); + + RNA_enum_item_add(&item, &totitem, &sep); + + RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_FILE); + + RNA_enum_item_add(&item, &totitem, &sep); + + RNA_enum_items_add_value(&item, &totitem, space_type_items, SPACE_CONSOLE); + + RNA_enum_item_end(&item, &totitem); + *free = 1; + + return item; +} + + static void rna_Area_type_set(PointerRNA *ptr, int value) { ScrArea *sa = (ScrArea *)ptr->data; @@ -204,7 +253,7 @@ static void rna_def_area(BlenderRNA *brna) prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "spacetype"); RNA_def_property_enum_items(prop, space_type_items); - RNA_def_property_enum_funcs(prop, NULL, "rna_Area_type_set", NULL); + RNA_def_property_enum_funcs(prop, NULL, "rna_Area_type_set", "rna_Area_type_itemf"); RNA_def_property_ui_text(prop, "Editor Type", "Current editor type for this area"); RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); |