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-10 19:52:44 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-12-10 19:52:44 +0300
commit0cc5d50d9183ca3915ae6d0fd423127d7fc43df4 (patch)
tree57049b8e967932116d9715c7c680a2635c60e179 /source/blender/makesrna/intern/rna_wm_api.c
parent959ac68914c684081e1526b4c9e6380d71cbff1f (diff)
operator report function so python operators can report errors
TODO - reports are currently shown upside down.
Diffstat (limited to 'source/blender/makesrna/intern/rna_wm_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_wm_api.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c
index 2fbcd2f4ae3..47d15c87596 100644
--- a/source/blender/makesrna/intern/rna_wm_api.c
+++ b/source/blender/makesrna/intern/rna_wm_api.c
@@ -134,6 +134,11 @@ static wmKeyMapItem *rna_KeyMap_add_item(wmKeyMap *km, ReportList *reports, char
return WM_keymap_add_item(km, idname, type, value, modifier, keymodifier);
}
+static void rna_Operator_report(wmOperator *op, int type, char *msg)
+{
+ BKE_report(op->reports, type, msg);
+}
+
#else
void RNA_api_wm(StructRNA *srna)
@@ -177,6 +182,18 @@ void RNA_api_wm(StructRNA *srna)
parm= RNA_def_int(func, "height", 20, 0, INT_MAX, "", "Height of the popup.", 0, INT_MAX);
}
+void RNA_api_operator(StructRNA *srna)
+{
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ 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);
+}
+
void RNA_api_keyconfig(StructRNA *srna)
{
FunctionRNA *func;