FieldSelectionWindow.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. using System;
  4. using bs;
  5. namespace bs.Editor
  6. {
  7. /** @addtogroup Library
  8. * @{
  9. */
  10. /// <summary>
  11. /// Opens up a window that allows the user to select a field to animate using the animation editor.
  12. /// See <see cref="GUIFieldSelector"/>.
  13. /// </summary>
  14. [DefaultSize(250, 350)]
  15. internal class FieldSelectionWindow : DropDownWindow
  16. {
  17. private GUIFieldSelector guiFieldSelector;
  18. public Action<string, SerializableProperty.FieldType> OnFieldSelected;
  19. /// <summary>
  20. /// Constructs the drop down window.
  21. /// </summary>
  22. public FieldSelectionWindow()
  23. {
  24. guiFieldSelector = new GUIFieldSelector(GUI, Selection.SceneObject, Width, Height);
  25. guiFieldSelector.OnElementSelected += (so, comp, path, type) =>
  26. {
  27. OnFieldSelected?.Invoke(path, type);
  28. Close();
  29. };
  30. }
  31. }
  32. /** @} */
  33. }