From 2e3e044d27e90dc87bdce6af9cef77d9543e4d89 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 10 Jul 2009 19:56:13 +0000 Subject: RNA * Enums can now be dynamically created in the _itemf callback, using RNA_enum_item(s)_add, RNA_enum_item_end. All places asking for enum items now need to potentially free the items. * This callback now also gets context, this was added specifically for operators. This doesn't fit design well at all, needed to do some ugly hacks, but can't find a good solution at the moment. * All enums must have a default list of items too, even with an _itemf callback, for docs and fallback in case there is no context. * Used by MESH_OT_merge, MESH_OT_select_similar, TFM_OT_select_orientation. * Also changes some operator properties that were enums to booleas (unselected, deselect), to make them consistent with other ops. --- source/blender/makesrna/RNA_define.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/blender/makesrna/RNA_define.h') diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h index 69f5b5adc37..a3fa97bf4b1 100644 --- a/source/blender/makesrna/RNA_define.h +++ b/source/blender/makesrna/RNA_define.h @@ -160,6 +160,13 @@ void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret); void RNA_def_function_flag(FunctionRNA *func, int flag); void RNA_def_function_ui_description(FunctionRNA *func, const char *description); +/* Dynamic Enums + * strings are not freed, assumed pointing to static location. */ + +void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, EnumPropertyItem *item); +void RNA_enum_items_add(EnumPropertyItem **items, int *totitem, EnumPropertyItem *item); +void RNA_enum_item_end(EnumPropertyItem **items, int *totitem); + #ifdef __cplusplus } #endif -- cgit v1.2.3