FABRIKRootInspector.cs 924 B

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