Example #1
0
        void DrawPointInspector(BezierPoint point, int index)
        {
            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button("X", GUILayout.Width(20)))
            {
                Undo.SetCurrentGroupName("Remove Point");

                Undo.RecordObject(curve, "Remove Point Reference");
                pointsProp.MoveArrayElement(curve.GetPointIndex(point), curve.pointCount - 1);
                pointsProp.arraySize--;
                Undo.DestroyObjectImmediate(point.gameObject);

                Undo.CollapseUndoOperations(Undo.GetCurrentGroup());

                return;
            }

            EditorGUILayout.ObjectField(point.gameObject, typeof(GameObject), true);

            if (index != 0 && GUILayout.Button(@"/\", GUILayout.Width(25)))
            {
                UnityEngine.Object other = pointsProp.GetArrayElementAtIndex(index - 1).objectReferenceValue;
                pointsProp.GetArrayElementAtIndex(index - 1).objectReferenceValue = point;
                pointsProp.GetArrayElementAtIndex(index).objectReferenceValue     = other;
            }

            if (index != pointsProp.arraySize - 1 && GUILayout.Button(@"\/", GUILayout.Width(25)))
            {
                UnityEngine.Object other = pointsProp.GetArrayElementAtIndex(index + 1).objectReferenceValue;
                pointsProp.GetArrayElementAtIndex(index + 1).objectReferenceValue = point;
                pointsProp.GetArrayElementAtIndex(index).objectReferenceValue     = other;
            }

            EditorGUILayout.EndHorizontal();

            EditorGUI.indentLevel++;
            EditorGUI.indentLevel++;

            BezierPointEditor.DrawInspector(point, drawPositionInspector: true);

            EditorGUI.indentLevel--;
            EditorGUI.indentLevel--;
        }
Example #2
0
 static void DrawPointSceneGUI(BezierPoint point)
 {
     BezierPointEditor.DrawSceneGUI(point, selected: false);
 }