BsSelection.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. #include "BsModule.h"
  4. namespace BansheeEngine
  5. {
  6. /**
  7. * @brief Handles SceneObject and Resource selection.
  8. */
  9. class BS_ED_EXPORT Selection : public Module<Selection>
  10. {
  11. public:
  12. Selection();
  13. ~Selection();
  14. /**
  15. * @brief Returns a currently selected set of scene objects.
  16. */
  17. const Vector<HSceneObject>& getSceneObjects() const;
  18. /**
  19. * @brief Sets a new set of scene objects to select, replacing the old ones.
  20. */
  21. void setSceneObjects(const Vector<HSceneObject>& sceneObjects);
  22. /**
  23. * @brief Returns a currently selected set of resource paths.
  24. */
  25. const Vector<Path>& getResourcePaths() const;
  26. /**
  27. * @brief Sets a new set of resource paths to select, replacing the old ones.
  28. */
  29. void setResourcePaths(const Vector<Path>& paths);
  30. /**
  31. * @brief Returns a currently selected set of resource UUIDs.
  32. */
  33. Vector<String> getResourceUUIDs() const;
  34. /**
  35. * @brief Sets a new set of resource UUIDs to select, replacing the old ones.
  36. */
  37. void setResourceUUIDs(const Vector<String>& UUIDs);
  38. /**
  39. * @brief Deselects all currently selected scene objects.
  40. */
  41. void clearSceneSelection();
  42. /**
  43. * @brief Deselects all currently selected resources.
  44. */
  45. void clearResourceSelection();
  46. /**
  47. * @brief Triggered whenever scene object or resource selection changes. The provided
  48. * parameters will contain the newly selected objects/resource paths.
  49. */
  50. Event<void(const Vector<HSceneObject>&, const Vector<Path>&)> onSelectionChanged;
  51. private:
  52. /**
  53. * @brief Triggered when the scene object selection in the scene tree view changes.
  54. */
  55. void sceneSelectionChanged();
  56. /**
  57. * @brief Triggered when the resource selection in the resource tree view changes.
  58. */
  59. void resourceSelectionChanged();
  60. /**
  61. * @brief Updates scene and resource tree views with new selection.
  62. */
  63. void updateTreeViews();
  64. Vector<HSceneObject> mSelectedSceneObjects;
  65. Vector<Path> mSelectedResourcePaths;
  66. HMessage mSceneSelectionChangedConn;
  67. HMessage mResourceSelectionChangedConn;
  68. };
  69. }