diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-03-14 19:43:44 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-03-14 19:57:01 +0300 |
commit | 76ec329dd1de6b94b74abf4ee6728266b15fb31d (patch) | |
tree | d49930caf678f501ac0a47899ddd757508288a87 /source/blender/makesrna | |
parent | 1208792adb30f1a2a4833b0503ce240f5f349501 (diff) |
WM: add Operator.is_repeat() check for C & Py
This addresses an issue raised by D2453 -
that there was no way to check if operators are run
multiple times in a row.
Actions are still ignored that don't cause an UNDO event.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_wm_api.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index 1f23ab938fb..677ea92aea1 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -87,6 +87,11 @@ static void rna_Operator_report(wmOperator *op, int type, const char *msg) BKE_report(op->reports, type, msg); } +static int rna_Operator_is_repeat(wmOperator *op, bContext *C) +{ + return WM_operator_is_repeat(C, op); +} + /* since event isn't needed... */ static void rna_Operator_enum_search_invoke(bContext *C, wmOperator *op) { @@ -521,6 +526,12 @@ void RNA_api_operator(StructRNA *srna) parm = RNA_def_string(func, "message", NULL, 0, "Report Message", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + /* utility, not for registering */ + func = RNA_def_function(srna, "is_repeat", "rna_Operator_is_repeat"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + /* return */ + parm = RNA_def_boolean(func, "result", 0, "result", ""); + RNA_def_function_return(func, parm); /* Registration */ |