BsSelection.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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 Pings the scene object, highlighting it in its respective editors.
  48. */
  49. void ping(const HSceneObject& sceneObject);
  50. /**
  51. * @brief Pings the resource, highlighting it in its respective editors.
  52. */
  53. void ping(const Path& resourcePath);
  54. /**
  55. * @brief Triggered whenever scene object or resource selection changes. The provided
  56. * parameters will contain the newly selected objects/resource paths.
  57. */
  58. Event<void(const Vector<HSceneObject>&, const Vector<Path>&)> onSelectionChanged;
  59. /**
  60. * @brief Triggered when a scene object ping is requested. Ping usually means the
  61. * object will be highlighted in its respective editors.
  62. */
  63. Event<void(const HSceneObject&)> onSceneObjectPing;
  64. /**
  65. * @brief Triggered when a resource ping is requested. Ping usually means the
  66. * object will be highlighted in its respective editors.
  67. */
  68. Event<void(const Path&)> onResourcePing;
  69. private:
  70. /**
  71. * @brief Triggered when the scene object selection in the scene tree view changes.
  72. */
  73. void sceneSelectionChanged();
  74. /**
  75. * @brief Triggered when the resource selection in the resource tree view changes.
  76. */
  77. void resourceSelectionChanged();
  78. /**
  79. * @brief Updates scene and resource tree views with new selection.
  80. */
  81. void updateTreeViews();
  82. Vector<HSceneObject> mSelectedSceneObjects;
  83. Vector<Path> mSelectedResourcePaths;
  84. HMessage mSceneSelectionChangedConn;
  85. HMessage mResourceSelectionChangedConn;
  86. };
  87. }