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>2021-09-17 05:09:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-09-17 05:57:28 +0300
commitda2ba402689d7ed752b0b37ad49dce1a5851cc77 (patch)
tree38d313bbbbc6d7f7acf9aaf88e86bce5b49fa4eb /source/blender/makesrna/intern/rna_wm.c
parent633c29fb7befed7a8fa4f209dd5187f551c91e37 (diff)
UI: wait for input for operators that depend on cursor location
Support waiting for input so operators that depend on the cursor location are usable from menus / buttons. Use an operator type flag which the user interface code checks for, waiting for input when run from a menu item. This patch only supports this feature, there are no functional changes. The motivation for this change is discoverability since some actions were either hidden or broken when accessed from menus (where the behavior of the operator depended on the menu location). In general, waiting for input is *not* an efficient way to access tools, however there are over 50 operators with a "wait_for_input" property so this isn't introducing a new kind of interaction, rather exposing this in a way that does not need to be hard-coded into each operator, or having modal callbacks added for the sole purpose of waiting for input. Besides requiring boiler plate code using a "wait_for_input" property has the added down-side of preventing key shortcuts from showing. Only the menu items will enable the property, causing them not to match key-map items. Reviewed By: Severin Ref D12255
Diffstat (limited to 'source/blender/makesrna/intern/rna_wm.c')
-rw-r--r--source/blender/makesrna/intern/rna_wm.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 21a3c087197..31fdbf528bb 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -468,6 +468,13 @@ const EnumPropertyItem rna_enum_operator_type_flag_items[] = {
"is enabled"},
{OPTYPE_GRAB_CURSOR_X, "GRAB_CURSOR_X", 0, "Grab Pointer X", "Grab, only warping the X axis"},
{OPTYPE_GRAB_CURSOR_Y, "GRAB_CURSOR_Y", 0, "Grab Pointer Y", "Grab, only warping the Y axis"},
+ {OPTYPE_DEPENDS_ON_CURSOR,
+ "DEPENDS_ON_CURSOR",
+ 0,
+ "Depends on Cursor",
+ "The initial cursor location is used, "
+ "when running from a menus or buttons the user is prompted to place the cursor "
+ "before beginning the operation"},
{OPTYPE_PRESET, "PRESET", 0, "Preset", "Display a preset button with the operators settings"},
{OPTYPE_INTERNAL, "INTERNAL", 0, "Internal", "Removes the operator from search results"},
{0, NULL, 0, NULL, NULL},