Skip to content

Commit

Permalink
Fixed bend deformer editor's angle handle
Browse files Browse the repository at this point in the history
It was not offset to start at the bottom handle's position.
  • Loading branch information
keenanwoodall committed Apr 8, 2019
1 parent 61b05d9 commit f930f37
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Code/Editor/Mesh/Deformers/BendDeformerEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,6 @@ public override void OnSceneGUI ()

private void DrawAngleHandle (BendDeformer bend)
{
var radiusDistanceOffset = HandleUtility.GetHandleSize (bend.Axis.position + bend.Axis.up * bend.Top) * DeformEditorSettings.ScreenspaceSliderHandleCapSize * 2f;

angleHandle.angle = bend.Angle;
angleHandle.radius = (bend.Top - bend.Bottom) + radiusDistanceOffset;
angleHandle.fillColor = Color.clear;

var handleRotation = bend.Axis.rotation * Quaternion.Euler (-90, 0f, 0f);
// There's some weird issue where if you pass the normal lossyScale, the handle's scale on the y axis is changed when the transform's z axis is changed.
Expand All @@ -114,7 +109,14 @@ private void DrawAngleHandle (BendDeformer bend)
y: bend.Axis.lossyScale.z,
z: bend.Axis.lossyScale.y
);
var matrix = Matrix4x4.TRS (bend.Axis.position, handleRotation, handleScale);

var matrix = Matrix4x4.TRS (bend.Axis.position + bend.Axis.up * bend.Bottom * bend.Axis.lossyScale.y, handleRotation, handleScale);

var radiusDistanceOffset = HandleUtility.GetHandleSize (bend.Axis.position + bend.Axis.up * bend.Top) * DeformEditorSettings.ScreenspaceSliderHandleCapSize * 2f;

angleHandle.angle = bend.Angle;
angleHandle.radius = (bend.Top - bend.Bottom) + radiusDistanceOffset;
angleHandle.fillColor = Color.clear;

using (new Handles.DrawingScope (DeformEditorSettings.SolidHandleColor, matrix))
{
Expand Down

0 comments on commit f930f37

Please sign in to comment.