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>2017-12-15 19:55:20 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-12-15 20:08:37 +0300
commitc2cc42742d31cd4676e8d3d3ef8340019bf3a307 (patch)
tree9259611665441af6bd0e6f63226665e2f37a7997 /source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c
parent68ffb2a2672a0e944e5e4fdf0f31c7223c2f1920 (diff)
Manipulator: support single press button actions
While not the main purpose of manipulators, it's handy to be able to use operators without modal callbacks sometimes.
Diffstat (limited to 'source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c')
-rw-r--r--source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c
index d62aac8cd87..ebb5d835455 100644
--- a/source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c
+++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c
@@ -389,13 +389,21 @@ static int manipulator_tweak_invoke(bContext *C, wmOperator *op, const wmEvent *
return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH);
}
+ wmManipulatorOpElem *mpop = WM_manipulator_operator_get(mpr, mpr->highlight_part);
+
+ /* Allow for 'button' manipulators, single click to run an action. */
+ if (mpop && mpop->type) {
+ if (mpop->type->modal == NULL) {
+ WM_operator_name_call_ptr(C, mpop->type, WM_OP_INVOKE_DEFAULT, &mpop->ptr);
+ return OPERATOR_FINISHED;
+ }
+ }
/* activate highlighted manipulator */
wm_manipulatormap_modal_set(mmap, C, mpr, event, true);
/* XXX temporary workaround for modal manipulator operator
* conflicting with modal operator attached to manipulator */
- wmManipulatorOpElem *mpop = WM_manipulator_operator_get(mpr, mpr->highlight_part);
if (mpop && mpop->type) {
if (mpop->type->modal) {
return OPERATOR_FINISHED;