Manipulator: modal callback can now cancel & pass events

Re-use operator return flags for manipulator modal & invoke,
this means manipulators can allow navigation or other events to be
handled as they run - see T52499
This commit is contained in:
2017-08-24 17:04:28 +10:00
parent 134e927965
commit e20c825b05
15 changed files with 107 additions and 57 deletions

View File

@@ -1139,7 +1139,7 @@ static ManipulatorGroup *manipulatorgroup_init(wmManipulatorGroup *mgroup)
/**
* Custom handler for manipulator widgets
*/
static void manipulator_modal(
static int manipulator_modal(
bContext *C, wmManipulator *widget, const wmEvent *UNUSED(event),
eWM_ManipulatorTweak UNUSED(tweak_flag))
{
@@ -1154,6 +1154,8 @@ static void manipulator_modal(
}
ED_region_tag_redraw(ar);
return OPERATOR_RUNNING_MODAL;
}
static void WIDGETGROUP_manipulator_setup(const bContext *UNUSED(C), wmManipulatorGroup *mgroup)

View File

@@ -167,7 +167,7 @@ BLI_INLINE void manipulator2d_origin_to_region(ARegion *ar, float *r_origin)
/**
* Custom handler for manipulator widgets
*/
static void manipulator2d_modal(
static int manipulator2d_modal(
bContext *C, wmManipulator *widget, const wmEvent *UNUSED(event),
eWM_ManipulatorTweak UNUSED(tweak_flag))
{
@@ -179,6 +179,8 @@ static void manipulator2d_modal(
WM_manipulator_set_matrix_location(widget, origin);
ED_region_tag_redraw(ar);
return OPERATOR_RUNNING_MODAL;
}
void ED_widgetgroup_manipulator2d_setup(const bContext *UNUSED(C), wmManipulatorGroup *mgroup)