FABRIKInspector.cs 982 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. using UnityEditor;
  2. using UnityEngine;
  3. using System.Collections;
  4. namespace RootMotion.FinalIK {
  5. /*
  6. * Custom inspector for FABRIK.
  7. * */
  8. [CustomEditor(typeof(FABRIK))]
  9. public class FABRIKInspector : IKInspector {
  10. private FABRIK script { get { return target as FABRIK; }}
  11. protected override MonoBehaviour GetMonoBehaviour(out int executionOrder) {
  12. executionOrder = 9997;
  13. return script;
  14. }
  15. protected override void OnApplyModifiedProperties() {
  16. if (!Application.isPlaying) script.solver.Initiate(script.transform);
  17. }
  18. protected override void AddInspector() {
  19. // Draw the inspector for IKSolverFABRIK
  20. IKSolverHeuristicInspector.AddInspector(solver, !Application.isPlaying, false);
  21. // Warning box
  22. string message = string.Empty;
  23. if (!script.solver.IsValid(ref message)) AddWarningBox(message);
  24. }
  25. void OnSceneGUI() {
  26. // Draw the scene veiw helpers
  27. IKSolverHeuristicInspector.AddScene(script.solver, Color.cyan, true);
  28. }
  29. }
  30. }