Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-12-24 19:10:26 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-12-24 19:10:26 +0300
commit4dd3e6c36070e64d8b1d784a34d9881ae2c3eed8 (patch)
treeb5797cbc48a2cffad1a50d07945c8e5b31b68e6c /source/blender/makesrna/intern/rna_wm_api.c
parent1d224ad692c8794500f4d6fd5257887db150a635 (diff)
support for registering operators using the same internal rna api as panels, menus, headers & render engines since there was a fair bit of duplicate functionality.
will remove the old system and update scripts next.
Diffstat (limited to 'source/blender/makesrna/intern/rna_wm_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_wm_api.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c
index 0cec66fe264..dcaff1a7c07 100644
--- a/source/blender/makesrna/intern/rna_wm_api.c
+++ b/source/blender/makesrna/intern/rna_wm_api.c
@@ -192,11 +192,43 @@ void RNA_api_operator(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|FUNC_REGISTER_OPTIONAL);
+ RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", ""));
+ RNA_def_pointer(func, "context", "Context", "", "");
+
+ /* exec */
+ func= RNA_def_function(srna, "execute", NULL);
+ RNA_def_function_ui_description(func, "Execute the operator.");
+ RNA_def_function_flag(func, FUNC_REGISTER);
+ RNA_def_pointer(func, "context", "Context", "", "");
+
+ parm= RNA_def_enum(func, "result", operator_return_items, 0, "result", ""); // better name?
+ RNA_def_property_flag(parm, PROP_ENUM_FLAG);
+ RNA_def_function_return(func, parm);
+
+ /* invoke */
+ func= RNA_def_function(srna, "invoke", NULL);
+ RNA_def_function_ui_description(func, "Invoke the operator.");
+ RNA_def_function_flag(func, FUNC_REGISTER);
+ RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_pointer(func, "event", "Event", "", "");
+
+ parm= RNA_def_enum(func, "result", operator_return_items, 0, "result", ""); // better name?
+ RNA_def_property_flag(parm, PROP_ENUM_FLAG);
+ RNA_def_function_return(func, parm);
}
void RNA_api_keyconfig(StructRNA *srna)