BsBuiltinEditorResources.cpp 61 KB

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