BsBuiltinEditorResources.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  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. /** Various built-in sprite textures. */
  63. enum BS_SCRIPT_EXPORT(api:bed) class EditorSprites
  64. {
  65. Spinner
  66. };
  67. /** Contains a set of built-in resources used by the editor. */
  68. class BS_ED_EXPORT BS_SCRIPT_EXPORT(n:EditorBuiltin,m:Utility-Editor,api:bed)
  69. BuiltinEditorResources : public bs::Module<BuiltinEditorResources>
  70. {
  71. public:
  72. BuiltinEditorResources();
  73. /** Returns the default editor GUI skin. */
  74. BS_SCRIPT_EXPORT(pr:getter,n:GUISkin)
  75. BS_NORREF const HGUISkin& getSkin() const { return mSkin; }
  76. /** Returns the default font used by the editor. */
  77. BS_SCRIPT_EXPORT(pr:getter,n:DefaultFont)
  78. BS_NORREF const HFont& getDefaultFont() const { return mDefaultFont; }
  79. /** Returns the default antialiased font used by the editor. */
  80. BS_SCRIPT_EXPORT(pr:getter,n:DefaultAAFont)
  81. BS_NORREF const HFont& getDefaultAAFont() const { return mDefaultAAFont; }
  82. /** Creates a material used for docking drop overlay used by the editor. */
  83. HMaterial createDockDropOverlayMaterial() const;
  84. /** Creates a material used for rendering the scene grid. */
  85. HMaterial createSceneGridMaterial() const;
  86. /** Creates a material used for picking non-transparent objects in scene view. */
  87. HMaterial createPicking(CullingMode cullMode) const;
  88. /** Creates a material used for picking transparent objects in scene view. */
  89. HMaterial createPickingAlpha(CullingMode cullMode) const;
  90. /** Creates a material used for rendering line gizmos. */
  91. HMaterial createLineGizmoMat() const;
  92. /** Creates a material used for rendering solid gizmos. */
  93. HMaterial createSolidGizmoMat() const;
  94. /** Creates a material used for rendering wireframe gizmos. */
  95. HMaterial createWireGizmoMat() const;
  96. /** Creates a material used for rendering icon gizmos. */
  97. HMaterial createIconGizmoMat() const;
  98. /** Creates a material used for picking non-transparent gizmos. */
  99. HMaterial createGizmoPickingMat() const;
  100. /** Creates a material used for picking transparent gizmos. */
  101. HMaterial createAlphaGizmoPickingMat() const;
  102. /** Creates a material used for rendering line handles. */
  103. HMaterial createLineHandleMat() const;
  104. /** Creates a material used for rendering solid handles. */
  105. HMaterial createSolidHandleMat() const;
  106. /** Creates a material used for rendering text for gizmos and handles. */
  107. HMaterial createTextGizmoMat() const;
  108. /** Creates a material used for clearing the alpha channel of the handle rendering texture. */
  109. HMaterial createHandleClearAlphaMat() const;
  110. /** Creates a material used for displaying selected objects. */
  111. HMaterial createSelectionMat() const;
  112. /**
  113. * Retrieves an icon that represents a specific resource type that may be displayed when viewing the project
  114. * library.
  115. */
  116. BS_SCRIPT_EXPORT()
  117. BS_NORREF HSpriteTexture getProjectLibraryIcon(ProjectLibraryIcon icon, int size) const;
  118. /** Retrieves an icon that may be displayed on the main window's toolbar. */
  119. BS_SCRIPT_EXPORT()
  120. BS_NORREF HSpriteTexture getToolbarIcon(ToolbarIcon icon) const;
  121. /** Retrieves an icon that may be displayed on the scene window. */
  122. BS_SCRIPT_EXPORT()
  123. GUIContentImages getSceneWindowIcon(SceneWindowIcon icon) const;
  124. /** Retrieves an icon that may be displayed in the 3D scene view. */
  125. BS_SCRIPT_EXPORT()
  126. BS_NORREF HSpriteTexture getSceneViewIcon(SceneViewIcon icon) const;
  127. /** Retrieves an icon that may be displayed on the library window. */
  128. BS_SCRIPT_EXPORT()
  129. BS_NORREF HSpriteTexture getLibraryWindowIcon(LibraryWindowIcon icon) const;
  130. /** Retrieves an icon that may be displayed on the inspector window. */
  131. BS_SCRIPT_EXPORT()
  132. BS_NORREF HSpriteTexture getInspectorWindowIcon(InspectorWindowIcon icon) const;
  133. /** Retrieves an icon that may be displayed on the animation editor window. */
  134. BS_SCRIPT_EXPORT()
  135. GUIContentImages getAnimationWindowIcon(AnimationWindowIcon icon) const;
  136. /** Retrieves an icon that represents a specific generic editor icon. */
  137. BS_SCRIPT_EXPORT()
  138. BS_NORREF HSpriteTexture getEditorIcon(EditorIcon icon) const;
  139. /** Retrieves an icon that represents a specific log message type. */
  140. BS_SCRIPT_EXPORT()
  141. BS_NORREF HSpriteTexture getLogMessageIcon(LogMessageIcon icon, UINT32 size, bool dark) const;
  142. /** Retrieves a builtin editor sprite texture. */
  143. BS_SCRIPT_EXPORT()
  144. BS_NORREF HSpriteTexture getSprite(EditorSprites sprite);
  145. /** Returns text contained in the default "empty" shader. */
  146. BS_SCRIPT_EXPORT(pr:getter,n:EmptyShaderCode)
  147. String getEmptyShaderCode() const;
  148. /** Returns text contained in the default "empty" C# script. */
  149. BS_SCRIPT_EXPORT(pr:getter,n:EmptyCSScriptCode)
  150. String getEmptyCSScriptCode() const;
  151. /** Returns image data the Banshee Engine splash screen. */
  152. static SPtr<PixelData> getSplashScreen();
  153. /** Returns absolute path to the builtin shader include folder. */
  154. static Path getShaderIncludeFolder();
  155. /** Returns absolute path to the default widget layout file. */
  156. static Path getDefaultWidgetLayoutPath();
  157. static const String ObjectFieldStyleName;
  158. static const String ObjectFieldLabelStyleName;
  159. static const String ObjectFieldDropBtnStyleName;
  160. static const String ObjectFieldClearBtnStyleName;
  161. static const String TextureFieldStyleName;
  162. static const String TextureFieldLabelStyleName;
  163. static const String TextureFieldDropStyleName;
  164. static const String TextureFieldClearBtnStyleName;
  165. private:
  166. /** Loads a GUI icon with the specified filename. */
  167. HSpriteTexture getGUIIcon(const String& name) const;
  168. /** Loads a GUI icon with the specified filename. */
  169. HSpriteTexture getGUIIcon3D(const String& name) const;
  170. /** Loads an animated sprite with the specified filename. */
  171. HSpriteTexture getAnimatedSprite(const String& name) const;
  172. /** Loads a shader with the specified filename */
  173. HShader getShader(const String& name) const;
  174. HShader mShaderDockOverlay;
  175. HShader mShaderSceneGrid;
  176. HShader mShaderPicking[3];
  177. HShader mShaderPickingAlpha[3];
  178. HShader mShaderGizmoSolid;
  179. HShader mShaderGizmoWire;
  180. HShader mShaderGizmoLine;
  181. HShader mShaderGizmoIcon;
  182. HShader mShaderGizmoPicking;
  183. HShader mShaderGizmoAlphaPicking;
  184. HShader mShaderGizmoText;
  185. HShader mShaderHandleSolid;
  186. HShader mShaderHandleLine;
  187. HShader mShaderHandleClearAlpha;
  188. HShader mShaderSelection;
  189. HFont mDefaultFont;
  190. HFont mDefaultAAFont;
  191. HGUISkin mSkin;
  192. SPtr<ResourceManifest> mResourceManifest;
  193. static const char* ShaderFolder;
  194. static const char* SkinFolder;
  195. static const char* IconFolder;
  196. static const char* Icon3DFolder;
  197. static const char* AnimatedSpritesFolder;
  198. static const char* ShaderIncludeFolder;
  199. static const char* SpriteSubFolder;
  200. Path BuiltinDataFolder;
  201. Path EditorSkinFolder;
  202. Path EditorSkinSpritesFolder;
  203. Path EditorIconFolder;
  204. Path EditorIcon3DFolder;
  205. Path EditorIconSpritesFolder;
  206. Path EditorIcon3DSpritesFolder;
  207. Path EditorAnimatedSpritesFolder;
  208. Path EditorShaderFolder;
  209. Path EditorShaderIncludeFolder;
  210. Path BuiltinRawDataFolder;
  211. Path EditorRawSkinFolder;
  212. Path EditorRawIconsFolder;
  213. Path EditorRawShaderIncludeFolder;
  214. Path EditorRawShaderFolder;
  215. Path ResourceManifestPath;
  216. static const String DefaultFontFilename;
  217. static const String DefaultAAFontFilename;
  218. static const UINT32 DefaultFontSize;
  219. static const UINT32 TitleFontSize;
  220. static const Color TextNormalColor;
  221. static const Color TextActiveColor;
  222. static const String GUISkinFile;
  223. static const String XButtonNormalTex;
  224. static const String FolderIconTex;
  225. static const String MeshIconTex;
  226. static const String TextureIconTex;
  227. static const String FontIconTex;
  228. static const String PlainTextIconTex;
  229. static const String ScriptCodeIconTex;
  230. static const String ShaderIconTex;
  231. static const String ShaderIncludeIconTex;
  232. static const String MaterialIconTex;
  233. static const String SpriteTextureIconTex;
  234. static const String PrefabIconTex;
  235. static const String GUISkinIconTex;
  236. static const String PhysicsMaterialIconTex;
  237. static const String PhysicsMeshIconTex;
  238. static const String AudioClipIconTex;
  239. static const String AnimationClipIconTex;
  240. static const String ShaderDockOverlayFile;
  241. static const String ShaderSceneGridFile;
  242. static const String ShaderPickingCullNoneFile;
  243. static const String ShaderPickingCullCWFile;
  244. static const String ShaderPickingCullCCWFile;
  245. static const String ShaderPickingAlphaCullNoneFile;
  246. static const String ShaderPickingAlphaCullCWFile;
  247. static const String ShaderPickingAlphaCullCCWFile;
  248. static const String ShaderLineGizmoFile;
  249. static const String ShaderSolidGizmoFile;
  250. static const String ShaderWireGizmoFile;
  251. static const String ShaderLineHandleFile;
  252. static const String ShaderSolidHandleFile;
  253. static const String ShaderHandleClearAlphaFile;
  254. static const String ShaderIconGizmoFile;
  255. static const String ShaderGizmoPickingFile;
  256. static const String ShaderGizmoPickingAlphaFile;
  257. static const String ShaderTextGizmoFile;
  258. static const String ShaderSelectionFile;
  259. static const String EmptyShaderCodeFile;
  260. static const String EmptyCSScriptCodeFile;
  261. static const char* SplashScreenName;
  262. };
  263. /** @} */
  264. }