BsBuiltinEditorResources.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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 "GUI/BsGUISkin.h"
  6. #include "Utility/BsModule.h"
  7. #include "GUI/BsGUIContent.h"
  8. #include "BsApplication.h"
  9. namespace bs
  10. {
  11. /** @addtogroup Utility-Editor
  12. * @{
  13. */
  14. /** Types of valid icons used when viewing the project library. */
  15. enum BS_SCRIPT_EXPORT(api:bed) class ProjectLibraryIcon
  16. {
  17. Folder, Mesh, Font, Texture, PlainText, ScriptCode, SpriteTexture, Shader, ShaderInclude, Material, Prefab, GUISkin,
  18. PhysicsMaterial, PhysicsMesh, AudioClip, AnimationClip, VectorField
  19. };
  20. /** Types of icons that may be displayed on the tool bar. */
  21. enum BS_SCRIPT_EXPORT(api:bed) class ToolbarIcon
  22. {
  23. NewCamera, NewRenderable, NewPointLight, NewDirLight, NewSpotLight, NewSceneObject, NewCube, NewSphere, NewCone,
  24. NewQuad, NewMat, NewCSScript, NewShader, NewSpriteTex, Pause, Play, Step, Undo, Redo, OpenProject, SaveProject,
  25. SaveScene
  26. };
  27. /** Types of icons that are used as 3D icons in the scene view. */
  28. enum BS_SCRIPT_EXPORT(api:bed) class SceneViewIcon
  29. {
  30. Camera, Light, AudioSource, AudioListener, Decal, ParticleSystem, LightProbes, ReflectionProbe
  31. };
  32. /** Types of icons that may be displayed in the scene window. */
  33. enum BS_SCRIPT_EXPORT(api:bed) class SceneWindowIcon
  34. {
  35. View, Move, Rotate, Scale, Pivot, Center, Local, World, MoveSnap, RotateSnap, SceneCameraOptions
  36. };
  37. /** Types of icons that may be displayed in the inspector window. */
  38. enum BS_SCRIPT_EXPORT(api:bed) class InspectorWindowIcon
  39. {
  40. Create, Clone, Clear, Resize, Delete, MoveUp, MoveDown, Edit, Apply, Add, Cancel
  41. };
  42. /** Types of icons that may be displayed in the library window. */
  43. enum BS_SCRIPT_EXPORT(api:bed) class LibraryWindowIcon
  44. {
  45. Home, Up, Clear, Options
  46. };
  47. /** Types of icons that may be displayed in the animation editor window. */
  48. enum BS_SCRIPT_EXPORT(api:bed) class AnimationWindowIcon
  49. {
  50. Play, Record, FrameForward, FrameBack, AddKeyframe, AddEvent, Keyframe, Event
  51. };
  52. /** Types of icons used in various areas throughout the editor. */
  53. enum BS_SCRIPT_EXPORT(api:bed) class EditorIcon
  54. {
  55. X, Component, SceneObject
  56. };
  57. /** Types of icons to be used along with log messages depending on their severity. */
  58. enum BS_SCRIPT_EXPORT(api:bed) class LogMessageIcon
  59. {
  60. Info, Warning, Error
  61. };
  62. /** Contains a set of built-in resources used by the editor. */
  63. class BS_ED_EXPORT BS_SCRIPT_EXPORT(n:EditorBuiltin,m:Utility-Editor,api:bed)
  64. BuiltinEditorResources : public bs::Module<BuiltinEditorResources>
  65. {
  66. public:
  67. BuiltinEditorResources();
  68. /** Returns the default editor GUI skin. */
  69. BS_SCRIPT_EXPORT(pr:getter,n:GUISkin)
  70. BS_NORREF const HGUISkin& getSkin() const { return mSkin; }
  71. /** Returns the default font used by the editor. */
  72. BS_SCRIPT_EXPORT(pr:getter,n:DefaultFont)
  73. BS_NORREF const HFont& getDefaultFont() const { return mDefaultFont; }
  74. /** Returns the default antialiased font used by the editor. */
  75. BS_SCRIPT_EXPORT(pr:getter,n:DefaultAAFont)
  76. BS_NORREF const HFont& getDefaultAAFont() const { return mDefaultAAFont; }
  77. /** Creates a material used for docking drop overlay used by the editor. */
  78. HMaterial createDockDropOverlayMaterial() const;
  79. /** Creates a material used for rendering the scene grid. */
  80. HMaterial createSceneGridMaterial() const;
  81. /** Creates a material used for picking non-transparent objects in scene view. */
  82. HMaterial createPicking(CullingMode cullMode) const;
  83. /** Creates a material used for picking transparent objects in scene view. */
  84. HMaterial createPickingAlpha(CullingMode cullMode) const;
  85. /** Creates a material used for rendering line gizmos. */
  86. HMaterial createLineGizmoMat() const;
  87. /** Creates a material used for rendering solid gizmos. */
  88. HMaterial createSolidGizmoMat() const;
  89. /** Creates a material used for rendering wireframe gizmos. */
  90. HMaterial createWireGizmoMat() const;
  91. /** Creates a material used for rendering icon gizmos. */
  92. HMaterial createIconGizmoMat() const;
  93. /** Creates a material used for picking non-transparent gizmos. */
  94. HMaterial createGizmoPickingMat() const;
  95. /** Creates a material used for picking transparent gizmos. */
  96. HMaterial createAlphaGizmoPickingMat() const;
  97. /** Creates a material used for rendering line handles. */
  98. HMaterial createLineHandleMat() const;
  99. /** Creates a material used for rendering solid handles. */
  100. HMaterial createSolidHandleMat() const;
  101. /** Creates a material used for rendering text for gizmos and handles. */
  102. HMaterial createTextGizmoMat() const;
  103. /** Creates a material used for clearing the alpha channel of the handle rendering texture. */
  104. HMaterial createHandleClearAlphaMat() const;
  105. /** Creates a material used for displaying selected objects. */
  106. HMaterial createSelectionMat() const;
  107. /**
  108. * Retrieves an icon that represents a specific resource type that may be displayed when viewing the project
  109. * library.
  110. */
  111. BS_SCRIPT_EXPORT()
  112. BS_NORREF HSpriteTexture getProjectLibraryIcon(ProjectLibraryIcon icon, int size) const;
  113. /** Retrieves an icon that may be displayed on the main window's toolbar. */
  114. BS_SCRIPT_EXPORT()
  115. BS_NORREF HSpriteTexture getToolbarIcon(ToolbarIcon icon) const;
  116. /** Retrieves an icon that may be displayed on the scene window. */
  117. BS_SCRIPT_EXPORT()
  118. GUIContentImages getSceneWindowIcon(SceneWindowIcon icon) const;
  119. /** Retrieves an icon that may be displayed in the 3D scene view. */
  120. BS_SCRIPT_EXPORT()
  121. BS_NORREF HSpriteTexture getSceneViewIcon(SceneViewIcon icon) const;
  122. /** Retrieves an icon that may be displayed on the library window. */
  123. BS_SCRIPT_EXPORT()
  124. BS_NORREF HSpriteTexture getLibraryWindowIcon(LibraryWindowIcon icon) const;
  125. /** Retrieves an icon that may be displayed on the inspector window. */
  126. BS_SCRIPT_EXPORT()
  127. BS_NORREF HSpriteTexture getInspectorWindowIcon(InspectorWindowIcon icon) const;
  128. /** Retrieves an icon that may be displayed on the animation editor window. */
  129. BS_SCRIPT_EXPORT()
  130. GUIContentImages getAnimationWindowIcon(AnimationWindowIcon icon) const;
  131. /** Retrieves an icon that represents a specific generic editor icon. */
  132. BS_SCRIPT_EXPORT()
  133. BS_NORREF HSpriteTexture getEditorIcon(EditorIcon icon) const;
  134. /** Retrieves an icon that represents a specific log message type. */
  135. BS_SCRIPT_EXPORT()
  136. BS_NORREF HSpriteTexture getLogMessageIcon(LogMessageIcon icon, UINT32 size, bool dark) const;
  137. /** Returns text contained in the default "empty" shader. */
  138. BS_SCRIPT_EXPORT(pr:getter,n:EmptyShaderCode)
  139. String getEmptyShaderCode() const;
  140. /** Returns text contained in the default "empty" C# script. */
  141. BS_SCRIPT_EXPORT(pr:getter,n:EmptyCSScriptCode)
  142. String getEmptyCSScriptCode() const;
  143. /** Returns image data the Banshee Engine splash screen. */
  144. static SPtr<PixelData> getSplashScreen();
  145. /** Returns absolute path to the builtin shader include folder. */
  146. static Path getShaderIncludeFolder();
  147. /** Returns absolute path to the default widget layout file. */
  148. static Path getDefaultWidgetLayoutPath();
  149. static const String ObjectFieldStyleName;
  150. static const String ObjectFieldLabelStyleName;
  151. static const String ObjectFieldDropBtnStyleName;
  152. static const String ObjectFieldClearBtnStyleName;
  153. static const String TextureFieldStyleName;
  154. static const String TextureFieldLabelStyleName;
  155. static const String TextureFieldDropStyleName;
  156. static const String TextureFieldClearBtnStyleName;
  157. private:
  158. /** Loads a GUI icon with the specified filename. */
  159. HSpriteTexture getGUIIcon(const String& name) const;
  160. /** Loads a GUI icon with the specified filename. */
  161. HSpriteTexture getGUIIcon3D(const String& name) const;
  162. /** Loads a shader with the specified filename */
  163. HShader getShader(const String& name) const;
  164. HShader mShaderDockOverlay;
  165. HShader mShaderSceneGrid;
  166. HShader mShaderPicking[3];
  167. HShader mShaderPickingAlpha[3];
  168. HShader mShaderGizmoSolid;
  169. HShader mShaderGizmoWire;
  170. HShader mShaderGizmoLine;
  171. HShader mShaderGizmoIcon;
  172. HShader mShaderGizmoPicking;
  173. HShader mShaderGizmoAlphaPicking;
  174. HShader mShaderGizmoText;
  175. HShader mShaderHandleSolid;
  176. HShader mShaderHandleLine;
  177. HShader mShaderHandleClearAlpha;
  178. HShader mShaderSelection;
  179. HFont mDefaultFont;
  180. HFont mDefaultAAFont;
  181. HGUISkin mSkin;
  182. SPtr<ResourceManifest> mResourceManifest;
  183. static const char* ShaderFolder;
  184. static const char* SkinFolder;
  185. static const char* IconFolder;
  186. static const char* Icon3DFolder;
  187. static const char* ShaderIncludeFolder;
  188. static const char* SpriteSubFolder;
  189. Path BuiltinDataFolder;
  190. Path EditorSkinFolder;
  191. Path EditorSkinSpritesFolder;
  192. Path EditorIconFolder;
  193. Path EditorIcon3DFolder;
  194. Path EditorIconSpritesFolder;
  195. Path EditorIcon3DSpritesFolder;
  196. Path EditorShaderFolder;
  197. Path EditorShaderIncludeFolder;
  198. Path BuiltinRawDataFolder;
  199. Path EditorRawSkinFolder;
  200. Path EditorRawIconsFolder;
  201. Path EditorRawShaderIncludeFolder;
  202. Path EditorRawShaderFolder;
  203. Path ResourceManifestPath;
  204. static const String DefaultFontFilename;
  205. static const String DefaultAAFontFilename;
  206. static const UINT32 DefaultFontSize;
  207. static const UINT32 TitleFontSize;
  208. static const Color TextNormalColor;
  209. static const Color TextActiveColor;
  210. static const String GUISkinFile;
  211. static const String XButtonNormalTex;
  212. static const String FolderIconTex;
  213. static const String MeshIconTex;
  214. static const String TextureIconTex;
  215. static const String FontIconTex;
  216. static const String PlainTextIconTex;
  217. static const String ScriptCodeIconTex;
  218. static const String ShaderIconTex;
  219. static const String ShaderIncludeIconTex;
  220. static const String MaterialIconTex;
  221. static const String SpriteTextureIconTex;
  222. static const String PrefabIconTex;
  223. static const String GUISkinIconTex;
  224. static const String PhysicsMaterialIconTex;
  225. static const String PhysicsMeshIconTex;
  226. static const String AudioClipIconTex;
  227. static const String AnimationClipIconTex;
  228. static const String ShaderDockOverlayFile;
  229. static const String ShaderSceneGridFile;
  230. static const String ShaderPickingCullNoneFile;
  231. static const String ShaderPickingCullCWFile;
  232. static const String ShaderPickingCullCCWFile;
  233. static const String ShaderPickingAlphaCullNoneFile;
  234. static const String ShaderPickingAlphaCullCWFile;
  235. static const String ShaderPickingAlphaCullCCWFile;
  236. static const String ShaderLineGizmoFile;
  237. static const String ShaderSolidGizmoFile;
  238. static const String ShaderWireGizmoFile;
  239. static const String ShaderLineHandleFile;
  240. static const String ShaderSolidHandleFile;
  241. static const String ShaderHandleClearAlphaFile;
  242. static const String ShaderIconGizmoFile;
  243. static const String ShaderGizmoPickingFile;
  244. static const String ShaderGizmoPickingAlphaFile;
  245. static const String ShaderTextGizmoFile;
  246. static const String ShaderSelectionFile;
  247. static const String EmptyShaderCodeFile;
  248. static const String EmptyCSScriptCodeFile;
  249. static const char* SplashScreenName;
  250. };
  251. /** @} */
  252. }