ReflectionProbeInspector.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. using System.Collections.Generic;
  4. using bs;
  5. namespace bs.Editor
  6. {
  7. /** @addtogroup Inspectors
  8. * @{
  9. */
  10. /// <summary>
  11. /// Renders an inspector for the <see cref="ReflectionProbe"/> component.
  12. /// </summary>
  13. [CustomInspector(typeof(ReflectionProbe))]
  14. internal class ReflectionProbeInspector : Inspector
  15. {
  16. private GUIButton captureButton = new GUIButton(new LocEdString("Capture"));
  17. /// <inheritdoc/>
  18. protected internal override void Initialize()
  19. {
  20. ReflectionProbe probe = (ReflectionProbe)InspectedObject;
  21. drawer.AddDefault(probe);
  22. drawer.AddConditional("Radius", () => probe.Type == ReflectionProbeType.Sphere);
  23. drawer.AddConditional("Extents", () => probe.Type == ReflectionProbeType.Box);
  24. captureButton.OnClick += () => probe.Capture();
  25. Layout.AddSpace(10);
  26. Layout.AddElement(captureButton);
  27. }
  28. }
  29. /** @} */
  30. }