AnimationGizmo.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  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 Gizmos
  7. * @{
  8. */
  9. /// <summary>
  10. /// Handles drawing of gizmos for the <see cref="Animation"/> component.
  11. /// </summary>
  12. internal class AnimationGizmo
  13. {
  14. /// <summary>
  15. /// Method called by the runtime when gizmos are meant to be drawn.
  16. /// </summary>
  17. /// <param name="animation">Animation component to draw gizmo for.</param>
  18. [DrawGizmo(DrawGizmoFlags.Selected | DrawGizmoFlags.ParentSelected)]
  19. private static void DrawGizmo(Animation animation)
  20. {
  21. SceneObject so = animation.SceneObject;
  22. Gizmos.Color = Color.Green;
  23. Gizmos.Transform = Matrix4.TRS(so.Position, so.Rotation, Vector3.One);
  24. AABox bounds = animation.Bounds;
  25. Vector3 scaledSize = bounds.Size * so.Scale;
  26. Gizmos.DrawWireCube(bounds.Center, scaledSize * 0.5f);
  27. }
  28. }
  29. /** @} */
  30. }