[Bf-blender-cvs] [a47a7f2a7be] blender2.8: Manipulator: add show_drag option for 2d buttons

Campbell Barton noreply at git.blender.org
Wed Jan 24 13:20:54 CET 2018


Commit: a47a7f2a7beb0e17d903e058b791aa6eae96bf55
Author: Campbell Barton
Date:   Wed Jan 24 23:29:17 2018 +1100
Branches: blender2.8
https://developer.blender.org/rBa47a7f2a7beb0e17d903e058b791aa6eae96bf55

Manipulator: add show_drag option for 2d buttons

Needed so 3d navigation buttons can show show drag cursor
only for buttons with modal operators.

===================================================================

M	source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c
M	source/blender/editors/space_view3d/view3d_manipulator_navigate.c

===================================================================

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;



More information about the Bf-blender-cvs mailing list