DrawGizmo.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. /** @addtogroup Gizmos
  7. * @{
  8. */
  9. /// <summary>
  10. /// Controls when a gizmo is displayed and whether it can be interacted with. These flags can be combined to achieve
  11. /// different effect.
  12. /// </summary>
  13. [Flags]
  14. public enum DrawGizmoFlags // Note: Must match the C++ enum DrawGizmoFlags
  15. {
  16. /// <summary>Gizmo is only displayed when its scene object is selected.</summary>
  17. Selected = 0x01,
  18. /// <summary>Gizmo is only displayed when its parent scene object is selected.</summary>
  19. ParentSelected = 0x02,
  20. /// <summary>Gizmo is only displayed when its scene object is not selected.</summary>
  21. NotSelected = 0x04,
  22. /// <summary>Gizmo can be clicked on in scene view, which will select its scene object.</summary>
  23. Pickable = 0x08
  24. }
  25. /// <summary>
  26. /// Notifies the runtime that the method this attribute is specified on serves for gizmo drawing. All drawing in the
  27. /// method should be done using the <see cref="Gizmos"/> class. The method must be static and must accept a single
  28. /// parameter of type deriving from <see cref="Component"/>. Type of the parameter determines for which objects will
  29. /// the gizmo be drawn for.
  30. /// </summary>
  31. [AttributeUsage(AttributeTargets.Method)]
  32. public sealed class DrawGizmo : Attribute
  33. {
  34. #pragma warning disable 0414
  35. private DrawGizmoFlags flags;
  36. #pragma warning restore 0414
  37. /// <summary>
  38. /// Creates a new draw gizmos attribute.
  39. /// </summary>
  40. /// <param name="flags">Flags that control how and when the gizmos is drawn.</param>
  41. public DrawGizmo(DrawGizmoFlags flags)
  42. {
  43. this.flags = flags;
  44. }
  45. }
  46. /** @} */
  47. }