diff options
author | Martin Poirier <theeth@yahoo.com> | 2009-12-31 01:14:32 +0300 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2009-12-31 01:14:32 +0300 |
commit | b00cddeb66f2b9f51cad15ed597a6ca975bd31dd (patch) | |
tree | bd686691ecde5cd24abd2330dea086e275d07635 /source/blender/makesrna/intern/rna_wm_api.c | |
parent | 3702998fec6d237eb567bb8353ac93c8d4a68d4c (diff) |
Macro registration using the normal rna registration methods (like operators).
bpy.types.register(MacroClass)
instead of
bpy.ops.add_macro(MacroClass)
The rest is unchanged.
Also remove some now unused code for the old registration methods (there's still some remaining).
Diffstat (limited to 'source/blender/makesrna/intern/rna_wm_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_wm_api.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index 1afedf1c6a6..9ed6046ecd0 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -237,6 +237,35 @@ void RNA_api_operator(StructRNA *srna) RNA_def_pointer(func, "context", "Context", "", ""); } +void RNA_api_macro(StructRNA *srna) +{ + FunctionRNA *func; + PropertyRNA *parm; + + /* utility, not for registering */ + func= RNA_def_function(srna, "report", "rna_Operator_report"); + parm= RNA_def_enum(func, "type", wm_report_items, 0, "Type", ""); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_ENUM_FLAG); + parm= RNA_def_string(func, "message", "", 0, "Report Message", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); + + + /* Registration */ + + /* poll */ + func= RNA_def_function(srna, "poll", NULL); + RNA_def_function_ui_description(func, "Test if the operator can be called or not."); + RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); + RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", "")); + RNA_def_pointer(func, "context", "Context", "", ""); + + /* draw */ + func= RNA_def_function(srna, "draw", NULL); + RNA_def_function_ui_description(func, "Draw function for the operator."); + RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); + RNA_def_pointer(func, "context", "Context", "", ""); +} + void RNA_api_keyconfig(StructRNA *srna) { FunctionRNA *func; |