BsBuiltinEditorResources.cpp 60 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377
  1. #include "BsBuiltinEditorResources.h"
  2. #include "BsBuiltinResources.h"
  3. #include "BsGUIElementStyle.h"
  4. #include "BsGUILabel.h"
  5. #include "BsGUITexture.h"
  6. #include "BsGUIButton.h"
  7. #include "BsGUIInputBox.h"
  8. #include "BsGUIToggle.h"
  9. #include "BsGUIColor.h"
  10. #include "BsTextSprite.h"
  11. #include "BsSpriteTexture.h"
  12. #include "BsGUITreeViewEditBox.h"
  13. #include "BsGUIIntField.h"
  14. #include "BsGUIFloatField.h"
  15. #include "BsGUIColorField.h"
  16. #include "BsGUITextField.h"
  17. #include "BsGUIToggleField.h"
  18. #include "BsGUIVector2Field.h"
  19. #include "BsGUIVector3Field.h"
  20. #include "BsGUIVector4Field.h"
  21. #include "BsGUIComponentFoldout.h"
  22. #include "BsGUIFoldout.h"
  23. #include "BsGUIProgressBar.h"
  24. #include "BsGUISlider.h"
  25. #include "BsGUIDropDownContent.h"
  26. #include "BsFont.h"
  27. #include "BsFontImportOptions.h"
  28. #include "BsImporter.h"
  29. #include "BsGpuProgram.h"
  30. #include "BsShader.h"
  31. #include "BsShaderInclude.h"
  32. #include "BsTechnique.h"
  33. #include "BsPass.h"
  34. #include "BsMaterial.h"
  35. #include "BsBlendState.h"
  36. #include "BsDepthStencilState.h"
  37. #include "BsRasterizerState.h"
  38. #include "BsResources.h"
  39. #include "BsRTTIType.h"
  40. #include "BsFileSystem.h"
  41. #include "BsResourceManifest.h"
  42. namespace BansheeEngine
  43. {
  44. const String BuiltinEditorResources::ObjectFieldStyleName = "GUIObjectField";
  45. const String BuiltinEditorResources::ObjectFieldLabelStyleName = "EditorFieldLabel";
  46. const String BuiltinEditorResources::ObjectFieldDropBtnStyleName = "DropButton";
  47. const String BuiltinEditorResources::ObjectFieldClearBtnStyleName = "ObjectClearButton";
  48. const WString BuiltinEditorResources::DefaultFontFilename = L"arial.ttf";
  49. const UINT32 BuiltinEditorResources::DefaultFontSize = 10;
  50. const WString BuiltinEditorResources::GUISkinFile = L"GUISkin";
  51. const Path BuiltinEditorResources::ShaderFolder = L"Shaders\\";
  52. const Path BuiltinEditorResources::SkinFolder = L"Skin\\";
  53. const Path BuiltinEditorResources::IconFolder = L"Skin\\Icons";
  54. const Path BuiltinEditorResources::ShaderIncludeFolder = L"Includes\\";
  55. const Path BuiltinEditorResources::BuiltinRawDataFolder = L"..\\..\\..\\..\\Data\\Raw\\Editor\\";
  56. const Path BuiltinEditorResources::EditorRawSkinFolder = BuiltinRawDataFolder + SkinFolder;
  57. const Path BuiltinEditorResources::EditorRawShaderFolder = BuiltinRawDataFolder + ShaderFolder;
  58. const Path BuiltinEditorResources::EditorRawShaderIncludeFolder = BuiltinRawDataFolder + ShaderIncludeFolder;
  59. const Path BuiltinEditorResources::BuiltinDataFolder = L"..\\..\\..\\..\\Data\\Editor\\";
  60. const Path BuiltinEditorResources::EditorSkinFolder = BuiltinDataFolder + SkinFolder;
  61. const Path BuiltinEditorResources::EditorIconFolder = BuiltinDataFolder + IconFolder;
  62. const Path BuiltinEditorResources::EditorShaderFolder = BuiltinDataFolder + ShaderFolder;
  63. const Path BuiltinEditorResources::EditorShaderIncludeFolder = BuiltinDataFolder + ShaderIncludeFolder;
  64. const Path BuiltinEditorResources::ResourceManifestPath = BuiltinDataFolder + "ResourceManifest.asset";
  65. const WString BuiltinEditorResources::FolderIconTex = L"FolderIcon.psd";
  66. const WString BuiltinEditorResources::MeshIconTex = L"MeshIcon.psd";
  67. const WString BuiltinEditorResources::TextureIconTex = L"TextureIcon.psd";
  68. const WString BuiltinEditorResources::FontIconTex = L"FontIcon.psd";
  69. const WString BuiltinEditorResources::PlainTextIconTex = L"TextIcon.psd";
  70. const WString BuiltinEditorResources::ScriptCodeIconTex = L"CSharpIcon.psd";
  71. const WString BuiltinEditorResources::ShaderIconTex = L"ShaderIcon.psd";
  72. const WString BuiltinEditorResources::ShaderIncludeIconTex = L"ShaderIncludeIcon.psd";
  73. const WString BuiltinEditorResources::MaterialIconTex = L"MaterialIcon.psd";
  74. const WString BuiltinEditorResources::SpriteTextureIconTex = L"SpriteIcon.psd";
  75. const WString BuiltinEditorResources::WindowBackgroundTexture = L"WindowBgTile.psd";
  76. const WString BuiltinEditorResources::ButtonNormalTex = L"ButtonNormal.psd";
  77. const WString BuiltinEditorResources::ButtonHoverTex = L"ButtonHover.psd";
  78. const WString BuiltinEditorResources::ButtonActiveTex = L"ButtonActive.psd";
  79. const WString BuiltinEditorResources::ToggleNormalTex = L"ToggleNormal.psd";
  80. const WString BuiltinEditorResources::ToggleHoverTex = L"ToggleHover.psd";
  81. const WString BuiltinEditorResources::ToggleActiveTex = L"ToggleActive.psd";
  82. const WString BuiltinEditorResources::ToggleNormalOnTex = L"ToggleOnNormal.psd";
  83. const WString BuiltinEditorResources::ToggleHoverOnTex = L"ToggleOnHover.psd";
  84. const WString BuiltinEditorResources::ToggleActiveOnTex = L"ToggleOnActive.psd";
  85. const WString BuiltinEditorResources::ObjectDropBtnNormalTex = L"ObjectFieldDropNormal.psd";
  86. const WString BuiltinEditorResources::ObjectDropBtnNormalOnTex = L"ObjectFieldDropOnNormal.psd";
  87. const WString BuiltinEditorResources::ObjectClearBtnNormalTex = L"ObjectFieldBtnNormal.psd";
  88. const WString BuiltinEditorResources::ObjectClearBtnHoverTex = L"ObjectFieldBtnHover.psd";
  89. const WString BuiltinEditorResources::ObjectClearBtnActiveTex = L"ObjectFieldBtnActive.psd";
  90. const WString BuiltinEditorResources::FoldoutOpenNormalTex = L"FoldoutOpenNormal.psd";
  91. const WString BuiltinEditorResources::FoldoutOpenHoverTex = L"FoldoutOpenHover.psd";
  92. const WString BuiltinEditorResources::FoldoutClosedNormalTex = L"FoldoutClosedNormal.psd";
  93. const WString BuiltinEditorResources::FoldoutClosedHoverTex = L"FoldoutClosedHover.psd";
  94. const WString BuiltinEditorResources::CmpFoldoutOpenNormalTex = L"CmpFoldoutOpenNormal.psd";
  95. const WString BuiltinEditorResources::CmpFoldoutOpenHoverTex = L"CmpFoldoutOpenHover.psd";
  96. const WString BuiltinEditorResources::CmpFoldoutOpenActiveTex = L"CmpFoldoutOpenActive.psd";
  97. const WString BuiltinEditorResources::CmpFoldoutClosedNormalTex = L"CmpFoldoutClosedNormal.psd";
  98. const WString BuiltinEditorResources::CmpFoldoutClosedHoverTex = L"CmpFoldoutClosedHover.psd";
  99. const WString BuiltinEditorResources::CmpFoldoutClosedActiveTex = L"CmpFoldoutClosedActive.psd";
  100. const WString BuiltinEditorResources::WindowFrameNormal = L"WindowFrameNormal.psd";
  101. const WString BuiltinEditorResources::WindowFrameFocused = L"WindowFrameFocused.psd";
  102. const WString BuiltinEditorResources::WindowTitleBarBg = L"WindowTitleBarBg.psd";
  103. const WString BuiltinEditorResources::WindowCloseButtonNormal = L"WindowCloseBtnNormal.psd";
  104. const WString BuiltinEditorResources::WindowCloseButtonHover = L"WindowCloseBtnHover.psd";
  105. const WString BuiltinEditorResources::WindowMinButtonNormal = L"WindowMinBtnNormal.psd";
  106. const WString BuiltinEditorResources::WindowMinButtonHover = L"WindowMinBtnHover.psd";
  107. const WString BuiltinEditorResources::WindowMaxButtonNormal = L"WindowMaxBtnNormal.psd";
  108. const WString BuiltinEditorResources::WindowMaxButtonHover = L"WindowMaxBtnHover.psd";
  109. const WString BuiltinEditorResources::TabbedBarBtnNormal = L"TabbedButtonNormal.psd";
  110. const WString BuiltinEditorResources::TabbedBarBtnActive = L"TabbedButtonActive.psd";
  111. const WString BuiltinEditorResources::InputBoxNormalTex = L"InputBoxNormal.psd";
  112. const WString BuiltinEditorResources::InputBoxHoverTex = L"InputBoxHover.psd";
  113. const WString BuiltinEditorResources::InputBoxFocusedTex = L"InputBoxFocused.psd";
  114. const WString BuiltinEditorResources::ScrollBarUpNormalTex = L"ScrollBarUpNormal.psd";
  115. const WString BuiltinEditorResources::ScrollBarUpHoverTex = L"ScrollBarUpHover.psd";
  116. const WString BuiltinEditorResources::ScrollBarUpActiveTex = L"ScrollBarUpActive.psd";
  117. const WString BuiltinEditorResources::ScrollBarDownNormalTex = L"ScrollBarDownNormal.psd";
  118. const WString BuiltinEditorResources::ScrollBarDownHoverTex = L"ScrollBarDownHover.psd";
  119. const WString BuiltinEditorResources::ScrollBarDownActiveTex = L"ScrollBarDownActive.psd";
  120. const WString BuiltinEditorResources::ScrollBarLeftNormalTex = L"ScrollBarLeftNormal.psd";
  121. const WString BuiltinEditorResources::ScrollBarLeftHoverTex = L"ScrollBarLeftHover.psd";
  122. const WString BuiltinEditorResources::ScrollBarLeftActiveTex = L"ScrollBarLeftActive.psd";
  123. const WString BuiltinEditorResources::ScrollBarRightNormalTex = L"ScrollBarRightNormal.psd";
  124. const WString BuiltinEditorResources::ScrollBarRightHoverTex = L"ScrollBarRightHover.psd";
  125. const WString BuiltinEditorResources::ScrollBarRightActiveTex = L"ScrollBarRightActive.psd";
  126. const WString BuiltinEditorResources::ScrollBarHandleHorzNormalTex = L"ScrollBarHorzHandleNormal.psd";
  127. const WString BuiltinEditorResources::ScrollBarHandleHorzHoverTex = L"ScrollBarHorzHandleHover.psd";
  128. const WString BuiltinEditorResources::ScrollBarHandleHorzActiveTex = L"ScrollBarHorzHandleActive.psd";
  129. const WString BuiltinEditorResources::ScrollBarHandleVertNormalTex = L"ScrollBarVertHandleNormal.psd";
  130. const WString BuiltinEditorResources::ScrollBarHandleVertHoverTex = L"ScrollBarVertHandleHover.psd";
  131. const WString BuiltinEditorResources::ScrollBarHandleVertActiveTex = L"ScrollBarVertHandleActive.psd";
  132. const WString BuiltinEditorResources::DropDownBtnNormalTex = L"DropDownNormal.psd";
  133. const WString BuiltinEditorResources::DropDownBtnHoverTex = L"DropDownHover.psd";
  134. const WString BuiltinEditorResources::DropDownBoxBgTex = L"DropDownBoxBg.psd";
  135. const WString BuiltinEditorResources::DropDownBoxEntryNormalTex = L"DropDownButtonNormal.psd";
  136. const WString BuiltinEditorResources::DropDownBoxEntryHoverTex = L"DropDownButtonHover.psd";
  137. const WString BuiltinEditorResources::DropDownBoxBtnUpNormalTex = L"DropDownBoxBtnUpNormal.psd";
  138. const WString BuiltinEditorResources::DropDownBoxBtnUpHoverTex = L"DropDownBoxBtnUpHover.psd";
  139. const WString BuiltinEditorResources::DropDownBoxBtnDownNormalTex = L"DropDownBoxBtnDownNormal.psd";
  140. const WString BuiltinEditorResources::DropDownBoxBtnDownHoverTex = L"DropDownBoxBtnDownHover.psd";
  141. const WString BuiltinEditorResources::DropDownBoxEntryExpNormalTex = L"DropDownExpNormal.psd";
  142. const WString BuiltinEditorResources::DropDownBoxEntryExpHoverTex = L"DropDownExpHover.psd";
  143. const WString BuiltinEditorResources::DropDownSeparatorTex = L"DropDownSeparator.psd";
  144. const WString BuiltinEditorResources::DropDownBoxBtnUpArrowTex = L"DropDownBoxBtnUpArrow.psd";
  145. const WString BuiltinEditorResources::DropDownBoxBtnDownArrowTex = L"DropDownBoxBtnDownArrow.psd";
  146. const WString BuiltinEditorResources::ScrollBarBgTex = L"ScrollBarBg.psd";
  147. const WString BuiltinEditorResources::MenuBarBgTex = L"MenuBarBg.psd";
  148. const WString BuiltinEditorResources::MenuBarBtnNormalTex = L"MenuBarButtonNormal.psd";
  149. const WString BuiltinEditorResources::MenuBarBtnHoverTex = L"MenuBarButtonHover.psd";
  150. const WString BuiltinEditorResources::MenuBarBansheeLogoTex = L"MenuBarBansheeLogo.psd";
  151. const WString BuiltinEditorResources::DockSliderNormalTex = L"DockSliderBtn.psd";
  152. const WString BuiltinEditorResources::TreeViewExpandButtonOffNormal = L"TreeViewExpandButtonOffNormal.psd";
  153. const WString BuiltinEditorResources::TreeViewExpandButtonOffHover = L"TreeViewExpandButtonOffHover.psd";
  154. const WString BuiltinEditorResources::TreeViewExpandButtonOnNormal = L"TreeViewExpandButtonOnNormal.psd";
  155. const WString BuiltinEditorResources::TreeViewExpandButtonOnHover = L"TreeViewExpandButtonOnHover.psd";
  156. const WString BuiltinEditorResources::TreeViewSelectionBackground = L"TreeViewSelectionBackground.psd";
  157. const WString BuiltinEditorResources::TreeViewEditBox = L"TreeViewEditBox.psd";
  158. const WString BuiltinEditorResources::TreeViewElementHighlight = L"TreeViewElementHighlight.psd";
  159. const WString BuiltinEditorResources::TreeViewElementSepHighlight = L"TreeViewElementSepHighlight.psd";
  160. const WString BuiltinEditorResources::ColorPickerSliderHorzHandleTex = L"ColorPickerSliderHorzHandle.psd";
  161. const WString BuiltinEditorResources::ColorPickerSliderVertHandleTex = L"ColorPickerSliderVertHandle.psd";
  162. const WString BuiltinEditorResources::ColorPickerSlider2DHandleTex = L"ColorPicker2DHandle.psd";
  163. const WString BuiltinEditorResources::ProgressBarFillTex = L"ProgressBarFill.psd";
  164. const WString BuiltinEditorResources::ProgressBarBgTex = L"ProgressBarBg.psd";
  165. const WString BuiltinEditorResources::SelectionAreaTex = L"SelectionHighlight.psd";
  166. /************************************************************************/
  167. /* SHADERS */
  168. /************************************************************************/
  169. const WString BuiltinEditorResources::ShaderDockOverlayFile = L"DockDropOverlay.bsl";
  170. const WString BuiltinEditorResources::ShaderSceneGridFile = L"SceneGrid.bsl";
  171. const WString BuiltinEditorResources::ShaderPickingCullNoneFile = L"PickingCullNone.bsl";
  172. const WString BuiltinEditorResources::ShaderPickingCullCWFile = L"PickingCullCW.bsl";
  173. const WString BuiltinEditorResources::ShaderPickingCullCCWFile = L"PickingCullCCW.bsl";
  174. const WString BuiltinEditorResources::ShaderPickingAlphaCullNoneFile = L"PickingAlphaCullNone.bsl";
  175. const WString BuiltinEditorResources::ShaderPickingAlphaCullCWFile = L"PickingAlphaCullCW.bsl";
  176. const WString BuiltinEditorResources::ShaderPickingAlphaCullCCWFile = L"PickingAlphaCullCCW.bsl";
  177. const WString BuiltinEditorResources::ShaderWireGizmoFile = L"WireGizmo.bsl";
  178. const WString BuiltinEditorResources::ShaderSolidGizmoFile = L"SolidGizmo.bsl";
  179. const WString BuiltinEditorResources::ShaderWireHandleFile = L"WireHandle.bsl";
  180. const WString BuiltinEditorResources::ShaderSolidHandleFile = L"SolidHandle.bsl";
  181. const WString BuiltinEditorResources::ShaderIconGizmoFile = L"IconGizmo.bsl";
  182. const WString BuiltinEditorResources::ShaderGizmoPickingFile = L"GizmoPicking.bsl";
  183. const WString BuiltinEditorResources::ShaderGizmoPickingAlphaFile = L"GizmoPickingAlpha.bsl";
  184. const WString BuiltinEditorResources::ShaderSelectionFile = L"Selection.bsl";
  185. BuiltinEditorResources::BuiltinEditorResources()
  186. {
  187. Path absoluteDataPath = FileSystem::getWorkingDirectoryPath();
  188. absoluteDataPath.append(BuiltinDataFolder);
  189. #if BS_DEBUG_MODE
  190. if (BuiltinResourcesHelper::checkForModifications(BuiltinRawDataFolder, BuiltinDataFolder + L"Timestamp.asset"))
  191. {
  192. mResourceManifest = ResourceManifest::create("BuiltinResources");
  193. gResources().registerResourceManifest(mResourceManifest);
  194. preprocess();
  195. BuiltinResourcesHelper::writeTimestamp(BuiltinDataFolder + L"Timestamp.asset");
  196. Path absoluteDataPath = FileSystem::getWorkingDirectoryPath();
  197. absoluteDataPath.append(BuiltinDataFolder);
  198. ResourceManifest::save(mResourceManifest, ResourceManifestPath, absoluteDataPath);
  199. }
  200. #endif
  201. if (mResourceManifest == nullptr)
  202. {
  203. if (FileSystem::exists(ResourceManifestPath))
  204. mResourceManifest = ResourceManifest::load(ResourceManifestPath, absoluteDataPath);
  205. if (mResourceManifest == nullptr)
  206. mResourceManifest = ResourceManifest::create("BuiltinResources");
  207. gResources().registerResourceManifest(mResourceManifest);
  208. }
  209. mShaderDockOverlay = getShader(ShaderDockOverlayFile);
  210. mShaderSceneGrid = getShader(ShaderSceneGridFile);
  211. mShaderPicking[(int)CULL_NONE] = getShader(ShaderPickingCullNoneFile);
  212. mShaderPicking[(int)CULL_CLOCKWISE] = getShader(ShaderPickingCullCWFile);
  213. mShaderPicking[(int)CULL_COUNTERCLOCKWISE] = getShader(ShaderPickingCullCCWFile);
  214. mShaderPickingAlpha[(int)CULL_NONE] = getShader(ShaderPickingAlphaCullNoneFile);
  215. mShaderPickingAlpha[(int)CULL_CLOCKWISE] = getShader(ShaderPickingAlphaCullCWFile);
  216. mShaderPickingAlpha[(int)CULL_COUNTERCLOCKWISE] = getShader(ShaderPickingAlphaCullCCWFile);
  217. mShaderGizmoSolid = getShader(ShaderSolidGizmoFile);
  218. mShaderGizmoWire = getShader(ShaderWireGizmoFile);
  219. mShaderGizmoIcon = getShader(ShaderIconGizmoFile);
  220. mShaderGizmoPicking = getShader(ShaderGizmoPickingFile);
  221. mShaderGizmoAlphaPicking = getShader(ShaderGizmoPickingAlphaFile);
  222. mShaderHandleSolid = getShader(ShaderSolidHandleFile);
  223. mShaderHandleWire = getShader(ShaderWireHandleFile);
  224. mShaderSelection = getShader(ShaderSelectionFile);
  225. mSkin = gResources().load<GUISkin>(BuiltinDataFolder + (GUISkinFile + L".asset"));
  226. }
  227. BuiltinEditorResources::~BuiltinEditorResources()
  228. { }
  229. void BuiltinEditorResources::preprocess()
  230. {
  231. FileSystem::remove(EditorShaderIncludeFolder);
  232. FileSystem::remove(EditorShaderFolder);
  233. FileSystem::remove(EditorSkinFolder);
  234. BuiltinResourcesHelper::importAssets(EditorRawShaderIncludeFolder, EditorShaderIncludeFolder, mResourceManifest); // Hidden dependency: Includes must be imported before shaders
  235. BuiltinResourcesHelper::importAssets(EditorRawShaderFolder, EditorShaderFolder, mResourceManifest);
  236. BuiltinResourcesHelper::importAssets(EditorRawSkinFolder, EditorSkinFolder, mResourceManifest);
  237. // Import font
  238. BuiltinResourcesHelper::importFont(BuiltinRawDataFolder + DefaultFontFilename, BuiltinDataFolder, DefaultFontSize, false, mResourceManifest);
  239. // Generate & save GUI sprite textures
  240. BuiltinResourcesHelper::generateSpriteTextures(EditorSkinFolder, mResourceManifest);
  241. // Generate & save GUI skin
  242. {
  243. HGUISkin skin = generateGUISkin();
  244. Path outputPath = FileSystem::getWorkingDirectoryPath() + BuiltinDataFolder + (GUISkinFile + L".asset");
  245. Resources::instance().save(skin, outputPath, true);
  246. mResourceManifest->registerResource(skin.getUUID(), outputPath);
  247. }
  248. Resources::instance().unloadAllUnused();
  249. }
  250. HGUISkin BuiltinEditorResources::generateGUISkin()
  251. {
  252. HGUISkin skin = GUISkin::create();
  253. Path fontPath = FileSystem::getWorkingDirectoryPath();
  254. fontPath.append(BuiltinDataFolder);
  255. fontPath.append(DefaultFontFilename + L".asset");
  256. HFont font = Resources::instance().load<Font>(fontPath);
  257. // Blank entry
  258. GUIElementStyle blankStyle;
  259. skin->setStyle("Blank", blankStyle);
  260. skin->setStyle(GUITexture::getGUITypeName(), blankStyle);
  261. // Label
  262. GUIElementStyle labelStyle;
  263. labelStyle.font = font;
  264. labelStyle.fontSize = DefaultFontSize;
  265. labelStyle.fixedWidth = false;
  266. labelStyle.fixedHeight = true;
  267. labelStyle.height = 11;
  268. labelStyle.minWidth = 10;
  269. skin->setStyle(GUILabel::getGUITypeName(), labelStyle);
  270. // Multi-line label
  271. GUIElementStyle multiLinelabelStyle;
  272. multiLinelabelStyle.font = font;
  273. multiLinelabelStyle.fontSize = DefaultFontSize;
  274. multiLinelabelStyle.fixedWidth = false;
  275. multiLinelabelStyle.fixedHeight = true;
  276. multiLinelabelStyle.height = 11;
  277. multiLinelabelStyle.minWidth = 10;
  278. multiLinelabelStyle.wordWrap = true;
  279. skin->setStyle("MultiLineLabel", multiLinelabelStyle);
  280. // Window frame
  281. GUIElementStyle windowFrameStyle;
  282. windowFrameStyle.normal.texture = getGUITexture(WindowFrameNormal);
  283. windowFrameStyle.focused.texture = getGUITexture(WindowFrameFocused);
  284. windowFrameStyle.border.left = 1;
  285. windowFrameStyle.border.right = 1;
  286. windowFrameStyle.border.top = 1;
  287. windowFrameStyle.border.bottom = 1;
  288. skin->setStyle("WindowFrame", windowFrameStyle);
  289. // Button
  290. GUIElementStyle buttonStyle;
  291. buttonStyle.normal.texture = getGUITexture(ButtonNormalTex);
  292. buttonStyle.hover.texture = getGUITexture(ButtonHoverTex);
  293. buttonStyle.active.texture = getGUITexture(ButtonActiveTex);
  294. buttonStyle.normalOn.texture = getGUITexture(ButtonActiveTex);
  295. buttonStyle.hoverOn.texture = getGUITexture(ButtonActiveTex);
  296. buttonStyle.activeOn.texture = getGUITexture(ButtonActiveTex);
  297. buttonStyle.border.left = 6;
  298. buttonStyle.border.right = 6;
  299. buttonStyle.border.top = 6;
  300. buttonStyle.border.bottom = 6;
  301. buttonStyle.contentOffset.left = 3;
  302. buttonStyle.contentOffset.right = 3;
  303. buttonStyle.fixedHeight = true;
  304. buttonStyle.height = 15;
  305. buttonStyle.minWidth = 50;
  306. buttonStyle.font = font;
  307. buttonStyle.fontSize = DefaultFontSize;
  308. buttonStyle.textHorzAlign = THA_Center;
  309. buttonStyle.textVertAlign = TVA_Center;
  310. skin->setStyle(GUIButton::getGUITypeName(), buttonStyle);
  311. // Toggle
  312. GUIElementStyle toggleStyle;
  313. toggleStyle.normal.texture = getGUITexture(ToggleNormalTex);
  314. toggleStyle.hover.texture = getGUITexture(ToggleHoverTex);
  315. toggleStyle.active.texture = getGUITexture(ToggleActiveTex);
  316. toggleStyle.normalOn.texture = getGUITexture(ToggleNormalOnTex);
  317. toggleStyle.hoverOn.texture = getGUITexture(ToggleHoverOnTex);
  318. toggleStyle.activeOn.texture = getGUITexture(ToggleActiveOnTex);
  319. toggleStyle.fixedHeight = true;
  320. toggleStyle.fixedWidth = true;
  321. toggleStyle.height = 15;
  322. toggleStyle.width = 15;
  323. skin->setStyle(GUIToggle::getGUITypeName(), toggleStyle);
  324. // Color
  325. GUIElementStyle colorStyle;
  326. colorStyle.margins.left = 2;
  327. colorStyle.margins.right = 2;
  328. colorStyle.margins.top = 2;
  329. colorStyle.margins.bottom = 2;
  330. colorStyle.fixedHeight = true;
  331. colorStyle.height = 10;
  332. colorStyle.minWidth = 10;
  333. skin->setStyle(GUIColor::getGUITypeName(), colorStyle);
  334. // Window background texture
  335. GUIElementStyle windowBgStyle;
  336. windowBgStyle.normal.texture = getGUITexture(WindowBackgroundTexture);
  337. skin->setStyle("WindowBackground", windowBgStyle);
  338. // Window title bar background
  339. GUIElementStyle titleBarBgStyle;
  340. titleBarBgStyle.normal.texture = getGUITexture(WindowTitleBarBg);
  341. titleBarBgStyle.fixedHeight = true;
  342. titleBarBgStyle.height = 13;
  343. skin->setStyle("TitleBarBackground", titleBarBgStyle);
  344. // Tabbed title bar tab button
  345. GUIElementStyle tabbedBarButton;
  346. tabbedBarButton.normal.texture = getGUITexture(TabbedBarBtnNormal);
  347. tabbedBarButton.hover.texture = getGUITexture(TabbedBarBtnActive);
  348. tabbedBarButton.active.texture = tabbedBarButton.hover.texture;
  349. tabbedBarButton.normalOn.texture = tabbedBarButton.hover.texture;
  350. tabbedBarButton.hoverOn.texture = tabbedBarButton.hover.texture;
  351. tabbedBarButton.activeOn.texture = tabbedBarButton.hover.texture;
  352. tabbedBarButton.fixedHeight = true;
  353. tabbedBarButton.height = 13;
  354. tabbedBarButton.minWidth = 10;
  355. tabbedBarButton.maxWidth = 110;
  356. tabbedBarButton.font = font;
  357. tabbedBarButton.fontSize = DefaultFontSize;
  358. tabbedBarButton.textHorzAlign = THA_Center;
  359. tabbedBarButton.textVertAlign = TVA_Center;
  360. skin->setStyle("TabbedBarBtn", tabbedBarButton);
  361. // Tabbed title bar drag/drop button
  362. GUIElementStyle tabbedBarDropButton;
  363. tabbedBarDropButton.fixedHeight = true;
  364. tabbedBarDropButton.fixedWidth = true;
  365. tabbedBarDropButton.height = 13;
  366. tabbedBarDropButton.width = 6;
  367. skin->setStyle("TabbedBarDropArea", tabbedBarDropButton);
  368. // Window minimize button
  369. GUIElementStyle winMinButtonStyle;
  370. winMinButtonStyle.normal.texture = getGUITexture(WindowMinButtonNormal);
  371. winMinButtonStyle.hover.texture = getGUITexture(WindowMinButtonHover);
  372. winMinButtonStyle.active.texture = winMinButtonStyle.hover.texture;
  373. winMinButtonStyle.fixedHeight = true;
  374. winMinButtonStyle.fixedWidth = true;
  375. winMinButtonStyle.height = 7;
  376. winMinButtonStyle.width = 8;
  377. skin->setStyle("WinMinimizeBtn", winMinButtonStyle);
  378. // Window maximize button
  379. GUIElementStyle winMaxButtonStyle;
  380. winMaxButtonStyle.normal.texture = getGUITexture(WindowMaxButtonNormal);
  381. winMaxButtonStyle.hover.texture = getGUITexture(WindowMaxButtonHover);
  382. winMaxButtonStyle.active.texture = winMaxButtonStyle.hover.texture;
  383. winMaxButtonStyle.fixedHeight = true;
  384. winMaxButtonStyle.fixedWidth = true;
  385. winMaxButtonStyle.height = 8;
  386. winMaxButtonStyle.width = 8;
  387. skin->setStyle("WinMaximizeBtn", winMaxButtonStyle);
  388. // Window close button
  389. GUIElementStyle winCloseButtonStyle;
  390. winCloseButtonStyle.normal.texture = getGUITexture(WindowCloseButtonNormal);
  391. winCloseButtonStyle.hover.texture = getGUITexture(WindowCloseButtonHover);
  392. winCloseButtonStyle.active.texture = winCloseButtonStyle.hover.texture;
  393. winCloseButtonStyle.fixedHeight = true;
  394. winCloseButtonStyle.fixedWidth = true;
  395. winCloseButtonStyle.height = 7;
  396. winCloseButtonStyle.width = 8;
  397. skin->setStyle("WinCloseBtn", winCloseButtonStyle);
  398. // Input box
  399. GUIElementStyle inputBoxStyle;
  400. inputBoxStyle.normal.texture = getGUITexture(InputBoxNormalTex);
  401. inputBoxStyle.hover.texture = getGUITexture(InputBoxHoverTex);
  402. inputBoxStyle.focused.texture = getGUITexture(InputBoxFocusedTex);
  403. inputBoxStyle.active.texture = inputBoxStyle.normal.texture;
  404. inputBoxStyle.border.left = 1;
  405. inputBoxStyle.border.right = 1;
  406. inputBoxStyle.border.top = 1;
  407. inputBoxStyle.border.bottom = 1;
  408. inputBoxStyle.contentOffset.left = 3;
  409. inputBoxStyle.contentOffset.right = 3;
  410. inputBoxStyle.contentOffset.top = 2;
  411. inputBoxStyle.contentOffset.bottom = 2;
  412. inputBoxStyle.fixedHeight = true;
  413. inputBoxStyle.height = 15;
  414. inputBoxStyle.minWidth = 10;
  415. inputBoxStyle.font = font;
  416. inputBoxStyle.fontSize = DefaultFontSize;
  417. inputBoxStyle.textHorzAlign = THA_Left;
  418. inputBoxStyle.textVertAlign = TVA_Top;
  419. skin->setStyle(GUIInputBox::getGUITypeName(), inputBoxStyle);
  420. /************************************************************************/
  421. /* SCROLL BAR */
  422. /************************************************************************/
  423. // Up button
  424. GUIElementStyle scrollUpBtnStyle;
  425. scrollUpBtnStyle.normal.texture = getGUITexture(ScrollBarUpNormalTex);
  426. scrollUpBtnStyle.hover.texture = getGUITexture(ScrollBarUpHoverTex);
  427. scrollUpBtnStyle.active.texture = getGUITexture(ScrollBarUpActiveTex);
  428. scrollUpBtnStyle.fixedHeight = true;
  429. scrollUpBtnStyle.fixedWidth = true;
  430. scrollUpBtnStyle.height = 4;
  431. scrollUpBtnStyle.width = 8;
  432. skin->setStyle("ScrollUpBtn", scrollUpBtnStyle);
  433. // Down button
  434. GUIElementStyle scrollDownBtnStyle;
  435. scrollDownBtnStyle.normal.texture = getGUITexture(ScrollBarDownNormalTex);
  436. scrollDownBtnStyle.hover.texture = getGUITexture(ScrollBarDownHoverTex);
  437. scrollDownBtnStyle.active.texture = getGUITexture(ScrollBarDownActiveTex);
  438. scrollDownBtnStyle.fixedHeight = true;
  439. scrollDownBtnStyle.fixedWidth = true;
  440. scrollDownBtnStyle.height = 4;
  441. scrollDownBtnStyle.width = 8;
  442. skin->setStyle("ScrollDownBtn", scrollDownBtnStyle);
  443. // Left button
  444. GUIElementStyle scrollLeftBtnStyle;
  445. scrollLeftBtnStyle.normal.texture = getGUITexture(ScrollBarLeftNormalTex);
  446. scrollLeftBtnStyle.hover.texture = getGUITexture(ScrollBarLeftHoverTex);
  447. scrollLeftBtnStyle.active.texture = getGUITexture(ScrollBarLeftActiveTex);
  448. scrollLeftBtnStyle.fixedHeight = true;
  449. scrollLeftBtnStyle.fixedWidth = true;
  450. scrollLeftBtnStyle.height = 8;
  451. scrollLeftBtnStyle.width = 4;
  452. skin->setStyle("ScrollLeftBtn", scrollLeftBtnStyle);
  453. // Right button
  454. GUIElementStyle scrollRightBtnStyle;
  455. scrollRightBtnStyle.normal.texture = getGUITexture(ScrollBarRightNormalTex);
  456. scrollRightBtnStyle.hover.texture = getGUITexture(ScrollBarRightHoverTex);
  457. scrollRightBtnStyle.active.texture = getGUITexture(ScrollBarRightActiveTex);
  458. scrollRightBtnStyle.fixedHeight = true;
  459. scrollRightBtnStyle.fixedWidth = true;
  460. scrollRightBtnStyle.height = 8;
  461. scrollRightBtnStyle.width = 4;
  462. skin->setStyle("ScrollRightBtn", scrollRightBtnStyle);
  463. // Horizontal handle
  464. GUIElementStyle scrollBarHorzBtnStyle;
  465. scrollBarHorzBtnStyle.normal.texture = getGUITexture(ScrollBarHandleHorzNormalTex);
  466. scrollBarHorzBtnStyle.hover.texture = getGUITexture(ScrollBarHandleHorzHoverTex);
  467. scrollBarHorzBtnStyle.active.texture = getGUITexture(ScrollBarHandleHorzActiveTex);
  468. scrollBarHorzBtnStyle.fixedHeight = true;
  469. scrollBarHorzBtnStyle.fixedWidth = true;
  470. scrollBarHorzBtnStyle.height = 6;
  471. scrollBarHorzBtnStyle.width = 4;
  472. skin->setStyle("ScrollBarHorzBtn", scrollBarHorzBtnStyle);
  473. // Vertical handle
  474. GUIElementStyle scrollBarVertBtnStyle;
  475. scrollBarVertBtnStyle.normal.texture = getGUITexture(ScrollBarHandleVertNormalTex);
  476. scrollBarVertBtnStyle.hover.texture = getGUITexture(ScrollBarHandleVertHoverTex);
  477. scrollBarVertBtnStyle.active.texture = getGUITexture(ScrollBarHandleVertActiveTex);
  478. scrollBarVertBtnStyle.fixedHeight = true;
  479. scrollBarVertBtnStyle.fixedWidth = true;
  480. scrollBarVertBtnStyle.height = 4;
  481. scrollBarVertBtnStyle.width = 6;
  482. skin->setStyle("ScrollBarVertBtn", scrollBarVertBtnStyle);
  483. HSpriteTexture scrollBarBgPtr = getGUITexture(ScrollBarBgTex);
  484. // Vertical scroll bar
  485. GUIElementStyle vertScrollBarStyle;
  486. vertScrollBarStyle.normal.texture = scrollBarBgPtr;
  487. vertScrollBarStyle.hover.texture = scrollBarBgPtr;
  488. vertScrollBarStyle.active.texture = scrollBarBgPtr;
  489. vertScrollBarStyle.fixedHeight = false;
  490. vertScrollBarStyle.fixedWidth = true;
  491. vertScrollBarStyle.minHeight = 16;
  492. vertScrollBarStyle.width = 8;
  493. skin->setStyle("ScrollBarVert", vertScrollBarStyle);
  494. // Horizontal scroll bar
  495. GUIElementStyle horzScrollBarStyle;
  496. horzScrollBarStyle.normal.texture = scrollBarBgPtr;
  497. horzScrollBarStyle.hover.texture = scrollBarBgPtr;
  498. horzScrollBarStyle.active.texture = scrollBarBgPtr;
  499. horzScrollBarStyle.fixedHeight = true;
  500. horzScrollBarStyle.fixedWidth = false;
  501. horzScrollBarStyle.minWidth = 16;
  502. horzScrollBarStyle.height = 8;
  503. skin->setStyle("ScrollBarHorz", horzScrollBarStyle);
  504. /************************************************************************/
  505. /* DROP DOWN BOX */
  506. /************************************************************************/
  507. // ListBox button
  508. GUIElementStyle dropDownListStyle;
  509. dropDownListStyle.normal.texture = getGUITexture(DropDownBtnNormalTex);
  510. dropDownListStyle.hover.texture = getGUITexture(DropDownBtnHoverTex);
  511. dropDownListStyle.active.texture = dropDownListStyle.hover.texture;
  512. dropDownListStyle.normalOn.texture = dropDownListStyle.hover.texture;
  513. dropDownListStyle.hoverOn.texture = dropDownListStyle.hover.texture;
  514. dropDownListStyle.activeOn.texture = dropDownListStyle.hover.texture;
  515. dropDownListStyle.fixedHeight = true;
  516. dropDownListStyle.fixedWidth = false;
  517. dropDownListStyle.height = 13;
  518. dropDownListStyle.width = 30;
  519. dropDownListStyle.contentOffset.left = 3;
  520. dropDownListStyle.contentOffset.right = 11;
  521. dropDownListStyle.contentOffset.top = 1;
  522. dropDownListStyle.contentOffset.bottom = 1;
  523. dropDownListStyle.border.left = 1;
  524. dropDownListStyle.border.right = 10;
  525. dropDownListStyle.border.top = 1;
  526. dropDownListStyle.border.bottom = 1;
  527. dropDownListStyle.font = font;
  528. dropDownListStyle.fontSize = DefaultFontSize;
  529. dropDownListStyle.textHorzAlign = THA_Left;
  530. dropDownListStyle.textVertAlign = TVA_Top;
  531. skin->setStyle("ListBox", dropDownListStyle);
  532. // DropDown scroll up button arrow
  533. HSpriteTexture dropDownBtnScrollUpArrow = getGUITexture(DropDownBoxBtnUpArrowTex);
  534. GUIElementStyle dropDownScrollUpBtnArrowStyle;
  535. dropDownScrollUpBtnArrowStyle.normal.texture = getGUITexture(DropDownBoxBtnUpArrowTex);
  536. dropDownScrollUpBtnArrowStyle.hover.texture = dropDownScrollUpBtnArrowStyle.normal.texture;
  537. dropDownScrollUpBtnArrowStyle.active.texture = dropDownScrollUpBtnArrowStyle.hover.texture;
  538. dropDownScrollUpBtnArrowStyle.fixedHeight = true;
  539. dropDownScrollUpBtnArrowStyle.fixedWidth = false;
  540. dropDownScrollUpBtnArrowStyle.height = 7;
  541. dropDownScrollUpBtnArrowStyle.width = 30;
  542. dropDownScrollUpBtnArrowStyle.border.left = 1;
  543. dropDownScrollUpBtnArrowStyle.border.right = 1;
  544. dropDownScrollUpBtnArrowStyle.border.top = 1;
  545. dropDownScrollUpBtnArrowStyle.border.bottom = 1;
  546. skin->setStyle("ListBoxScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
  547. skin->setStyle("MenuBarScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
  548. skin->setStyle("ContextMenuScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
  549. // DropDown scroll up button
  550. GUIElementStyle dropDownScrollUpBtnStyle;
  551. dropDownScrollUpBtnStyle.normal.texture = getGUITexture(DropDownBoxBtnUpNormalTex);
  552. dropDownScrollUpBtnStyle.hover.texture = getGUITexture(DropDownBoxBtnUpHoverTex);
  553. dropDownScrollUpBtnStyle.active.texture = dropDownScrollUpBtnStyle.hover.texture;
  554. dropDownScrollUpBtnStyle.fixedHeight = true;
  555. dropDownScrollUpBtnStyle.fixedWidth = false;
  556. dropDownScrollUpBtnStyle.height = 7;
  557. dropDownScrollUpBtnStyle.width = 30;
  558. dropDownScrollUpBtnStyle.border.left = 1;
  559. dropDownScrollUpBtnStyle.border.right = 1;
  560. dropDownScrollUpBtnStyle.border.top = 1;
  561. dropDownScrollUpBtnStyle.border.bottom = 1;
  562. skin->setStyle("ListBoxScrollUpBtn", dropDownScrollUpBtnStyle);
  563. skin->setStyle("MenuBarScrollUpBtn", dropDownScrollUpBtnStyle);
  564. skin->setStyle("ContextMenuScrollUpBtn", dropDownScrollUpBtnStyle);
  565. // DropDown scroll down button arrow
  566. GUIElementStyle dropDownScrollDownBtnArrowStyle;
  567. dropDownScrollDownBtnArrowStyle.normal.texture = getGUITexture(DropDownBoxBtnDownArrowTex);
  568. dropDownScrollDownBtnArrowStyle.hover.texture = dropDownScrollDownBtnArrowStyle.normal.texture;
  569. dropDownScrollDownBtnArrowStyle.active.texture = dropDownScrollDownBtnArrowStyle.hover.texture;
  570. dropDownScrollDownBtnArrowStyle.fixedHeight = true;
  571. dropDownScrollDownBtnArrowStyle.fixedWidth = false;
  572. dropDownScrollDownBtnArrowStyle.height = 7;
  573. dropDownScrollDownBtnArrowStyle.width = 30;
  574. dropDownScrollDownBtnArrowStyle.border.left = 1;
  575. dropDownScrollDownBtnArrowStyle.border.right = 1;
  576. dropDownScrollDownBtnArrowStyle.border.top = 1;
  577. dropDownScrollDownBtnArrowStyle.border.bottom = 1;
  578. skin->setStyle("ListBoxScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
  579. skin->setStyle("MenuBarScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
  580. skin->setStyle("ContextMenuScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
  581. // DropDown scroll down button
  582. GUIElementStyle dropDownScrollDownBtnStyle;
  583. dropDownScrollDownBtnStyle.normal.texture = getGUITexture(DropDownBoxBtnDownNormalTex);
  584. dropDownScrollDownBtnStyle.hover.texture = getGUITexture(DropDownBoxBtnDownHoverTex);
  585. dropDownScrollDownBtnStyle.active.texture = dropDownScrollDownBtnStyle.hover.texture;
  586. dropDownScrollDownBtnStyle.fixedHeight = true;
  587. dropDownScrollDownBtnStyle.fixedWidth = false;
  588. dropDownScrollDownBtnStyle.height = 7;
  589. dropDownScrollDownBtnStyle.width = 30;
  590. dropDownScrollDownBtnStyle.border.left = 1;
  591. dropDownScrollDownBtnStyle.border.right = 1;
  592. dropDownScrollDownBtnStyle.border.top = 1;
  593. dropDownScrollDownBtnStyle.border.bottom = 1;
  594. skin->setStyle("ListBoxScrollDownBtn", dropDownScrollDownBtnStyle);
  595. skin->setStyle("MenuBarScrollDownBtn", dropDownScrollDownBtnStyle);
  596. skin->setStyle("ContextMenuScrollDownBtn", dropDownScrollDownBtnStyle);
  597. // DropDown entry button
  598. GUIElementStyle dropDownEntryBtnStyle;
  599. dropDownEntryBtnStyle.normal.texture = getGUITexture(DropDownBoxEntryNormalTex);
  600. dropDownEntryBtnStyle.hover.texture = getGUITexture(DropDownBoxEntryHoverTex);
  601. dropDownEntryBtnStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
  602. dropDownEntryBtnStyle.normalOn.texture = dropDownEntryBtnStyle.hover.texture;
  603. dropDownEntryBtnStyle.hoverOn.texture = dropDownEntryBtnStyle.hover.texture;
  604. dropDownEntryBtnStyle.activeOn.texture = dropDownEntryBtnStyle.hover.texture;
  605. dropDownEntryBtnStyle.fixedHeight = true;
  606. dropDownEntryBtnStyle.fixedWidth = false;
  607. dropDownEntryBtnStyle.height = 14;
  608. dropDownEntryBtnStyle.width = 30;
  609. dropDownEntryBtnStyle.border.left = 1;
  610. dropDownEntryBtnStyle.border.right = 1;
  611. dropDownEntryBtnStyle.border.top = 1;
  612. dropDownEntryBtnStyle.border.bottom = 1;
  613. dropDownEntryBtnStyle.font = font;
  614. dropDownEntryBtnStyle.fontSize = DefaultFontSize;
  615. dropDownEntryBtnStyle.textHorzAlign = THA_Left;
  616. dropDownEntryBtnStyle.textVertAlign = TVA_Top;
  617. skin->setStyle(GUIDropDownContent::ENTRY_STYLE_TYPE, dropDownEntryBtnStyle);
  618. // DropDown entry button with expand
  619. GUIElementStyle dropDownEntryExpBtnStyle;
  620. dropDownEntryExpBtnStyle.normal.texture = getGUITexture(DropDownBoxEntryExpNormalTex);
  621. dropDownEntryExpBtnStyle.hover.texture = getGUITexture(DropDownBoxEntryExpHoverTex);
  622. dropDownEntryExpBtnStyle.active.texture = dropDownEntryExpBtnStyle.hover.texture;
  623. dropDownEntryExpBtnStyle.normalOn.texture = dropDownEntryExpBtnStyle.hover.texture;
  624. dropDownEntryExpBtnStyle.hoverOn.texture = dropDownEntryExpBtnStyle.hover.texture;
  625. dropDownEntryExpBtnStyle.activeOn.texture = dropDownEntryExpBtnStyle.hover.texture;
  626. dropDownEntryExpBtnStyle.fixedHeight = true;
  627. dropDownEntryExpBtnStyle.fixedWidth = false;
  628. dropDownEntryExpBtnStyle.height = 14;
  629. dropDownEntryExpBtnStyle.width = 30;
  630. dropDownEntryExpBtnStyle.border.left = 1;
  631. dropDownEntryExpBtnStyle.border.right = 6;
  632. dropDownEntryExpBtnStyle.border.top = 1;
  633. dropDownEntryExpBtnStyle.border.bottom = 1;
  634. dropDownEntryExpBtnStyle.font = font;
  635. dropDownEntryExpBtnStyle.fontSize = DefaultFontSize;
  636. dropDownEntryExpBtnStyle.textHorzAlign = THA_Left;
  637. dropDownEntryExpBtnStyle.textVertAlign = TVA_Top;
  638. skin->setStyle(GUIDropDownContent::ENTRY_EXP_STYLE_TYPE, dropDownEntryExpBtnStyle);
  639. // Drop down separator
  640. GUIElementStyle dropDownSeparatorStyle;
  641. dropDownSeparatorStyle.normal.texture = getGUITexture(DropDownSeparatorTex);
  642. dropDownSeparatorStyle.fixedHeight = true;
  643. dropDownSeparatorStyle.fixedWidth = false;
  644. dropDownSeparatorStyle.height = 3;
  645. dropDownSeparatorStyle.width = 30;
  646. dropDownSeparatorStyle.border.left = 1;
  647. dropDownSeparatorStyle.border.right = 1;
  648. dropDownSeparatorStyle.border.top = 1;
  649. dropDownSeparatorStyle.border.bottom = 1;
  650. skin->setStyle(GUIDropDownContent::SEPARATOR_STYLE_TYPE, dropDownSeparatorStyle);
  651. // Drop down content
  652. GUIElementStyle dropDownContentStyle;
  653. dropDownContentStyle.minWidth = 50;
  654. dropDownContentStyle.minHeight = 20;
  655. dropDownContentStyle.subStyles[GUIDropDownContent::ENTRY_STYLE_TYPE] = GUIDropDownContent::ENTRY_STYLE_TYPE;
  656. dropDownContentStyle.subStyles[GUIDropDownContent::ENTRY_EXP_STYLE_TYPE] = GUIDropDownContent::ENTRY_EXP_STYLE_TYPE;
  657. dropDownContentStyle.subStyles[GUIDropDownContent::SEPARATOR_STYLE_TYPE] = GUIDropDownContent::SEPARATOR_STYLE_TYPE;
  658. skin->setStyle("ListBoxContent", dropDownContentStyle);
  659. skin->setStyle("MenuBarContent", dropDownContentStyle);
  660. skin->setStyle("ContextMenuContent", dropDownContentStyle);
  661. // DropDown box frame
  662. GUIElementStyle dropDownBoxStyle;
  663. dropDownBoxStyle.normal.texture = getGUITexture(DropDownBoxBgTex);
  664. dropDownBoxStyle.hover.texture = dropDownEntryBtnStyle.normal.texture;
  665. dropDownBoxStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
  666. dropDownBoxStyle.fixedHeight = false;
  667. dropDownBoxStyle.fixedWidth = false;
  668. dropDownBoxStyle.border.left = 1;
  669. dropDownBoxStyle.border.right = 1;
  670. dropDownBoxStyle.border.top = 1;
  671. dropDownBoxStyle.border.bottom = 1;
  672. dropDownBoxStyle.margins.left = 1;
  673. dropDownBoxStyle.margins.right = 1;
  674. dropDownBoxStyle.margins.top = 1;
  675. dropDownBoxStyle.margins.bottom = 1;
  676. skin->setStyle("ListBoxFrame", dropDownBoxStyle);
  677. skin->setStyle("MenuBarFrame", dropDownBoxStyle);
  678. skin->setStyle("ContextMenuFrame", dropDownBoxStyle);
  679. /************************************************************************/
  680. /* MENU BAR */
  681. /************************************************************************/
  682. // MenuBar background
  683. GUIElementStyle menuBarBgStyle;
  684. menuBarBgStyle.normal.texture = getGUITexture(MenuBarBgTex);
  685. menuBarBgStyle.fixedHeight = false;
  686. menuBarBgStyle.fixedWidth = false;
  687. menuBarBgStyle.height = 4;
  688. menuBarBgStyle.width = 4;
  689. skin->setStyle("MenuBarBg", menuBarBgStyle);
  690. // MenuBar Banshee logo
  691. GUIElementStyle menuBarBansheeLogoStyle;
  692. menuBarBansheeLogoStyle.normal.texture = getGUITexture(MenuBarBansheeLogoTex);
  693. menuBarBansheeLogoStyle.fixedHeight = true;
  694. menuBarBansheeLogoStyle.fixedWidth = true;
  695. menuBarBansheeLogoStyle.height = 7;
  696. menuBarBansheeLogoStyle.width = 51;
  697. skin->setStyle("MenuBarBansheeLogo", menuBarBansheeLogoStyle);
  698. // MenuBar button
  699. GUIElementStyle menuBarBtnStyle;
  700. menuBarBtnStyle.normal.texture = getGUITexture(MenuBarBtnNormalTex);
  701. menuBarBtnStyle.hover.texture = getGUITexture(MenuBarBtnHoverTex);
  702. menuBarBtnStyle.active.texture = menuBarBtnStyle.hover.texture;
  703. menuBarBtnStyle.normalOn.texture = menuBarBtnStyle.hover.texture;
  704. menuBarBtnStyle.hoverOn.texture = menuBarBtnStyle.hover.texture;
  705. menuBarBtnStyle.activeOn.texture = menuBarBtnStyle.hover.texture;
  706. menuBarBtnStyle.fixedHeight = true;
  707. menuBarBtnStyle.fixedWidth = false;
  708. menuBarBtnStyle.height = 15;
  709. menuBarBtnStyle.width = 4;
  710. menuBarBtnStyle.margins.left = 2;
  711. menuBarBtnStyle.margins.right = 2;
  712. menuBarBtnStyle.margins.top = 2;
  713. menuBarBtnStyle.margins.bottom = 2;
  714. menuBarBtnStyle.font = font;
  715. menuBarBtnStyle.fontSize = DefaultFontSize;
  716. menuBarBtnStyle.textHorzAlign = THA_Left;
  717. menuBarBtnStyle.textVertAlign = TVA_Top;
  718. skin->setStyle("MenuBarBtn", menuBarBtnStyle);
  719. /************************************************************************/
  720. /* DOCK SLIDER */
  721. /************************************************************************/
  722. GUIElementStyle dockSliderBtnStyle;
  723. dockSliderBtnStyle.normal.texture = getGUITexture(DockSliderNormalTex);
  724. dockSliderBtnStyle.fixedHeight = false;
  725. dockSliderBtnStyle.fixedWidth = false;
  726. dockSliderBtnStyle.height = 2;
  727. dockSliderBtnStyle.width = 2;
  728. skin->setStyle("DockSliderBtn", dockSliderBtnStyle);
  729. /************************************************************************/
  730. /* TREE VIEW */
  731. /************************************************************************/
  732. // Expand button
  733. GUIElementStyle treeViewExpandButtonStyle;
  734. treeViewExpandButtonStyle.normal.texture = getGUITexture(TreeViewExpandButtonOffNormal);
  735. treeViewExpandButtonStyle.hover.texture = getGUITexture(TreeViewExpandButtonOffHover);
  736. treeViewExpandButtonStyle.active.texture = treeViewExpandButtonStyle.hover.texture;
  737. treeViewExpandButtonStyle.normalOn.texture = getGUITexture(TreeViewExpandButtonOnNormal);
  738. treeViewExpandButtonStyle.hoverOn.texture = getGUITexture(TreeViewExpandButtonOnHover);
  739. treeViewExpandButtonStyle.activeOn.texture = treeViewExpandButtonStyle.hoverOn.texture;
  740. treeViewExpandButtonStyle.margins.left = 4;
  741. treeViewExpandButtonStyle.margins.right = 4;
  742. treeViewExpandButtonStyle.margins.top = 5;
  743. treeViewExpandButtonStyle.margins.bottom = 4;
  744. treeViewExpandButtonStyle.fixedHeight = true;
  745. treeViewExpandButtonStyle.fixedWidth = true;
  746. treeViewExpandButtonStyle.height = 16;
  747. treeViewExpandButtonStyle.width = 16;
  748. skin->setStyle("TreeViewFoldoutBtn", treeViewExpandButtonStyle);
  749. // Entry
  750. GUIElementStyle treeViewEntryStyle;
  751. treeViewEntryStyle.font = font;
  752. treeViewEntryStyle.fontSize = DefaultFontSize;
  753. treeViewEntryStyle.fixedWidth = false;
  754. treeViewEntryStyle.fixedHeight = true;
  755. treeViewEntryStyle.height = 16;
  756. treeViewEntryStyle.minWidth = 10;
  757. skin->setStyle("TreeViewElementBtn", treeViewEntryStyle);
  758. // Selection background
  759. GUIElementStyle treeViewSelBackgroundStyle;
  760. treeViewSelBackgroundStyle.normal.texture = getGUITexture(TreeViewSelectionBackground);
  761. treeViewSelBackgroundStyle.fixedHeight = false;
  762. treeViewSelBackgroundStyle.fixedWidth = false;
  763. treeViewSelBackgroundStyle.height = 2;
  764. treeViewSelBackgroundStyle.width = 2;
  765. skin->setStyle("TreeViewSelectionBackground", treeViewSelBackgroundStyle);
  766. // Edit box
  767. GUIElementStyle treeViewEditBox;
  768. treeViewEditBox.normal.texture = getGUITexture(TreeViewEditBox);
  769. treeViewEditBox.hover.texture = treeViewEditBox.normal.texture;
  770. treeViewEditBox.focused.texture = treeViewEditBox.normal.texture;
  771. treeViewEditBox.active.texture = treeViewEditBox.normal.texture;
  772. treeViewEditBox.border.left = 1;
  773. treeViewEditBox.border.right = 1;
  774. treeViewEditBox.border.top = 1;
  775. treeViewEditBox.border.bottom = 1;
  776. treeViewEditBox.margins.left = 1;
  777. treeViewEditBox.margins.right = 1;
  778. treeViewEditBox.margins.top = 1;
  779. treeViewEditBox.margins.bottom = 1;
  780. treeViewEditBox.fixedHeight = true;
  781. treeViewEditBox.height = 13;
  782. treeViewEditBox.minWidth = 10;
  783. treeViewEditBox.font = font;
  784. treeViewEditBox.fontSize = DefaultFontSize;
  785. treeViewEditBox.textHorzAlign = THA_Left;
  786. treeViewEditBox.textVertAlign = TVA_Top;
  787. skin->setStyle(GUITreeViewEditBox::getGUITypeName(), treeViewEditBox);
  788. // Element highlight
  789. GUIElementStyle treeViewElementHighlight;
  790. treeViewElementHighlight.normal.texture = getGUITexture(TreeViewElementHighlight);
  791. treeViewElementHighlight.border.left = 1;
  792. treeViewElementHighlight.border.right = 1;
  793. treeViewElementHighlight.border.top = 1;
  794. treeViewElementHighlight.border.bottom = 1;
  795. skin->setStyle("TreeViewElementHighlight", treeViewElementHighlight);
  796. // Element separator highlight
  797. GUIElementStyle treeViewElementSepHighlight;
  798. treeViewElementSepHighlight.normal.texture = getGUITexture(TreeViewElementSepHighlight);
  799. treeViewElementSepHighlight.border.left = 1;
  800. treeViewElementSepHighlight.border.right = 1;
  801. treeViewElementSepHighlight.border.top = 1;
  802. treeViewElementSepHighlight.border.bottom = 1;
  803. skin->setStyle("TreeViewElementSepHighlight", treeViewElementSepHighlight);
  804. /************************************************************************/
  805. /* OBJECT DROP FIELD */
  806. /************************************************************************/
  807. GUIElementStyle objectDropStyle;
  808. objectDropStyle.normal.texture = getGUITexture(ObjectDropBtnNormalTex);
  809. objectDropStyle.normalOn.texture = getGUITexture(ObjectDropBtnNormalOnTex);
  810. objectDropStyle.fixedHeight = true;
  811. objectDropStyle.height = 15;
  812. objectDropStyle.minWidth = 50;
  813. objectDropStyle.font = font;
  814. objectDropStyle.fontSize = DefaultFontSize;
  815. objectDropStyle.textHorzAlign = THA_Center;
  816. objectDropStyle.textVertAlign = TVA_Center;
  817. skin->setStyle(ObjectFieldDropBtnStyleName, objectDropStyle);
  818. GUIElementStyle objectClearBtnStyle;
  819. objectClearBtnStyle.normal.texture = getGUITexture(ObjectClearBtnNormalTex);
  820. objectClearBtnStyle.hover.texture = getGUITexture(ObjectClearBtnHoverTex);
  821. objectClearBtnStyle.active.texture = getGUITexture(ObjectClearBtnActiveTex);
  822. objectClearBtnStyle.fixedHeight = true;
  823. objectClearBtnStyle.fixedWidth = true;
  824. objectClearBtnStyle.height = 15;
  825. objectClearBtnStyle.width = 13;
  826. skin->setStyle(ObjectFieldClearBtnStyleName, objectClearBtnStyle);
  827. GUIElementStyle editorObjectFieldStyle;
  828. editorObjectFieldStyle.fixedHeight = true;
  829. editorObjectFieldStyle.height = 15;
  830. editorObjectFieldStyle.minWidth = 30;
  831. editorObjectFieldStyle.subStyles[ObjectFieldLabelStyleName] = GUITextField::getLabelStyleType();
  832. editorObjectFieldStyle.subStyles[ObjectFieldDropBtnStyleName] = ObjectFieldDropBtnStyleName;
  833. editorObjectFieldStyle.subStyles[ObjectFieldClearBtnStyleName] = ObjectFieldClearBtnStyleName;
  834. skin->setStyle(ObjectFieldStyleName, editorObjectFieldStyle);
  835. /************************************************************************/
  836. /* EDITOR FIELDS */
  837. /************************************************************************/
  838. GUIElementStyle editorFieldLabelStyle;
  839. editorFieldLabelStyle.font = font;
  840. editorFieldLabelStyle.fontSize = DefaultFontSize;
  841. editorFieldLabelStyle.fixedWidth = false;
  842. editorFieldLabelStyle.fixedHeight = true;
  843. editorFieldLabelStyle.height = 11;
  844. editorFieldLabelStyle.minWidth = 10;
  845. editorFieldLabelStyle.textHorzAlign = THA_Left;
  846. skin->setStyle(GUITextField::getLabelStyleType(), editorFieldLabelStyle);
  847. GUIElementStyle editorIntFieldStyle;
  848. editorIntFieldStyle.fixedHeight = true;
  849. editorIntFieldStyle.height = 15;
  850. editorIntFieldStyle.minWidth = 30;
  851. editorIntFieldStyle.subStyles[GUIIntField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  852. editorIntFieldStyle.subStyles[GUIIntField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  853. skin->setStyle(GUIIntField::getGUITypeName(), editorIntFieldStyle);
  854. GUIElementStyle editorFloatFieldStyle;
  855. editorFloatFieldStyle.fixedHeight = true;
  856. editorFloatFieldStyle.height = 15;
  857. editorFloatFieldStyle.minWidth = 30;
  858. editorFloatFieldStyle.subStyles[GUIFloatField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  859. editorFloatFieldStyle.subStyles[GUIFloatField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  860. skin->setStyle(GUIFloatField::getGUITypeName(), editorFloatFieldStyle);
  861. GUIElementStyle editorTextFieldStyle;
  862. editorTextFieldStyle.fixedHeight = true;
  863. editorTextFieldStyle.height = 15;
  864. editorTextFieldStyle.minWidth = 30;
  865. editorTextFieldStyle.subStyles[GUITextField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  866. editorTextFieldStyle.subStyles[GUITextField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  867. skin->setStyle(GUITextField::getGUITypeName(), editorTextFieldStyle);
  868. GUIElementStyle editorColorFieldStyle;
  869. editorColorFieldStyle.fixedHeight = true;
  870. editorColorFieldStyle.height = 15;
  871. editorColorFieldStyle.minWidth = 30;
  872. editorColorFieldStyle.subStyles[GUIColorField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  873. editorColorFieldStyle.subStyles[GUIColorField::getColorInputStyleType()] = GUIColor::getGUITypeName();
  874. skin->setStyle(GUIColorField::getGUITypeName(), editorColorFieldStyle);
  875. GUIElementStyle editorToggleFieldStyle;
  876. editorToggleFieldStyle.fixedHeight = true;
  877. editorToggleFieldStyle.height = 15;
  878. editorToggleFieldStyle.minWidth = 30;
  879. editorToggleFieldStyle.subStyles[GUIToggleField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  880. editorToggleFieldStyle.subStyles[GUIToggleField::getToggleStyleType()] = GUIToggle::getGUITypeName();
  881. skin->setStyle(GUIToggleField::getGUITypeName(), editorToggleFieldStyle);
  882. GUIElementStyle editorVector2FieldStyle;
  883. editorVector2FieldStyle.fixedHeight = true;
  884. editorVector2FieldStyle.height = 30;
  885. editorVector2FieldStyle.minWidth = 30;
  886. editorVector2FieldStyle.subStyles[GUIVector2Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  887. editorVector2FieldStyle.subStyles[GUIVector2Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  888. skin->setStyle(GUIVector2Field::getGUITypeName(), editorVector2FieldStyle);
  889. GUIElementStyle editorVector3FieldStyle;
  890. editorVector3FieldStyle.fixedHeight = true;
  891. editorVector3FieldStyle.height = 30;
  892. editorVector3FieldStyle.minWidth = 30;
  893. editorVector3FieldStyle.subStyles[GUIVector3Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  894. editorVector3FieldStyle.subStyles[GUIVector3Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  895. skin->setStyle(GUIVector3Field::getGUITypeName(), editorVector3FieldStyle);
  896. GUIElementStyle editorVector4FieldStyle;
  897. editorVector4FieldStyle.fixedHeight = true;
  898. editorVector4FieldStyle.height = 30;
  899. editorVector4FieldStyle.minWidth = 30;
  900. editorVector4FieldStyle.subStyles[GUIVector4Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  901. editorVector4FieldStyle.subStyles[GUIVector4Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  902. skin->setStyle(GUIVector4Field::getGUITypeName(), editorVector4FieldStyle);
  903. /************************************************************************/
  904. /* COMPONENT FOLDOUT */
  905. /************************************************************************/
  906. GUIElementStyle cmpFoldoutBtnStyle;
  907. cmpFoldoutBtnStyle.normal.texture = getGUITexture(CmpFoldoutClosedNormalTex);
  908. cmpFoldoutBtnStyle.hover.texture = getGUITexture(CmpFoldoutClosedHoverTex);
  909. cmpFoldoutBtnStyle.active.texture = getGUITexture(CmpFoldoutOpenActiveTex);
  910. cmpFoldoutBtnStyle.normalOn.texture = getGUITexture(CmpFoldoutOpenNormalTex);
  911. cmpFoldoutBtnStyle.hoverOn.texture = getGUITexture(CmpFoldoutOpenHoverTex);
  912. cmpFoldoutBtnStyle.activeOn.texture = getGUITexture(CmpFoldoutOpenActiveTex);
  913. cmpFoldoutBtnStyle.fixedHeight = true;
  914. cmpFoldoutBtnStyle.fixedWidth = false;
  915. cmpFoldoutBtnStyle.height = 10;
  916. cmpFoldoutBtnStyle.minWidth = 10;
  917. cmpFoldoutBtnStyle.font = font;
  918. cmpFoldoutBtnStyle.fontSize = DefaultFontSize;
  919. cmpFoldoutBtnStyle.textHorzAlign = THA_Left;
  920. cmpFoldoutBtnStyle.textVertAlign = TVA_Center;
  921. cmpFoldoutBtnStyle.contentOffset = RectOffset(12, 0, 0, 0);
  922. cmpFoldoutBtnStyle.border.left = 8;
  923. skin->setStyle(GUIComponentFoldout::getFoldoutButtonStyleType(), cmpFoldoutBtnStyle);
  924. GUIElementStyle cmpFoldoutStyle;
  925. cmpFoldoutStyle.fixedHeight = true;
  926. cmpFoldoutStyle.height = 12;
  927. cmpFoldoutStyle.minWidth = 30;
  928. cmpFoldoutStyle.subStyles[GUIComponentFoldout::getFoldoutButtonStyleType()] = GUIComponentFoldout::getFoldoutButtonStyleType();
  929. skin->setStyle(GUIComponentFoldout::getGUITypeName(), cmpFoldoutStyle);
  930. /************************************************************************/
  931. /* FOLDOUT */
  932. /************************************************************************/
  933. GUIElementStyle foldoutBtnStyle;
  934. foldoutBtnStyle.normal.texture = getGUITexture(FoldoutClosedNormalTex);
  935. foldoutBtnStyle.hover.texture = getGUITexture(FoldoutClosedHoverTex);
  936. foldoutBtnStyle.active.texture = foldoutBtnStyle.hover.texture;
  937. foldoutBtnStyle.normalOn.texture = getGUITexture(FoldoutOpenNormalTex);
  938. foldoutBtnStyle.hoverOn.texture = getGUITexture(FoldoutOpenHoverTex);
  939. foldoutBtnStyle.activeOn.texture = foldoutBtnStyle.hoverOn.texture;
  940. foldoutBtnStyle.fixedHeight = true;
  941. foldoutBtnStyle.fixedWidth = true;
  942. foldoutBtnStyle.height = 10;
  943. foldoutBtnStyle.width = 8;
  944. skin->setStyle(GUIFoldout::getFoldoutButtonStyleType(), foldoutBtnStyle);
  945. GUIElementStyle foldoutStyle;
  946. foldoutStyle.fixedHeight = true;
  947. foldoutStyle.height = 12;
  948. foldoutStyle.minWidth = 30;
  949. foldoutStyle.subStyles[GUIFoldout::getLabelStyleType()] = GUIFoldout::getLabelStyleType();
  950. foldoutStyle.subStyles[GUIFoldout::getFoldoutButtonStyleType()] = GUIFoldout::getFoldoutButtonStyleType();
  951. skin->setStyle(GUIFoldout::getGUITypeName(), foldoutStyle);
  952. /************************************************************************/
  953. /* PROGRESS BAR */
  954. /************************************************************************/
  955. GUIElementStyle progressBarBgStyle;
  956. progressBarBgStyle.fixedHeight = true;
  957. progressBarBgStyle.height = 18;
  958. progressBarBgStyle.normal.texture = getGUITexture(ProgressBarBgTex);
  959. skin->setStyle(GUIProgressBar::getBackgroundStyleType(), progressBarBgStyle);
  960. GUIElementStyle progressBarFillStyle;
  961. progressBarFillStyle.fixedHeight = true;
  962. progressBarFillStyle.height = 12;
  963. progressBarFillStyle.normal.texture = getGUITexture(ProgressBarFillTex);
  964. skin->setStyle(GUIProgressBar::getBarStyleType(), progressBarFillStyle);
  965. GUIElementStyle progressBarStyle;
  966. progressBarStyle.fixedHeight = true;
  967. progressBarStyle.height = 18;
  968. progressBarStyle.minWidth = 100;
  969. progressBarStyle.margins.top = 3;
  970. progressBarStyle.margins.bottom = 3;
  971. progressBarStyle.subStyles[GUIProgressBar::getBarStyleType()] = GUIProgressBar::getBarStyleType();
  972. progressBarStyle.subStyles[GUIProgressBar::getBackgroundStyleType()] = GUIProgressBar::getBackgroundStyleType();
  973. skin->setStyle(GUIProgressBar::getGUITypeName(), progressBarStyle);
  974. /************************************************************************/
  975. /* COLOR PICKER SLIDER */
  976. /************************************************************************/
  977. GUIElementStyle colorPickerSliderHorzHandleStyle;
  978. colorPickerSliderHorzHandleStyle.fixedHeight = true;
  979. colorPickerSliderHorzHandleStyle.fixedWidth = true;
  980. colorPickerSliderHorzHandleStyle.height = 20;
  981. colorPickerSliderHorzHandleStyle.width = 7;
  982. colorPickerSliderHorzHandleStyle.normal.texture = getGUITexture(ColorPickerSliderHorzHandleTex);
  983. colorPickerSliderHorzHandleStyle.hover.texture = colorPickerSliderHorzHandleStyle.normal.texture;
  984. colorPickerSliderHorzHandleStyle.active.texture = colorPickerSliderHorzHandleStyle.normal.texture;
  985. skin->setStyle("ColorSliderHorzHandle", colorPickerSliderHorzHandleStyle);
  986. GUIElementStyle colorPickerSliderHorzStyle;
  987. colorPickerSliderHorzHandleStyle.fixedHeight = true;
  988. colorPickerSliderHorzHandleStyle.height = 32;
  989. colorPickerSliderHorzHandleStyle.minWidth = 20;
  990. colorPickerSliderHorzStyle.subStyles[GUISlider::getHandleStyleType()] = "ColorSliderHorzHandle";
  991. skin->setStyle("ColorSliderHorz", colorPickerSliderHorzStyle);
  992. GUIElementStyle colorPickerSliderVertHandleStyle;
  993. colorPickerSliderVertHandleStyle.fixedHeight = true;
  994. colorPickerSliderVertHandleStyle.fixedWidth = true;
  995. colorPickerSliderVertHandleStyle.height = 7;
  996. colorPickerSliderVertHandleStyle.width = 45;
  997. colorPickerSliderVertHandleStyle.normal.texture = getGUITexture(ColorPickerSliderVertHandleTex);
  998. colorPickerSliderVertHandleStyle.hover.texture = colorPickerSliderVertHandleStyle.normal.texture;
  999. colorPickerSliderVertHandleStyle.active.texture = colorPickerSliderVertHandleStyle.normal.texture;
  1000. skin->setStyle("ColorSliderVertHandle", colorPickerSliderVertHandleStyle);
  1001. GUIElementStyle colorPickerSliderVertStyle;
  1002. colorPickerSliderVertStyle.fixedWidth = true;
  1003. colorPickerSliderVertStyle.width = 30;
  1004. colorPickerSliderVertStyle.minHeight = 20;
  1005. colorPickerSliderVertStyle.subStyles[GUISlider::getHandleStyleType()] = "ColorSliderVertHandle";
  1006. skin->setStyle("ColorSliderVert", colorPickerSliderVertStyle);
  1007. GUIElementStyle colorPickerSlider2DHandleStyle;
  1008. colorPickerSlider2DHandleStyle.fixedHeight = true;
  1009. colorPickerSlider2DHandleStyle.fixedWidth = true;
  1010. colorPickerSlider2DHandleStyle.height = 8;
  1011. colorPickerSlider2DHandleStyle.width = 8;
  1012. colorPickerSlider2DHandleStyle.normal.texture = getGUITexture(ColorPickerSlider2DHandleTex);
  1013. colorPickerSlider2DHandleStyle.hover.texture = colorPickerSlider2DHandleStyle.normal.texture;
  1014. colorPickerSlider2DHandleStyle.active.texture = colorPickerSlider2DHandleStyle.normal.texture;
  1015. skin->setStyle("ColorSlider2DHandle", colorPickerSlider2DHandleStyle);
  1016. /************************************************************************/
  1017. /* OTHER */
  1018. /************************************************************************/
  1019. // Right-aligned label
  1020. GUIElementStyle rightAlignedLabelStyle;
  1021. rightAlignedLabelStyle.font = font;
  1022. rightAlignedLabelStyle.fontSize = DefaultFontSize;
  1023. rightAlignedLabelStyle.fixedWidth = false;
  1024. rightAlignedLabelStyle.fixedHeight = true;
  1025. rightAlignedLabelStyle.height = 11;
  1026. rightAlignedLabelStyle.minWidth = 10;
  1027. rightAlignedLabelStyle.textHorzAlign = THA_Right;
  1028. skin->setStyle("RightAlignedLabel", rightAlignedLabelStyle);
  1029. // Selection area
  1030. GUIElementStyle selectionAreaStyle;
  1031. selectionAreaStyle.normal.texture = getGUITexture(SelectionAreaTex);
  1032. selectionAreaStyle.border.left = 1;
  1033. selectionAreaStyle.border.right = 1;
  1034. selectionAreaStyle.border.top = 1;
  1035. selectionAreaStyle.border.bottom = 1;
  1036. skin->setStyle("SelectionArea", selectionAreaStyle);
  1037. return skin;
  1038. }
  1039. HSpriteTexture BuiltinEditorResources::getGUITexture(const WString& name)
  1040. {
  1041. Path texturePath = FileSystem::getWorkingDirectoryPath();
  1042. texturePath.append(EditorSkinFolder);
  1043. texturePath.append(L"sprite_" + name + L".asset");
  1044. return Resources::instance().load<SpriteTexture>(texturePath);
  1045. }
  1046. HSpriteTexture BuiltinEditorResources::getGUIIcon(const WString& name)
  1047. {
  1048. Path texturePath = FileSystem::getWorkingDirectoryPath();
  1049. texturePath.append(EditorIconFolder);
  1050. texturePath.append(L"sprite_" + name + L".asset");
  1051. return Resources::instance().load<SpriteTexture>(texturePath);
  1052. }
  1053. HShader BuiltinEditorResources::getShader(const WString& name)
  1054. {
  1055. Path programPath = EditorShaderFolder;
  1056. programPath.append(name + L".asset");
  1057. return gResources().load<Shader>(programPath);
  1058. }
  1059. HMaterial BuiltinEditorResources::createDockDropOverlayMaterial() const
  1060. {
  1061. return Material::create(mShaderDockOverlay);
  1062. }
  1063. HMaterial BuiltinEditorResources::createSceneGridMaterial() const
  1064. {
  1065. return Material::create(mShaderSceneGrid);
  1066. }
  1067. HMaterial BuiltinEditorResources::createPicking(CullingMode cullMode) const
  1068. {
  1069. UINT32 modeIdx = (UINT32)cullMode;
  1070. return Material::create(mShaderPicking[modeIdx]);
  1071. }
  1072. HMaterial BuiltinEditorResources::createPickingAlpha(CullingMode cullMode) const
  1073. {
  1074. UINT32 modeIdx = (UINT32)cullMode;
  1075. return Material::create(mShaderPickingAlpha[modeIdx]);
  1076. }
  1077. HMaterial BuiltinEditorResources::createWireGizmoMat() const
  1078. {
  1079. return Material::create(mShaderGizmoWire);
  1080. }
  1081. HMaterial BuiltinEditorResources::createSolidGizmoMat() const
  1082. {
  1083. return Material::create(mShaderGizmoSolid);
  1084. }
  1085. HMaterial BuiltinEditorResources::createIconGizmoMat() const
  1086. {
  1087. return Material::create(mShaderGizmoIcon);
  1088. }
  1089. HMaterial BuiltinEditorResources::createGizmoPickingMat() const
  1090. {
  1091. return Material::create(mShaderGizmoPicking);
  1092. }
  1093. HMaterial BuiltinEditorResources::createAlphaGizmoPickingMat() const
  1094. {
  1095. return Material::create(mShaderGizmoAlphaPicking);
  1096. }
  1097. HMaterial BuiltinEditorResources::createWireHandleMat() const
  1098. {
  1099. return Material::create(mShaderHandleWire);
  1100. }
  1101. HMaterial BuiltinEditorResources::createSolidHandleMat() const
  1102. {
  1103. return Material::create(mShaderHandleSolid);
  1104. }
  1105. HMaterial BuiltinEditorResources::createSelectionMat() const
  1106. {
  1107. return Material::create(mShaderSelection);
  1108. }
  1109. HSpriteTexture BuiltinEditorResources::getLibraryIcon(ProjectIcon icon) const
  1110. {
  1111. switch (icon)
  1112. {
  1113. case ProjectIcon::Folder:
  1114. return getGUIIcon(FolderIconTex);
  1115. case ProjectIcon::Font:
  1116. return getGUIIcon(FontIconTex);
  1117. case ProjectIcon::Mesh:
  1118. return getGUIIcon(MeshIconTex);
  1119. case ProjectIcon::Texture:
  1120. return getGUIIcon(TextureIconTex);
  1121. case ProjectIcon::PlainText:
  1122. return getGUIIcon(PlainTextIconTex);
  1123. case ProjectIcon::ScriptCode:
  1124. return getGUIIcon(ScriptCodeIconTex);
  1125. case ProjectIcon::Shader:
  1126. return getGUIIcon(ShaderIconTex);
  1127. case ProjectIcon::ShaderInclude:
  1128. return getGUIIcon(ShaderIncludeIconTex);
  1129. case ProjectIcon::Material:
  1130. return getGUIIcon(MaterialIconTex);
  1131. case ProjectIcon::SpriteTexture:
  1132. return getGUIIcon(SpriteTextureIconTex);
  1133. }
  1134. return HSpriteTexture();
  1135. }
  1136. }