利用者:Raa/Addons/Pie Menu Editor/Editors/Modal Operator
目次
Modal Operator
Modal Operator is an interactive tool that blocks access to other tools until you confirm or cancel it. Modal Operators have their own sub-hotkeys allowing you to adjust the tool and preview the changes.
Rotate tool R is a good example of modal operators.
Tutorial
Editor
Modal Operator Editor is a collection of editable slots which are used to add sub-hotkeys to the tool or execute python code depending on the current state of the modal operator:
Command
Adds a sub-hotkey to execute assigned python code.
Property
Adds a sub-hotkey to change the value of the property or local variable defined in On Invoke slot.
Hotkey Modes
Hotkey | Press and hold down the sub-hotkey and move the mouse to change the value of the property. |
---|---|
Mouse Move | Move the mouse to change the value of the property.
This mode is useful only when Confirm on Release option is enabled because it blocks all other sub-hotkeys. |
Mouse Wheel | Scroll mouse whell up or down to change the value of the property. |
On Invoke
Python code that will be executed when the user invokes the modal operator.
On Confirm
Python code that will be executed when the user confirms the modal operator.
On Cancel
Python code that will be executed when the user cancels the modal operator.
On Update
Python code that will be executed when the user presses one/any of the sub-hotkeys.
To assign On Update slot to one of the sub-hotkeys you need to place the slot after that sub-hotkey.
To assign On Update slot to all sub-hotkeys you need to place it before any of sub-hotkey (Command or Property) slots.
Scripting
confirm ()
Confirm modal operator
Returns: | True |
---|
cancel ()
Cancel modal operator
Returns: | True |
---|
Settings
Confirm on Release
Confirms the modal operator when the user releases the hotkey used to call the modal operator.