diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-08-11 12:39:59 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-08-11 13:02:26 +0400 |
commit | 028fd29eeb092b6ed0625ed4d59b8100ae69596f (patch) | |
tree | 0cb15b15f17e6d9f16fef74631e3838e8962fafe /source/blender/makesrna/intern/rna_wm_api.c | |
parent | 5d1d23d5bdb0e5937520f16063f8d16fb049850c (diff) |
Pie Menus C code backend.
This commit merges the code in the pie-menu branch.
As per decisions taken the last few days, there are no pie menus
included and there will be an official add-on including overrides of
some keys with pie menus. However, people will now be able to use the
new code in python.
Full Documentation is in http://wiki.blender.org/index.php/Dev:Ref/
Thanks:
Campbell Barton, Dalai Felinto and Ton Roosendaal for the code review
and design comments
Jonathan Williamson, Pawel Lyczkowski, Pablo Vazquez among others for
suggestions during the development.
Special Thanks to Sean Olson, for his support, suggestions, testing and
merciless bugging so that I would finish the pie menu code. Without him
we wouldn't be here. Also to the rest of the developers of the original
python add-on, Patrick Moore and Dan Eicher and finally to Matt Ebb, who
did the research and first implementation and whose code I used to get
started.
Diffstat (limited to 'source/blender/makesrna/intern/rna_wm_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_wm_api.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index 9b288903aa2..7d499521a1a 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -310,6 +310,24 @@ static void rna_PupMenuEnd(bContext *C, PointerRNA *handle) uiPupMenuEnd(C, handle->data); } +/* pie menu wrapper */ +static PointerRNA rna_PieMenuBegin(bContext *C, const char *title, int icon, PointerRNA *event) +{ + PointerRNA r_ptr; + void *data; + + data = (void *)uiPieMenuBegin(C, title, icon, event->data); + + RNA_pointer_create(NULL, &RNA_UIPieMenu, data, &r_ptr); + + return r_ptr; +} + +static void rna_PieMenuEnd(bContext *C, PointerRNA *handle) +{ + uiPieMenuEnd(C, handle->data); +} + #else #define WM_GEN_INVOKE_EVENT (1 << 0) @@ -461,6 +479,26 @@ void RNA_api_wm(StructRNA *srna) RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT); parm = RNA_def_pointer(func, "menu", "UIPopupMenu", "", ""); RNA_def_property_flag(parm, PROP_RNAPTR | PROP_NEVER_NULL); + + /* wrap uiPieMenuBegin */ + func = RNA_def_function(srna, "piemenu_begin__internal", "rna_PieMenuBegin"); + RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT); + parm = RNA_def_string(func, "title", NULL, 0, "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + parm = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(parm, icon_items); + parm = RNA_def_pointer(func, "event", "Event", "", ""); + RNA_def_property_flag(parm, PROP_RNAPTR | PROP_NEVER_NULL); + /* return */ + parm = RNA_def_pointer(func, "menu_pie", "UIPieMenu", "", ""); + RNA_def_property_flag(parm, PROP_RNAPTR | PROP_NEVER_NULL); + RNA_def_function_return(func, parm); + + /* wrap uiPieMenuEnd */ + func = RNA_def_function(srna, "piemenu_end__internal", "rna_PieMenuEnd"); + RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT); + parm = RNA_def_pointer(func, "menu", "UIPieMenu", "", ""); + RNA_def_property_flag(parm, PROP_RNAPTR | PROP_NEVER_NULL); } void RNA_api_operator(StructRNA *srna) |