5
$\begingroup$

In version 2.72 a new return value for invoke, modal and execute got introduced: {'INTERFACE'}- It is documented as

INTERFACE Interface, Handled but not executed (popup menus).

What does this actually mean when comparing the Operator's control flow to that of returning one of the other values?

$\endgroup$
4
+100
$\begingroup$

The 'INTERFACE' operator return value is used to indicate where an operator has successfully completed by opening a menu or other UI component.

The comment in the source code for the operator return types states that it is:

/* "used for operators that act indirectly (eg. popup menu)" */
/* "note: this isn't great design (using operators to trigger UI) avoid where possible." */

Source: source/blender/makesdna/DNA_windowmanager_types.h

This new return type was added during Commit - Fix T41041: "'Delete keyframe' removes markers too"

Reason for commit update was:

"Operators that trigger UI events (but nothing else) were using 'CANCELLED' making it impossible to tell if an invoke function failed, or opened a menu."

$\endgroup$
  • $\begingroup$ I wonder why Operators that trigger UI events don't simply return 'FINISHED' :? $\endgroup$ – WorldSEnder Jul 28 '15 at 3:30
  • $\begingroup$ I think the devs wanted to distinguish between code where an operator runs code and completes, and when the operator triggers a UI component opening that then runs further operators which could fail or succeed. $\endgroup$ – Todd McIntosh Jul 28 '15 at 3:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.