MegaFFDAnimateEditor.cs 1008 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using UnityEngine;
  2. using UnityEditor;
  3. [CanEditMultipleObjects, CustomEditor(typeof(MegaFFDAnimate))]
  4. public class MegaFFDAnimateEditor : Editor
  5. {
  6. bool showpoints = false;
  7. public override void OnInspectorGUI()
  8. {
  9. MegaFFDAnimate ffd = (MegaFFDAnimate)target;
  10. #if !UNITY_5 && !UNITY_2017 && !UNITY_2018 && !UNITY_2019 && !UNITY_2020
  11. EditorGUIUtility.LookLikeControls();
  12. #endif
  13. ffd.Enabled = EditorGUILayout.Toggle("Enabled", ffd.Enabled);
  14. ffd.SetRecord(EditorGUILayout.Toggle("Record", ffd.GetRecord()));
  15. MegaFFD mod = ffd.GetFFD();
  16. showpoints = EditorGUILayout.Foldout(showpoints, "Points");
  17. if ( mod && showpoints )
  18. {
  19. int size = mod.GridSize();
  20. size = size * size * size;
  21. for ( int i = 0; i < size; i++ )
  22. {
  23. ffd.SetPoint(i, EditorGUILayout.Vector3Field("p" + i, ffd.GetPoint(i)));
  24. }
  25. }
  26. //if ( AnimationUtility.InAnimationMode() )
  27. // ffd.SetRecord(true);
  28. //else
  29. // ffd.SetRecord(false);
  30. if ( GUI.changed )
  31. {
  32. EditorUtility.SetDirty(target);
  33. }
  34. }
  35. }