diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-01-24 15:29:17 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-01-24 15:29:17 +0300 |
commit | a47a7f2a7beb0e17d903e058b791aa6eae96bf55 (patch) | |
tree | fb28767bf2b0d8d0087b5c6337694bb05b2e41db /source | |
parent | d8b5b4b7b1cdd3f605bec40f33b3fa9dd5886c04 (diff) |
Manipulator: add show_drag option for 2d buttons
Needed so 3d navigation buttons can show show drag cursor
only for buttons with modal operators.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_manipulator_navigate.c | 9 |
2 files changed, 17 insertions, 2 deletions
diff --git a/source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c index ce6992e7ad9..176c84069a8 100644 --- a/source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c +++ b/source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c @@ -206,9 +206,12 @@ static int manipulator_button2d_test_select( return -1; } -static int manipulator_button2d_cursor_get(wmManipulator *UNUSED(mpr)) +static int manipulator_button2d_cursor_get(wmManipulator *mpr) { - return BC_HANDCURSOR; + if (RNA_boolean_get(mpr->ptr, "show_drag")) { + return BC_NSEW_SCROLLCURSOR; + } + return CURSOR_STD; } static void manipulator_button2d_free(wmManipulator *mpr) @@ -248,6 +251,9 @@ static void MANIPULATOR_WT_button_2d(wmManipulatorType *wt) /* Passed to 'GPU_batch_from_poly_2d_encoded' */ RNA_def_property(wt->srna, "shape", PROP_STRING, PROP_BYTESTRING); + + /* Currently only used for cursor display. */ + RNA_def_boolean(wt->srna, "show_drag", true, "Show Drag", ""); } void ED_manipulatortypes_button_2d(void) diff --git a/source/blender/editors/space_view3d/view3d_manipulator_navigate.c b/source/blender/editors/space_view3d/view3d_manipulator_navigate.c index 4b873107911..49e7f42d715 100644 --- a/source/blender/editors/space_view3d/view3d_manipulator_navigate.c +++ b/source/blender/editors/space_view3d/view3d_manipulator_navigate.c @@ -224,6 +224,15 @@ static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmManipulatorG RNA_enum_set(ptr, "type", RV3D_VIEW_CAMERA); } + /* Click only buttons (not modal). */ + { + int mpr_ids[] = {MPR_PERSP, MPR_ORTHO, MPR_CAMERA}; + for (int i = 0; i < ARRAY_SIZE(mpr_ids); i++) { + wmManipulator *mpr = navgroup->mpr_array[mpr_ids[i]]; + RNA_boolean_set(mpr->ptr, "show_drag", false); + } + } + { wmManipulator *mpr = navgroup->mpr_array[MPR_ROTATE]; mpr->scale_basis = MANIPULATOR_SIZE / 2; |