You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CrowdControl/Assets/Feel/MMTools/Editor/MMCurves/MMPlotterEditor.cs

50 lines
1.4 KiB
C#

using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEditor;
using UnityEngine;
namespace MoreMountains.Tools
{
/// <summary>
/// A custom editor displaying a foldable list of MMFeedbacks, a dropdown to add more, as well as test buttons to test your feedbacks at runtime
/// </summary>
[CanEditMultipleObjects]
[CustomEditor(typeof(MMPlotter), true)]
public class MMPlotterEditor : Editor
{
protected string[] _typeDisplays;
protected string[] _excludedProperties = new string[] { "TweenMethod", "m_Script" };
protected MMPlotter _mmPlotter;
protected virtual void OnEnable()
{
_mmPlotter = target as MMPlotter;
_typeDisplays = _mmPlotter.GetMethodsList();
}
public override void OnInspectorGUI()
{
serializedObject.Update();
Undo.RecordObject(target, "Modified Plotter");
EditorGUILayout.Space();
EditorGUILayout.LabelField("Tween Method", EditorStyles.boldLabel);
_mmPlotter.TweenMethodIndex = EditorGUILayout.Popup("Tween Method", _mmPlotter.TweenMethodIndex, _typeDisplays, EditorStyles.popup);
//int newItem = EditorGUILayout.Popup(0, _typeDisplays) - 1;
//DrawDefaultInspector();
DrawPropertiesExcluding(serializedObject, _excludedProperties);
if (GUILayout.Button("Draw Graph"))
{
_mmPlotter.DrawGraph();
}
serializedObject.ApplyModifiedProperties();
}
}
}