Fix T59709: Light target gizmo scaling
authorCampbell Barton <ideasman42@gmail.com>
Fri, 21 Dec 2018 08:17:30 +0000 (19:17 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 21 Dec 2018 08:25:56 +0000 (19:25 +1100)
Gizmo was scaling w/ object.

source/blender/editors/space_view3d/view3d_gizmo_lamp.c

index 88da7d0b4f4642300f26af1fe1a1de7643ab59d1..c4e93234aa566a431481f7acb23129d4d3e539c9 100644 (file)
@@ -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);
 }