DrawGizmo.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. using System;
  4. namespace BansheeEditor
  5. {
  6. /// <summary>
  7. /// Controls when a gizmo is displayed and whether it can be interacted with. These flags can be combined to achieve
  8. /// different effect.
  9. /// </summary>
  10. [Flags]
  11. public enum DrawGizmoFlags // Note: Must match the C++ enum DrawGizmoFlags
  12. {
  13. /// <summary>Gizmo is only displayed when its scene object is selected.</summary>
  14. Selected = 0x01,
  15. /// <summary>Gizmo is only displayed when its parent scene object is selected.</summary>
  16. ParentSelected = 0x02,
  17. /// <summary>Gizmo is only displayed when its scene object is not selected.</summary>
  18. NotSelected = 0x04,
  19. /// <summary>Gizmo can be clicked on in scene view, which will select its scene object.</summary>
  20. Pickable = 0x08
  21. }
  22. /// <summary>
  23. /// Notifies the runtime that the method this attribute is specified on serves for gizmo drawing. All drawing in the
  24. /// method should be done using the <see cref="Gizmos"/> class. The method must be static and must accept a single
  25. /// parameter of type deriving from <see cref="Component"/>. Type of the parameter determines for which objects will
  26. /// the gizmo be drawn for.
  27. /// </summary>
  28. [AttributeUsage(AttributeTargets.Method)]
  29. public sealed class DrawGizmo : Attribute
  30. {
  31. private DrawGizmoFlags flags;
  32. /// <summary>
  33. /// Creates a new draw gizmos attribute.
  34. /// </summary>
  35. /// <param name="flags">Flags that control how and when the gizmos is drawn.</param>
  36. public DrawGizmo(DrawGizmoFlags flags)
  37. {
  38. this.flags = flags;
  39. }
  40. }
  41. }