From 04272613a78d805e900941b21df16dbbcafc6849 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Wed, 13 Nov 2019 13:42:01 +0300 Subject: Python API: assume that a crashed Python operator returned FINISHED. The CANCELLED return value from an operator is intended for signaling that the operator aborted execution without changing anything, and an Undo stack entry should not be created. When a Python operator crashes, it is not safe to assume that it did nothing, so it should interpret it as FINISHED instead. Otherwise, the undo system behavior after an operator failure feels broken. Differential Revision: https://developer.blender.org/D6241 --- source/blender/makesrna/intern/rna_wm_api.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender/makesrna/intern/rna_wm_api.c') diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index 1330250edab..841d82adcb7 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -639,7 +639,7 @@ static void rna_generic_op_invoke(FunctionRNA *func, int flag) if (flag & WM_GEN_INVOKE_RETURN) { parm = RNA_def_enum_flag( - func, "result", rna_enum_operator_return_items, OPERATOR_CANCELLED, "result", ""); + func, "result", rna_enum_operator_return_items, OPERATOR_FINISHED, "result", ""); RNA_def_function_return(func, parm); } } @@ -914,7 +914,7 @@ void RNA_api_operator(StructRNA *srna) /* better name? */ parm = RNA_def_enum_flag( - func, "result", rna_enum_operator_return_items, OPERATOR_CANCELLED, "result", ""); + func, "result", rna_enum_operator_return_items, OPERATOR_FINISHED, "result", ""); RNA_def_function_return(func, parm); /* check */ @@ -939,7 +939,7 @@ void RNA_api_operator(StructRNA *srna) /* better name? */ parm = RNA_def_enum_flag( - func, "result", rna_enum_operator_return_items, OPERATOR_CANCELLED, "result", ""); + func, "result", rna_enum_operator_return_items, OPERATOR_FINISHED, "result", ""); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "modal", NULL); /* same as invoke */ @@ -952,7 +952,7 @@ void RNA_api_operator(StructRNA *srna) /* better name? */ parm = RNA_def_enum_flag( - func, "result", rna_enum_operator_return_items, OPERATOR_CANCELLED, "result", ""); + func, "result", rna_enum_operator_return_items, OPERATOR_FINISHED, "result", ""); RNA_def_function_return(func, parm); /* draw */ -- cgit v1.2.3