Skip to content

Commit

Permalink
Add button in inspector to engage the scene view tool
Browse files Browse the repository at this point in the history
  • Loading branch information
glabute committed May 15, 2024
1 parent 4a2fde0 commit 118b07f
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ class CinemachineSplineRollEditor : UnityEditor.Editor
public override VisualElement CreateInspectorGUI()
{
var ux = new VisualElement();

ux.Add(new Button(() => ToolManager.SetActiveTool(typeof(SplineRollTool)))
{ text = "Edit Data Points in Scene View" });
ux.AddSpace();

var prop = serializedObject.GetIterator();
if (prop.NextVisible(true))
InspectorUtility.AddRemainingProperties(ux, prop);
Expand Down Expand Up @@ -147,7 +152,7 @@ static void OnSplineDataChanged(SplineData<float> data)
}


[EditorTool("Roll Tool", typeof(CinemachineSplineRoll))]
[EditorTool("Spline Roll Tool", typeof(CinemachineSplineRoll))]
sealed class SplineRollTool : EditorTool, IDrawSelectedHandles
{
GUIContent m_IconContent;
Expand Down Expand Up @@ -272,7 +277,6 @@ bool DrawDataPoint(int controlID, Vector3 position, Vector3 tangent, Vector3 up,
return true;
}
}

return false;
}
}
Expand Down

0 comments on commit 118b07f

Please sign in to comment.