DrawGizmo.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. private DrawGizmoFlags flags;
  35. /// <summary>
  36. /// Creates a new draw gizmos attribute.
  37. /// </summary>
  38. /// <param name="flags">Flags that control how and when the gizmos is drawn.</param>
  39. public DrawGizmo(DrawGizmoFlags flags)
  40. {
  41. this.flags = flags;
  42. }
  43. }
  44. /** @} */
  45. }