Fix #130180: non-screen space dial gizmo scale does not take geometry scale into account

We can't scale the dial gizmo non-uniformly. Therefore, the average of the x/y/z scale
is used to determine the scale of the gizmo.

Pull Request: https://projects.blender.org/blender/blender/pulls/130183
This commit is contained in:
Jacques Lucke 2024-11-12 22:45:51 +01:00
parent 0565f16f18
commit 917f7e648c

View File

@ -378,7 +378,14 @@ class DialGizmo : public NodeGizmos {
copy_m4_m4(gizmo_->matrix_basis, gizmo_transform.ptr());
WM_gizmo_set_flag(gizmo_, WM_GIZMO_DRAW_NO_SCALE, !screen_space);
copy_m4_m4(gizmo_->matrix_offset, math::from_scale<float4x4>(float3(radius)).ptr());
float transform_scale = 1.0f;
if (!screen_space) {
/* We can't scale the dial gizmo non-uniformly, so just take the average of the scale in each
* axis for now. */
transform_scale = math::average(math::to_scale(params.parent_transform));
}
copy_m4_m4(gizmo_->matrix_offset,
math::from_scale<float4x4>(float3(radius * transform_scale)).ptr());
return true;
}