BsBuiltinEditorResources.h 12 KB

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