[Bf-blender-cvs] [cded90f989e] blender2.8: Fix T59709: Light target gizmo scaling

Campbell Barton noreply at git.blender.org
Fri Dec 21 09:26:14 CET 2018


Commit: cded90f989ee3acb1b8006a767d67dea361cb4e5
Author: Campbell Barton
Date:   Fri Dec 21 19:17:30 2018 +1100
Branches: blender2.8
https://developer.blender.org/rBcded90f989ee3acb1b8006a767d67dea361cb4e5

Fix T59709: Light target gizmo scaling

Gizmo was scaling w/ object.

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

M	source/blender/editors/space_view3d/view3d_gizmo_lamp.c

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

diff --git a/source/blender/editors/space_view3d/view3d_gizmo_lamp.c b/source/blender/editors/space_view3d/view3d_gizmo_lamp.c
index 88da7d0b4f4..c4e93234aa5 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_lamp.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_lamp.c
@@ -301,9 +301,17 @@ static void WIDGETGROUP_lamp_target_draw_prepare(const bContext *C, wmGizmoGroup
 	Object *ob = OBACT(view_layer);
 	wmGizmo *gz = wwrapper->gizmo;
 
-	copy_m4_m4(gz->matrix_basis, ob->obmat);
+	normalize_m4_m4(gz->matrix_basis, ob->obmat);
 	unit_m4(gz->matrix_offset);
-	gz->matrix_offset[3][2] = -2.4f / gz->scale_basis;
+
+	if (ob->type == OB_LAMP) {
+		Lamp *la = ob->data;
+		if (la->type == LA_SPOT) {
+			/* Draw just past the lamp size angle gizmo. */
+			madd_v3_v3fl(gz->matrix_basis[3], gz->matrix_basis[2], -la->spotsize);
+		}
+	}
+	gz->matrix_offset[3][2] -= 23.0;
 	WM_gizmo_set_flag(gz, WM_GIZMO_DRAW_OFFSET_SCALE, true);
 }



More information about the Bf-blender-cvs mailing list