AnimationWindow.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. using BansheeEngine;
  4. namespace BansheeEditor
  5. {
  6. /** @addtogroup Windows
  7. * @{
  8. */
  9. /// <summary>
  10. /// Displays animation curve editor window.
  11. /// </summary>
  12. internal class AnimationWindow : EditorWindow
  13. {
  14. private GUITimeline timeline;
  15. private GUIFloatField lengthField;
  16. private GUIIntField fpsField;
  17. /// <summary>
  18. /// Opens the animation window.
  19. /// </summary>
  20. [MenuItem("Windows/Animation", ButtonModifier.CtrlAlt, ButtonCode.A, 6000)]
  21. private static void OpenGameWindow()
  22. {
  23. OpenWindow<AnimationWindow>();
  24. }
  25. /// <inheritdoc/>
  26. protected override LocString GetDisplayName()
  27. {
  28. return new LocEdString("Animation");
  29. }
  30. private void OnInitialize()
  31. {
  32. lengthField = new GUIFloatField(new LocEdString("Length"), 50);
  33. fpsField = new GUIIntField(new LocEdString("FPS"), 50);
  34. lengthField.Value = 60.0f;
  35. fpsField.Value = 1;
  36. lengthField.OnChanged += x => timeline.SetRange(lengthField.Value);
  37. fpsField.OnChanged += x => timeline.SetFPS(x);
  38. GUILayout buttonLayout = GUI.AddLayoutX();
  39. buttonLayout.AddElement(lengthField);
  40. buttonLayout.AddElement(fpsField);
  41. timeline = new GUITimeline(GUI, Width, 20);
  42. }
  43. protected override void WindowResized(int width, int height)
  44. {
  45. timeline.SetSize(width, 20);
  46. }
  47. private void OnEditorUpdate()
  48. {
  49. //int position = (int)(MathEx.Sin(Time.RealElapsed)*50.0f + 50.0f);
  50. //canvas.SetPosition(position, 0);
  51. }
  52. private void OnDestroy()
  53. {
  54. // TODO
  55. }
  56. }
  57. /** @} */
  58. }