Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,9 @@ public static bool RenderIndentedButton(GUIContent content, GUIStyle style, para
/// <returns><see langword="true"/> if button clicked, <see langword="false"/> if otherwise.</returns>
public static bool RenderIndentedButton(Func<bool> renderButton)
{
bool result = false;
GUILayout.BeginHorizontal();
GUILayout.Space(EditorGUI.indentLevel * 15);
result = renderButton();
bool result = renderButton();
GUILayout.EndHorizontal();
return result;
}
Expand Down Expand Up @@ -951,11 +950,7 @@ public static float AxisMoveHandle(Object target, Vector3 origin, Vector3 direct

Handles.DrawDottedLine(origin, position, DottedLineScreenSpace);
Handles.ArrowHandleCap(0, position, Quaternion.LookRotation(direction), handleSize * 2, EventType.Repaint);
#if UNITY_2022_1_OR_NEWER
Vector3 newPosition = Handles.FreeMoveHandle(position, handleSize, Vector3.zero, Handles.CircleHandleCap);
#else
Vector3 newPosition = Handles.FreeMoveHandle(position, Quaternion.identity, handleSize, Vector3.zero, Handles.CircleHandleCap);
#endif

if (recordUndo)
{
Expand Down Expand Up @@ -992,11 +987,7 @@ public static Vector3 CircleMoveHandle(Object target, Vector3 position, float xS
handleSize = Mathf.Lerp(handleSize, HandleUtility.GetHandleSize(position) * handleSize, 0.75f);
}

#if UNITY_2022_1_OR_NEWER
Vector3 newPosition = Handles.FreeMoveHandle(position, handleSize, Vector3.zero, Handles.CircleHandleCap);
#else
Vector3 newPosition = Handles.FreeMoveHandle(position, Quaternion.identity, handleSize, Vector3.zero, Handles.CircleHandleCap);
#endif

if (recordUndo && position != newPosition)
{
Expand Down Expand Up @@ -1032,11 +1023,7 @@ public static Vector3 SquareMoveHandle(Object target, Vector3 position, float xS
}

// Multiply square handle to match other types
#if UNITY_2022_1_OR_NEWER
Vector3 newPosition = Handles.FreeMoveHandle(position, handleSize * 0.8f, Vector3.zero, Handles.RectangleHandleCap);
#else
Vector3 newPosition = Handles.FreeMoveHandle(position, Quaternion.identity, handleSize * 0.8f, Vector3.zero, Handles.RectangleHandleCap);
#endif

if (recordUndo && position != newPosition)
{
Expand Down Expand Up @@ -1072,11 +1059,7 @@ public static Vector3 SphereMoveHandle(Object target, Vector3 position, float xS
}

// Multiply sphere handle size to match other types
#if UNITY_2022_1_OR_NEWER
Vector3 newPosition = Handles.FreeMoveHandle(position, handleSize * 2, Vector3.zero, Handles.SphereHandleCap);
#else
Vector3 newPosition = Handles.FreeMoveHandle(position, Quaternion.identity, handleSize * 2, Vector3.zero, Handles.SphereHandleCap);
#endif

if (recordUndo && position != newPosition)
{
Expand Down Expand Up @@ -1146,12 +1129,7 @@ public static Vector3 VectorHandle(

// Draw a line from origin to origin + direction
Handles.DrawLine(origin, handlePosition);

#if UNITY_2022_1_OR_NEWER
Vector3 newPosition = Handles.FreeMoveHandle(handlePosition, handleSize, Vector3.zero, Handles.DotHandleCap);
#else
Vector3 newPosition = Handles.FreeMoveHandle(handlePosition, Quaternion.identity, handleSize, Vector3.zero, Handles.DotHandleCap);
#endif

if (recordUndo && handlePosition != newPosition)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,7 @@ private float DrawPlaneAndHandle(Vector3[] vertices, Vector2 halfExtents, float
Handles.ArrowHandleCap(0, vertices[1], Quaternion.LookRotation(planeNormal), handleSize * 2, EventType.Repaint);
Handles.ArrowHandleCap(0, vertices[1], Quaternion.LookRotation(-planeNormal), handleSize * 2, EventType.Repaint);

#if UNITY_2022_1_OR_NEWER
Vector3 newPosition = Handles.FreeMoveHandle(vertices[1], handleSize, Vector3.zero, Handles.SphereHandleCap);
#else
Vector3 newPosition = Handles.FreeMoveHandle(vertices[1], Quaternion.identity, handleSize, Vector3.zero, Handles.SphereHandleCap);
#endif

if (!newPosition.Equals(vertices[1]))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,31 +69,15 @@ private void OnSceneGUI()

EditorGUI.BeginChangeCheck();

#if UNITY_2022_1_OR_NEWER
Vector3 newStartPosition = Handles.FreeMoveHandle(startPos,
handleSize,
Vector3.zero,
Handles.SphereHandleCap);
#else
Vector3 newStartPosition = Handles.FreeMoveHandle(startPos,
Quaternion.identity,
handleSize,
Vector3.zero,
Handles.SphereHandleCap);
#endif

#if UNITY_2022_1_OR_NEWER
Vector3 newEndPosition = Handles.FreeMoveHandle(endPos,
handleSize,
Vector3.zero,
Handles.SphereHandleCap);
#else
Vector3 newEndPosition = Handles.FreeMoveHandle(endPos,
Quaternion.identity,
handleSize,
Vector3.zero,
Handles.SphereHandleCap);
#endif

if (EditorGUI.EndChangeCheck())
{
Expand Down