BsEditorSettings.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. #include "BsSettings.h"
  4. #include "BsDegree.h"
  5. namespace BansheeEngine
  6. {
  7. struct RecentProject;
  8. /**
  9. * @brief Contains various globally accessible editor preferences.
  10. */
  11. class BS_ED_EXPORT EditorSettings : public Settings
  12. {
  13. public:
  14. EditorSettings();
  15. /**
  16. * @brief Checks is snapping enabled for move handles in scene view.
  17. */
  18. bool getMoveHandleSnapActive() const { return mMoveSnapActive; }
  19. /**
  20. * @brief Checks is angle snapping enabled for rotate handles in scene view.
  21. */
  22. bool getRotateHandleSnapActive() const { return mRotateSnapActive; }
  23. /**
  24. * @brief Gets the snap amount if move snapping is enabled. All move handles
  25. * will move in multiples of this amount.
  26. */
  27. float getMoveHandleSnap() const { return mMoveSnap; }
  28. /**
  29. * @brief Gets the snap amount if rotate snapping is enabled. All rotate handles
  30. * will rotate in multiples of this amount.
  31. */
  32. Degree getRotationHandleSnap() const { return mRotationSnap; }
  33. /**
  34. * @brief Returns the size that determines to total size of the scene view grid (its width and height).
  35. */
  36. UINT32 getGridSize() const { return mGridSize; }
  37. /**
  38. * @brief Returns the distance between scene view grid lines.
  39. */
  40. float getGridSpacing() const { return mGridAxisSpacing; }
  41. /**
  42. * @brief Gets the default size of all scene view handles.
  43. */
  44. float getHandleSize() const { return mHandleSize; }
  45. /**
  46. * @brief Returns the currently active scene view tool (e.g. move, rotate, etc.)
  47. */
  48. UINT32 getActiveSceneTool() const { return mActiveSceneTool; }
  49. /**
  50. * @brief Returns the currently active coordinate mode for scene view (e.g. global/local)
  51. */
  52. UINT32 getActiveCoordinateMode() const { return mActiveCoordinateMode; }
  53. /**
  54. * @brief Returns the currently active pivot mode for scene view (e.g. pivot/center)
  55. */
  56. UINT32 getActivePivotMode() const { return mActivePivotMode; }
  57. /**
  58. * @brief Retrieves the path to the last project open in the editor.
  59. */
  60. Path getLastOpenProject() const { return mLastOpenProject; }
  61. /**
  62. * @brief Retrieves whether the last open project should be automatically loaded
  63. * on editor start up.
  64. */
  65. bool getAutoLoadLastProject() const { return mAutoLoadLastProject; }
  66. /**
  67. * @brief Retrieves a list of most recently loaded project paths and their last access times.
  68. */
  69. const Vector<RecentProject>& getRecentProjects() const { return mRecentProjects; }
  70. /**
  71. * @brief Enables/disables snapping for move handles in scene view.
  72. */
  73. void setMoveHandleSnapActive(bool snapActive) { mMoveSnapActive = snapActive; markAsDirty(); }
  74. /**
  75. * @brief Enables/disables angle snapping for rotate handles in scene view.
  76. */
  77. void setRotateHandleSnapActive(bool snapActive) { mRotateSnapActive = snapActive; markAsDirty(); }
  78. /**
  79. * @brief Sets the move snap amount. All move handles will move in multiples of this amount.
  80. */
  81. void setMoveHandleSnap(float value) { mMoveSnap = value; markAsDirty(); }
  82. /**
  83. * @brief Sets the rotate snap amount. All rotate handles will rotate in multiples of this amount.
  84. */
  85. void setRotationHandleSnap(Degree value) { mRotationSnap = value; markAsDirty(); }
  86. /**
  87. * @brief Sets the size that determines to total size of the scene view grid (its width and height).
  88. */
  89. void setGridSize(UINT32 value) { mGridSize = value; markAsDirty(); }
  90. /**
  91. * @brief Sets the distance between scene view grid lines.
  92. */
  93. void setGridSpacing(float value) { mGridAxisSpacing = value; markAsDirty(); }
  94. /**
  95. * @brief Sets the default size of all scene view handles.
  96. */
  97. void setHandleSize(float value) { mHandleSize = value; markAsDirty(); }
  98. /**
  99. * @brief Changes the currently active scene view tool (e.g. move, rotate, etc.)
  100. */
  101. void setActiveSceneTool(UINT32 value) { mActiveSceneTool = value; markAsDirty(); }
  102. /**
  103. * @brief Changes the currently active coordinate mode for scene view (e.g. global/local)
  104. */
  105. void setActiveCoordinateMode(UINT32 value) { mActiveCoordinateMode = value; markAsDirty(); }
  106. /**
  107. * @brief Changes the currently active pivot mode for scene view (e.g. pivot/center)
  108. */
  109. void setActivePivotMode(UINT32 value) { mActivePivotMode = value; markAsDirty(); }
  110. /**
  111. * @brief Sets the path to the last project open in the editor.
  112. */
  113. void setLastOpenProject(const Path& value) { mLastOpenProject = value; markAsDirty(); }
  114. /**
  115. * @brief Sets whether the last open project should be automatically loaded
  116. * on editor start up.
  117. */
  118. void setAutoLoadLastProject(bool value) { mAutoLoadLastProject = value; markAsDirty(); }
  119. /**
  120. * @brief Sets a list of most recently loaded project paths and their last access times.
  121. */
  122. void setRecentProjects(const Vector<RecentProject>& value) { mRecentProjects = value; markAsDirty(); }
  123. private:
  124. bool mMoveSnapActive;
  125. bool mRotateSnapActive;
  126. float mMoveSnap;
  127. Degree mRotationSnap;
  128. UINT32 mGridSize;
  129. float mGridAxisSpacing;
  130. UINT32 mActiveSceneTool;
  131. UINT32 mActiveCoordinateMode;
  132. UINT32 mActivePivotMode;
  133. float mHandleSize;
  134. Path mLastOpenProject;
  135. bool mAutoLoadLastProject;
  136. Vector<RecentProject> mRecentProjects;
  137. /************************************************************************/
  138. /* RTTI */
  139. /************************************************************************/
  140. public:
  141. friend class EditorSettingsRTTI;
  142. static RTTITypeBase* getRTTIStatic();
  143. virtual RTTITypeBase* getRTTI() const override;
  144. };
  145. /**
  146. * @brief Data about a recently loaded project.
  147. */
  148. struct RecentProject
  149. {
  150. Path path;
  151. UINT64 accessTimestamp;
  152. };
  153. }