public override void OnInspectorGUI() { if (!m_IsEditing) { if (GUILayout.Button("Edit Bezier Shape")) { SetIsEditing(true); } EditorGUILayout.HelpBox("Editing a Bezier Shape will erase any modifications made to the mesh!\n\nIf you accidentally enter Edit Mode you can Undo to get your changes back.", MessageType.Warning); return; } if (GUILayout.Button("Editing Bezier Shape", UI.EditorGUIUtility.GetActiveStyle("Button"))) { SetIsEditing(false); } Event e = Event.current; if (m_IsMoving) { if (e.type == EventType.Ignore || e.type == EventType.MouseUp) { OnFinishVertexModification(); } } EditorGUI.BeginChangeCheck(); bool handleIsValid = (m_currentHandle > -1 && m_currentHandle < m_Points.Count); BezierPoint inspectorPoint = handleIsValid ? m_Points[m_currentHandle] : new BezierPoint(Vector3_Zero, Vector3_Backward, Vector3_Forward, Quaternion.identity); inspectorPoint = DoBezierPointGUI(inspectorPoint); if (handleIsValid && EditorGUI.EndChangeCheck()) { if (!m_IsMoving) { OnBeginVertexModification(); } m_Points[m_currentHandle] = inspectorPoint; UpdateMesh(false); } EditorGUI.BeginChangeCheck(); if (GUILayout.Button("Clear Points")) { UndoUtility.RecordObject(m_Target, "Clear Bezier Spline Points"); m_Points.Clear(); UpdateMesh(true); } if (GUILayout.Button("Add Point")) { UndoUtility.RecordObject(m_Target, "Add Bezier Spline Point"); if (m_Points.Count > 0) { m_Points.Add(new BezierPoint(m_Points[m_Points.Count - 1].position, m_Points[m_Points.Count - 1].tangentIn, m_Points[m_Points.Count - 1].tangentOut, Quaternion.identity)); UpdateMesh(true); } else { m_Target.Init(); } m_currentHandle = (BezierHandle)(m_Points.Count - 1); SceneView.RepaintAll(); } GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); m_TangentMode = (BezierTangentMode)GUILayout.Toolbar((int)m_TangentMode, s_TangentModeIcons, commandStyle); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); m_CloseLoop = EditorGUILayout.Toggle("Close Loop", m_CloseLoop); m_Smooth = EditorGUILayout.Toggle("Smooth", m_Smooth); m_Radius = Mathf.Max(.001f, EditorGUILayout.FloatField("Radius", m_Radius)); m_Rows = Math.Clamp(EditorGUILayout.IntField("Rows", m_Rows), 3, 512); m_Columns = Math.Clamp(EditorGUILayout.IntField("Columns", m_Columns), 3, 512); if (EditorGUI.EndChangeCheck()) { UpdateMesh(true); } if (ProGridsInterface.GetProGridsType() != null) { s_SnapTangents = EditorGUILayout.Toggle("Snap Tangents", s_SnapTangents); } }