DrawGizmo.cs 1.6 KB

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