[Bf-blender-cvs] [3d860f53e8b] blender2.8: Gizmo: hide redo gizmo when spin tool not active

Campbell Barton noreply at git.blender.org
Mon Sep 24 09:00:08 CEST 2018


Commit: 3d860f53e8becaa8c500b250f5c9ac7215c4f6bf
Author: Campbell Barton
Date:   Mon Sep 24 17:12:54 2018 +1000
Branches: blender2.8
https://developer.blender.org/rB3d860f53e8becaa8c500b250f5c9ac7215c4f6bf

Gizmo: hide redo gizmo when spin tool not active

Selecting a another tool left the gizmo,
which could overlap other tools gizmos.

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

M	source/blender/editors/include/ED_gizmo_utils.h
M	source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
M	source/blender/editors/util/gizmo_utils.c

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

diff --git a/source/blender/editors/include/ED_gizmo_utils.h b/source/blender/editors/include/ED_gizmo_utils.h
index 90968754095..77956b9ca0d 100644
--- a/source/blender/editors/include/ED_gizmo_utils.h
+++ b/source/blender/editors/include/ED_gizmo_utils.h
@@ -35,6 +35,10 @@ bool ED_gizmo_poll_or_unlink_delayed_from_operator(
         const struct bContext *C, struct wmGizmoGroupType *gzgt,
         const char *idname);
 
+bool ED_gizmo_poll_or_unlink_delayed_from_tool_ex(
+        const struct bContext *C, struct wmGizmoGroupType *gzgt,
+        const char *gzgt_idname);
+
 /** Use this as poll function directly for: #wmGizmoGroupType.poll */
 bool ED_gizmo_poll_or_unlink_delayed_from_tool(
         const struct bContext *C, struct wmGizmoGroupType *gzgt);
diff --git a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
index 787038fca03..e3fa02e946e 100644
--- a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
+++ b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
@@ -683,10 +683,14 @@ static void gizmo_spin_prop_angle_set(
 
 static bool gizmo_mesh_spin_redo_poll(const bContext *C, wmGizmoGroupType *gzgt)
 {
-	return ED_gizmo_poll_or_unlink_delayed_from_operator(C, gzgt, "MESH_OT_spin");
+	if (ED_gizmo_poll_or_unlink_delayed_from_operator(C, gzgt, "MESH_OT_spin")) {
+		if (ED_gizmo_poll_or_unlink_delayed_from_tool_ex(C, gzgt, "MESH_GGT_spin")) {
+			return true;
+		}
+	}
+	return false;
 }
 
-
 static void gizmo_mesh_spin_redo_modal_from_setup(
         const bContext *C, wmGizmoGroup *gzgroup)
 {
diff --git a/source/blender/editors/util/gizmo_utils.c b/source/blender/editors/util/gizmo_utils.c
index 86eb2c1c003..6b150f93e38 100644
--- a/source/blender/editors/util/gizmo_utils.c
+++ b/source/blender/editors/util/gizmo_utils.c
@@ -57,15 +57,20 @@ bool ED_gizmo_poll_or_unlink_delayed_from_operator(
 	return true;
 }
 
-/** Can use this as poll function directly. */
-bool ED_gizmo_poll_or_unlink_delayed_from_tool(const bContext *C, wmGizmoGroupType *gzgt)
+bool ED_gizmo_poll_or_unlink_delayed_from_tool_ex(const bContext *C, wmGizmoGroupType *gzgt, const char *gzgt_idname)
 {
 	bToolRef_Runtime *tref_rt = WM_toolsystem_runtime_from_context((bContext *)C);
 	if ((tref_rt == NULL) ||
-	    !STREQ(gzgt->idname, tref_rt->gizmo_group))
+	    !STREQ(gzgt_idname, tref_rt->gizmo_group))
 	{
 		WM_gizmo_group_type_unlink_delayed_ptr(gzgt);
 		return false;
 	}
 	return true;
 }
+
+/** Can use this as poll function directly. */
+bool ED_gizmo_poll_or_unlink_delayed_from_tool(const bContext *C, wmGizmoGroupType *gzgt)
+{
+	return ED_gizmo_poll_or_unlink_delayed_from_tool_ex(C, gzgt, gzgt->idname);
+}



More information about the Bf-blender-cvs mailing list