[Bf-blender-cvs] [1e00f91760c] master: Fix gizmo orientation w/ shear tool

Campbell Barton noreply at git.blender.org
Thu Jan 10 02:29:59 CET 2019


Commit: 1e00f91760c972c2cc61294e8684ed3eff39046d
Author: Campbell Barton
Date:   Thu Jan 10 12:25:09 2019 +1100
Branches: master
https://developer.blender.org/rB1e00f91760c972c2cc61294e8684ed3eff39046d

Fix gizmo orientation w/ shear tool

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

M	release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
M	source/blender/editors/transform/transform_gizmo_3d.c

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

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index 99d6104d42c..18dff12185f 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -665,6 +665,7 @@ class _defs_edit_mesh:
             props = tool.operator_properties("transform.shear")
             layout.label(text="View Axis:")
             layout.prop(props, "shear_axis", expand=True)
+            _template_widget.TRANSFORM_GGT_gizmo.draw_settings_with_index(context, layout, 2)
         return dict(
             text="Shear",
             icon="ops.transform.shear",
diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c
index 7a9fceec3a1..0bfe3582d04 100644
--- a/source/blender/editors/transform/transform_gizmo_3d.c
+++ b/source/blender/editors/transform/transform_gizmo_3d.c
@@ -1211,8 +1211,6 @@ static void gizmo_xform_message_subscribe(
         wmGizmoGroup *gzgroup, struct wmMsgBus *mbus,
         Scene *scene, bScreen *UNUSED(screen), ScrArea *UNUSED(sa), ARegion *ar, const void *type_fn)
 {
-	GizmoGroup *ggd = gzgroup->customdata;
-
 	/* Subscribe to view properties */
 	wmMsgSubscribeValue msg_sub_value_gz_tag_refresh = {
 		.owner = ar,
@@ -1237,7 +1235,20 @@ static void gizmo_xform_message_subscribe(
 		}
 	}
 
-	TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, ggd->twtype_init);
+	int orient_flag = 0;
+	if (type_fn == TRANSFORM_GGT_gizmo) {
+		GizmoGroup *ggd = gzgroup->customdata;
+		orient_flag = ggd->twtype_init;
+	}
+	else if (type_fn == VIEW3D_GGT_xform_cage) {
+		orient_flag = SCE_GIZMO_SHOW_SCALE;
+		/* pass */
+	}
+	else if (type_fn == VIEW3D_GGT_xform_shear) {
+		orient_flag = SCE_GIZMO_SHOW_ROTATE;
+	}
+
+	TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, orient_flag);
 	PointerRNA orient_ref_ptr;
 	RNA_pointer_create(&scene->id, &RNA_TransformOrientationSlot, orient_slot, &orient_ref_ptr);
 	{
@@ -1258,6 +1269,7 @@ static void gizmo_xform_message_subscribe(
 	RNA_pointer_create(&scene->id, &RNA_ToolSettings, scene->toolsettings, &toolsettings_ptr);
 
 	if (type_fn == TRANSFORM_GGT_gizmo) {
+		GizmoGroup *ggd = gzgroup->customdata;
 		extern PropertyRNA rna_ToolSettings_transform_pivot_point;
 		extern PropertyRNA rna_ToolSettings_use_gizmo_mode;
 		const PropertyRNA *props[] = {
@@ -2159,15 +2171,20 @@ static void WIDGETGROUP_xform_shear_setup(const bContext *UNUSED(C), wmGizmoGrou
 
 static void WIDGETGROUP_xform_shear_refresh(const bContext *C, wmGizmoGroup *gzgroup)
 {
+	Scene *scene = CTX_data_scene(C);
 	ARegion *ar = CTX_wm_region(C);
 	RegionView3D *rv3d = ar->regiondata;
 
 	struct XFormShearWidgetGroup *xgzgroup = gzgroup->customdata;
 	struct TransformBounds tbounds;
 
+	const TransformOrientationSlot *orient_slot = BKE_scene_orientation_slot_get(scene, SCE_GIZMO_SHOW_ROTATE);
+
 	if (ED_transform_calc_gizmo_stats(
 	            C, &(struct TransformCalcParams) {
 	                .use_local_axis = false,
+	                .orientation_type = orient_slot->type + 1,
+	                .orientation_index_custom = orient_slot->index_custom,
 	            }, &tbounds) == 0)
 	{
 		for (int i = 0; i < 3; i++) {



More information about the Bf-blender-cvs mailing list