WuhuIslandTesting/Library/PackageCache/com.unity.splines@1.0.1/Editor/GUI/EditorSplineGizmos.cs
2025-01-07 02:06:59 +01:00

26 lines
876 B
C#

using UnityEditor.EditorTools;
using UnityEngine;
using UnityEngine.Splines;
using UObject = UnityEngine.Object;
namespace UnityEditor.Splines
{
static class EditorSplineGizmos
{
[DrawGizmo(GizmoType.Active | GizmoType.NonSelected | GizmoType.Selected | GizmoType.Pickable)]
static void DrawUnselectedSplineGizmos(ISplineProvider provider, GizmoType gizmoType)
{
//Skip if tool engaged is a spline tool
if (typeof(SplineTool).IsAssignableFrom(ToolManager.activeToolType) &&
(provider is UObject objectProvider) && EditableSplineManager.TryGetTargetData(objectProvider, out _))
return;
var prev = Gizmos.color;
Gizmos.color = (gizmoType & (GizmoType.Selected | GizmoType.Active)) > 0
? Handles.selectedColor
: SplineGizmoUtility.s_GizmosLineColor.value;
SplineGizmoUtility.DrawGizmos(provider);
Gizmos.color = prev;
}
}
}