BsSelection.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsEditorPrerequisites.h"
  5. #include "BsModule.h"
  6. namespace BansheeEngine
  7. {
  8. /**
  9. * @brief Handles scene object and resource selection. Triggeres events when selection changes and allows the
  10. * user to query current selection state.
  11. */
  12. class BS_ED_EXPORT Selection : public Module<Selection>
  13. {
  14. public:
  15. Selection();
  16. ~Selection();
  17. /**
  18. * @brief Returns a currently selected set of scene objects.
  19. */
  20. const Vector<HSceneObject>& getSceneObjects() const;
  21. /**
  22. * @brief Sets a new set of scene objects to select, replacing the old ones.
  23. */
  24. void setSceneObjects(const Vector<HSceneObject>& sceneObjects);
  25. /**
  26. * @brief Returns a currently selected set of resource paths.
  27. */
  28. const Vector<Path>& getResourcePaths() const;
  29. /**
  30. * @brief Sets a new set of resource paths to select, replacing the old ones.
  31. */
  32. void setResourcePaths(const Vector<Path>& paths);
  33. /**
  34. * @brief Returns a currently selected set of resource UUIDs.
  35. */
  36. Vector<String> getResourceUUIDs() const;
  37. /**
  38. * @brief Sets a new set of resource UUIDs to select, replacing the old ones.
  39. */
  40. void setResourceUUIDs(const Vector<String>& UUIDs);
  41. /**
  42. * @brief Deselects all currently selected scene objects.
  43. */
  44. void clearSceneSelection();
  45. /**
  46. * @brief Deselects all currently selected resources.
  47. */
  48. void clearResourceSelection();
  49. /**
  50. * @brief Pings the scene object, highlighting it in its respective editors.
  51. */
  52. void ping(const HSceneObject& sceneObject);
  53. /**
  54. * @brief Pings the resource, highlighting it in its respective editors.
  55. *
  56. * @param resourcePath Resource path relative to the project library resources folder.
  57. */
  58. void ping(const Path& resourcePath);
  59. /**
  60. * @brief Triggered whenever scene object or resource selection changes. The provided
  61. * parameters will contain the newly selected objects/resource paths.
  62. */
  63. Event<void(const Vector<HSceneObject>&, const Vector<Path>&)> onSelectionChanged;
  64. /**
  65. * @brief Triggered when a scene object ping is requested. Ping usually means the
  66. * object will be highlighted in its respective editors.
  67. */
  68. Event<void(const HSceneObject&)> onSceneObjectPing;
  69. /**
  70. * @brief Triggered when a resource ping is requested. Ping usually means the
  71. * object will be highlighted in its respective editors.
  72. */
  73. Event<void(const Path&)> onResourcePing;
  74. private:
  75. /**
  76. * @brief Triggered when the scene object selection in the scene tree view changes.
  77. */
  78. void sceneSelectionChanged();
  79. /**
  80. * @brief Triggered when the resource selection in the resource tree view changes.
  81. */
  82. void resourceSelectionChanged();
  83. /**
  84. * @brief Updates scene and resource tree views with new selection.
  85. */
  86. void updateTreeViews();
  87. Vector<HSceneObject> mSelectedSceneObjects;
  88. Vector<Path> mSelectedResourcePaths;
  89. HMessage mSceneSelectionChangedConn;
  90. HMessage mResourceSelectionChangedConn;
  91. };
  92. }