[Bf-blender-cvs] [c2cc42742d3] blender2.8: Manipulator: support single press button actions
Campbell Barton
noreply at git.blender.org
Fri Dec 15 18:21:16 CET 2017
Commit: c2cc42742d31cd4676e8d3d3ef8340019bf3a307
Author: Campbell Barton
Date: Sat Dec 16 03:55:20 2017 +1100
Branches: blender2.8
https://developer.blender.org/rBc2cc42742d31cd4676e8d3d3ef8340019bf3a307
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.
===================================================================
M source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c
===================================================================
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;
More information about the Bf-blender-cvs
mailing list