BsBuiltinEditorResources.cpp 61 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390
  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. // Window frame
  271. GUIElementStyle windowFrameStyle;
  272. windowFrameStyle.normal.texture = getGUITexture(WindowFrameNormal);
  273. windowFrameStyle.focused.texture = getGUITexture(WindowFrameFocused);
  274. windowFrameStyle.border.left = 1;
  275. windowFrameStyle.border.right = 1;
  276. windowFrameStyle.border.top = 1;
  277. windowFrameStyle.border.bottom = 1;
  278. skin->setStyle("WindowFrame", windowFrameStyle);
  279. // Button
  280. GUIElementStyle buttonStyle;
  281. buttonStyle.normal.texture = getGUITexture(ButtonNormalTex);
  282. buttonStyle.hover.texture = getGUITexture(ButtonHoverTex);
  283. buttonStyle.active.texture = getGUITexture(ButtonActiveTex);
  284. buttonStyle.normalOn.texture = getGUITexture(ButtonActiveTex);
  285. buttonStyle.hoverOn.texture = getGUITexture(ButtonActiveTex);
  286. buttonStyle.activeOn.texture = getGUITexture(ButtonActiveTex);
  287. buttonStyle.border.left = 6;
  288. buttonStyle.border.right = 6;
  289. buttonStyle.border.top = 6;
  290. buttonStyle.border.bottom = 6;
  291. buttonStyle.contentOffset.left = 3;
  292. buttonStyle.contentOffset.right = 3;
  293. buttonStyle.fixedHeight = true;
  294. buttonStyle.height = 15;
  295. buttonStyle.minWidth = 50;
  296. buttonStyle.font = font;
  297. buttonStyle.fontSize = DefaultFontSize;
  298. buttonStyle.textHorzAlign = THA_Center;
  299. buttonStyle.textVertAlign = TVA_Center;
  300. skin->setStyle(GUIButton::getGUITypeName(), buttonStyle);
  301. // Toggle
  302. GUIElementStyle toggleStyle;
  303. toggleStyle.normal.texture = getGUITexture(ToggleNormalTex);
  304. toggleStyle.hover.texture = getGUITexture(ToggleHoverTex);
  305. toggleStyle.active.texture = getGUITexture(ToggleActiveTex);
  306. toggleStyle.normalOn.texture = getGUITexture(ToggleNormalOnTex);
  307. toggleStyle.hoverOn.texture = getGUITexture(ToggleHoverOnTex);
  308. toggleStyle.activeOn.texture = getGUITexture(ToggleActiveOnTex);
  309. toggleStyle.fixedHeight = true;
  310. toggleStyle.fixedWidth = true;
  311. toggleStyle.height = 15;
  312. toggleStyle.width = 15;
  313. skin->setStyle(GUIToggle::getGUITypeName(), toggleStyle);
  314. // Color
  315. GUIElementStyle colorStyle;
  316. colorStyle.margins.left = 2;
  317. colorStyle.margins.right = 2;
  318. colorStyle.margins.top = 2;
  319. colorStyle.margins.bottom = 2;
  320. colorStyle.fixedHeight = true;
  321. colorStyle.height = 10;
  322. colorStyle.minWidth = 10;
  323. skin->setStyle(GUIColor::getGUITypeName(), colorStyle);
  324. // Window background texture
  325. GUIElementStyle windowBgStyle;
  326. windowBgStyle.normal.texture = getGUITexture(WindowBackgroundTexture);
  327. skin->setStyle("WindowBackground", windowBgStyle);
  328. // Window title bar background
  329. GUIElementStyle titleBarBgStyle;
  330. titleBarBgStyle.normal.texture = getGUITexture(WindowTitleBarBg);
  331. titleBarBgStyle.fixedHeight = true;
  332. titleBarBgStyle.height = 13;
  333. skin->setStyle("TitleBarBackground", titleBarBgStyle);
  334. // Tabbed title bar tab button
  335. GUIElementStyle tabbedBarButton;
  336. tabbedBarButton.normal.texture = getGUITexture(TabbedBarBtnNormal);
  337. tabbedBarButton.hover.texture = getGUITexture(TabbedBarBtnActive);
  338. tabbedBarButton.active.texture = tabbedBarButton.hover.texture;
  339. tabbedBarButton.normalOn.texture = tabbedBarButton.hover.texture;
  340. tabbedBarButton.hoverOn.texture = tabbedBarButton.hover.texture;
  341. tabbedBarButton.activeOn.texture = tabbedBarButton.hover.texture;
  342. tabbedBarButton.fixedHeight = true;
  343. tabbedBarButton.height = 13;
  344. tabbedBarButton.minWidth = 10;
  345. tabbedBarButton.maxWidth = 110;
  346. tabbedBarButton.font = font;
  347. tabbedBarButton.fontSize = DefaultFontSize;
  348. tabbedBarButton.textHorzAlign = THA_Center;
  349. tabbedBarButton.textVertAlign = TVA_Center;
  350. skin->setStyle("TabbedBarBtn", tabbedBarButton);
  351. // Tabbed title bar drag/drop button
  352. GUIElementStyle tabbedBarDropButton;
  353. tabbedBarDropButton.fixedHeight = true;
  354. tabbedBarDropButton.fixedWidth = true;
  355. tabbedBarDropButton.height = 13;
  356. tabbedBarDropButton.width = 6;
  357. skin->setStyle("TabbedBarDropArea", tabbedBarDropButton);
  358. // Window minimize button
  359. GUIElementStyle winMinButtonStyle;
  360. winMinButtonStyle.normal.texture = getGUITexture(WindowMinButtonNormal);
  361. winMinButtonStyle.hover.texture = getGUITexture(WindowMinButtonHover);
  362. winMinButtonStyle.active.texture = winMinButtonStyle.hover.texture;
  363. winMinButtonStyle.fixedHeight = true;
  364. winMinButtonStyle.fixedWidth = true;
  365. winMinButtonStyle.height = 7;
  366. winMinButtonStyle.width = 8;
  367. skin->setStyle("WinMinimizeBtn", winMinButtonStyle);
  368. // Window maximize button
  369. GUIElementStyle winMaxButtonStyle;
  370. winMaxButtonStyle.normal.texture = getGUITexture(WindowMaxButtonNormal);
  371. winMaxButtonStyle.hover.texture = getGUITexture(WindowMaxButtonHover);
  372. winMaxButtonStyle.active.texture = winMaxButtonStyle.hover.texture;
  373. winMaxButtonStyle.fixedHeight = true;
  374. winMaxButtonStyle.fixedWidth = true;
  375. winMaxButtonStyle.height = 8;
  376. winMaxButtonStyle.width = 8;
  377. skin->setStyle("WinMaximizeBtn", winMaxButtonStyle);
  378. // Window close button
  379. GUIElementStyle winCloseButtonStyle;
  380. winCloseButtonStyle.normal.texture = getGUITexture(WindowCloseButtonNormal);
  381. winCloseButtonStyle.hover.texture = getGUITexture(WindowCloseButtonHover);
  382. winCloseButtonStyle.active.texture = winCloseButtonStyle.hover.texture;
  383. winCloseButtonStyle.fixedHeight = true;
  384. winCloseButtonStyle.fixedWidth = true;
  385. winCloseButtonStyle.height = 7;
  386. winCloseButtonStyle.width = 8;
  387. skin->setStyle("WinCloseBtn", winCloseButtonStyle);
  388. // Input box
  389. GUIElementStyle inputBoxStyle;
  390. inputBoxStyle.normal.texture = getGUITexture(InputBoxNormalTex);
  391. inputBoxStyle.hover.texture = getGUITexture(InputBoxHoverTex);
  392. inputBoxStyle.focused.texture = getGUITexture(InputBoxFocusedTex);
  393. inputBoxStyle.active.texture = inputBoxStyle.normal.texture;
  394. inputBoxStyle.border.left = 1;
  395. inputBoxStyle.border.right = 1;
  396. inputBoxStyle.border.top = 1;
  397. inputBoxStyle.border.bottom = 1;
  398. inputBoxStyle.contentOffset.left = 3;
  399. inputBoxStyle.contentOffset.right = 3;
  400. inputBoxStyle.contentOffset.top = 2;
  401. inputBoxStyle.contentOffset.bottom = 2;
  402. inputBoxStyle.fixedHeight = true;
  403. inputBoxStyle.height = 15;
  404. inputBoxStyle.minWidth = 10;
  405. inputBoxStyle.font = font;
  406. inputBoxStyle.fontSize = DefaultFontSize;
  407. inputBoxStyle.textHorzAlign = THA_Left;
  408. inputBoxStyle.textVertAlign = TVA_Top;
  409. skin->setStyle(GUIInputBox::getGUITypeName(), inputBoxStyle);
  410. /************************************************************************/
  411. /* SCROLL BAR */
  412. /************************************************************************/
  413. // Up button
  414. GUIElementStyle scrollUpBtnStyle;
  415. scrollUpBtnStyle.normal.texture = getGUITexture(ScrollBarUpNormalTex);
  416. scrollUpBtnStyle.hover.texture = getGUITexture(ScrollBarUpHoverTex);
  417. scrollUpBtnStyle.active.texture = getGUITexture(ScrollBarUpActiveTex);
  418. scrollUpBtnStyle.fixedHeight = true;
  419. scrollUpBtnStyle.fixedWidth = true;
  420. scrollUpBtnStyle.height = 4;
  421. scrollUpBtnStyle.width = 8;
  422. skin->setStyle("ScrollUpBtn", scrollUpBtnStyle);
  423. // Down button
  424. GUIElementStyle scrollDownBtnStyle;
  425. scrollDownBtnStyle.normal.texture = getGUITexture(ScrollBarDownNormalTex);
  426. scrollDownBtnStyle.hover.texture = getGUITexture(ScrollBarDownHoverTex);
  427. scrollDownBtnStyle.active.texture = getGUITexture(ScrollBarDownActiveTex);
  428. scrollDownBtnStyle.fixedHeight = true;
  429. scrollDownBtnStyle.fixedWidth = true;
  430. scrollDownBtnStyle.height = 4;
  431. scrollDownBtnStyle.width = 8;
  432. skin->setStyle("ScrollDownBtn", scrollDownBtnStyle);
  433. // Left button
  434. GUIElementStyle scrollLeftBtnStyle;
  435. scrollLeftBtnStyle.normal.texture = getGUITexture(ScrollBarLeftNormalTex);
  436. scrollLeftBtnStyle.hover.texture = getGUITexture(ScrollBarLeftHoverTex);
  437. scrollLeftBtnStyle.active.texture = getGUITexture(ScrollBarLeftActiveTex);
  438. scrollLeftBtnStyle.fixedHeight = true;
  439. scrollLeftBtnStyle.fixedWidth = true;
  440. scrollLeftBtnStyle.height = 8;
  441. scrollLeftBtnStyle.width = 4;
  442. skin->setStyle("ScrollLeftBtn", scrollLeftBtnStyle);
  443. // Right button
  444. GUIElementStyle scrollRightBtnStyle;
  445. scrollRightBtnStyle.normal.texture = getGUITexture(ScrollBarRightNormalTex);
  446. scrollRightBtnStyle.hover.texture = getGUITexture(ScrollBarRightHoverTex);
  447. scrollRightBtnStyle.active.texture = getGUITexture(ScrollBarRightActiveTex);
  448. scrollRightBtnStyle.fixedHeight = true;
  449. scrollRightBtnStyle.fixedWidth = true;
  450. scrollRightBtnStyle.height = 8;
  451. scrollRightBtnStyle.width = 4;
  452. skin->setStyle("ScrollRightBtn", scrollRightBtnStyle);
  453. // Horizontal handle
  454. GUIElementStyle scrollBarHorzBtnStyle;
  455. scrollBarHorzBtnStyle.normal.texture = getGUITexture(ScrollBarHandleHorzNormalTex);
  456. scrollBarHorzBtnStyle.hover.texture = getGUITexture(ScrollBarHandleHorzHoverTex);
  457. scrollBarHorzBtnStyle.active.texture = getGUITexture(ScrollBarHandleHorzActiveTex);
  458. scrollBarHorzBtnStyle.fixedHeight = true;
  459. scrollBarHorzBtnStyle.fixedWidth = true;
  460. scrollBarHorzBtnStyle.height = 6;
  461. scrollBarHorzBtnStyle.width = 4;
  462. skin->setStyle("ScrollBarHorzBtn", scrollBarHorzBtnStyle);
  463. // Vertical handle
  464. GUIElementStyle scrollBarVertBtnStyle;
  465. scrollBarVertBtnStyle.normal.texture = getGUITexture(ScrollBarHandleVertNormalTex);
  466. scrollBarVertBtnStyle.hover.texture = getGUITexture(ScrollBarHandleVertHoverTex);
  467. scrollBarVertBtnStyle.active.texture = getGUITexture(ScrollBarHandleVertActiveTex);
  468. scrollBarVertBtnStyle.fixedHeight = true;
  469. scrollBarVertBtnStyle.fixedWidth = true;
  470. scrollBarVertBtnStyle.height = 4;
  471. scrollBarVertBtnStyle.width = 6;
  472. skin->setStyle("ScrollBarVertBtn", scrollBarVertBtnStyle);
  473. HSpriteTexture scrollBarBgPtr = getGUITexture(ScrollBarBgTex);
  474. // Vertical scroll bar
  475. GUIElementStyle vertScrollBarStyle;
  476. vertScrollBarStyle.normal.texture = scrollBarBgPtr;
  477. vertScrollBarStyle.hover.texture = scrollBarBgPtr;
  478. vertScrollBarStyle.active.texture = scrollBarBgPtr;
  479. vertScrollBarStyle.fixedHeight = false;
  480. vertScrollBarStyle.fixedWidth = true;
  481. vertScrollBarStyle.minHeight = 16;
  482. vertScrollBarStyle.width = 8;
  483. skin->setStyle("ScrollBarVert", vertScrollBarStyle);
  484. // Horizontal scroll bar
  485. GUIElementStyle horzScrollBarStyle;
  486. horzScrollBarStyle.normal.texture = scrollBarBgPtr;
  487. horzScrollBarStyle.hover.texture = scrollBarBgPtr;
  488. horzScrollBarStyle.active.texture = scrollBarBgPtr;
  489. horzScrollBarStyle.fixedHeight = true;
  490. horzScrollBarStyle.fixedWidth = false;
  491. horzScrollBarStyle.minWidth = 16;
  492. horzScrollBarStyle.height = 8;
  493. skin->setStyle("ScrollBarHorz", horzScrollBarStyle);
  494. /************************************************************************/
  495. /* DROP DOWN BOX */
  496. /************************************************************************/
  497. // ListBox button
  498. GUIElementStyle dropDownListStyle;
  499. dropDownListStyle.normal.texture = getGUITexture(DropDownBtnNormalTex);
  500. dropDownListStyle.hover.texture = getGUITexture(DropDownBtnHoverTex);
  501. dropDownListStyle.active.texture = dropDownListStyle.hover.texture;
  502. dropDownListStyle.normalOn.texture = dropDownListStyle.hover.texture;
  503. dropDownListStyle.hoverOn.texture = dropDownListStyle.hover.texture;
  504. dropDownListStyle.activeOn.texture = dropDownListStyle.hover.texture;
  505. dropDownListStyle.fixedHeight = true;
  506. dropDownListStyle.fixedWidth = false;
  507. dropDownListStyle.height = 13;
  508. dropDownListStyle.width = 30;
  509. dropDownListStyle.contentOffset.left = 3;
  510. dropDownListStyle.contentOffset.right = 11;
  511. dropDownListStyle.contentOffset.top = 1;
  512. dropDownListStyle.contentOffset.bottom = 1;
  513. dropDownListStyle.border.left = 1;
  514. dropDownListStyle.border.right = 10;
  515. dropDownListStyle.border.top = 1;
  516. dropDownListStyle.border.bottom = 1;
  517. dropDownListStyle.font = font;
  518. dropDownListStyle.fontSize = DefaultFontSize;
  519. dropDownListStyle.textHorzAlign = THA_Left;
  520. dropDownListStyle.textVertAlign = TVA_Top;
  521. skin->setStyle("ListBox", dropDownListStyle);
  522. // DropDown scroll up button arrow
  523. HSpriteTexture dropDownBtnScrollUpArrow = getGUITexture(DropDownBoxBtnUpArrowTex);
  524. GUIElementStyle dropDownScrollUpBtnArrowStyle;
  525. dropDownScrollUpBtnArrowStyle.normal.texture = getGUITexture(DropDownBoxBtnUpArrowTex);
  526. dropDownScrollUpBtnArrowStyle.hover.texture = dropDownScrollUpBtnArrowStyle.normal.texture;
  527. dropDownScrollUpBtnArrowStyle.active.texture = dropDownScrollUpBtnArrowStyle.hover.texture;
  528. dropDownScrollUpBtnArrowStyle.fixedHeight = true;
  529. dropDownScrollUpBtnArrowStyle.fixedWidth = false;
  530. dropDownScrollUpBtnArrowStyle.height = 7;
  531. dropDownScrollUpBtnArrowStyle.width = 30;
  532. dropDownScrollUpBtnArrowStyle.border.left = 1;
  533. dropDownScrollUpBtnArrowStyle.border.right = 1;
  534. dropDownScrollUpBtnArrowStyle.border.top = 1;
  535. dropDownScrollUpBtnArrowStyle.border.bottom = 1;
  536. skin->setStyle("ListBoxScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
  537. skin->setStyle("MenuBarScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
  538. skin->setStyle("ContextMenuScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
  539. // DropDown scroll up button
  540. GUIElementStyle dropDownScrollUpBtnStyle;
  541. dropDownScrollUpBtnStyle.normal.texture = getGUITexture(DropDownBoxBtnUpNormalTex);
  542. dropDownScrollUpBtnStyle.hover.texture = getGUITexture(DropDownBoxBtnUpHoverTex);
  543. dropDownScrollUpBtnStyle.active.texture = dropDownScrollUpBtnStyle.hover.texture;
  544. dropDownScrollUpBtnStyle.fixedHeight = true;
  545. dropDownScrollUpBtnStyle.fixedWidth = false;
  546. dropDownScrollUpBtnStyle.height = 7;
  547. dropDownScrollUpBtnStyle.width = 30;
  548. dropDownScrollUpBtnStyle.border.left = 1;
  549. dropDownScrollUpBtnStyle.border.right = 1;
  550. dropDownScrollUpBtnStyle.border.top = 1;
  551. dropDownScrollUpBtnStyle.border.bottom = 1;
  552. skin->setStyle("ListBoxScrollUpBtn", dropDownScrollUpBtnStyle);
  553. skin->setStyle("MenuBarScrollUpBtn", dropDownScrollUpBtnStyle);
  554. skin->setStyle("ContextMenuScrollUpBtn", dropDownScrollUpBtnStyle);
  555. // DropDown scroll down button arrow
  556. GUIElementStyle dropDownScrollDownBtnArrowStyle;
  557. dropDownScrollDownBtnArrowStyle.normal.texture = getGUITexture(DropDownBoxBtnDownArrowTex);
  558. dropDownScrollDownBtnArrowStyle.hover.texture = dropDownScrollDownBtnArrowStyle.normal.texture;
  559. dropDownScrollDownBtnArrowStyle.active.texture = dropDownScrollDownBtnArrowStyle.hover.texture;
  560. dropDownScrollDownBtnArrowStyle.fixedHeight = true;
  561. dropDownScrollDownBtnArrowStyle.fixedWidth = false;
  562. dropDownScrollDownBtnArrowStyle.height = 7;
  563. dropDownScrollDownBtnArrowStyle.width = 30;
  564. dropDownScrollDownBtnArrowStyle.border.left = 1;
  565. dropDownScrollDownBtnArrowStyle.border.right = 1;
  566. dropDownScrollDownBtnArrowStyle.border.top = 1;
  567. dropDownScrollDownBtnArrowStyle.border.bottom = 1;
  568. skin->setStyle("ListBoxScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
  569. skin->setStyle("MenuBarScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
  570. skin->setStyle("ContextMenuScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
  571. // DropDown scroll down button
  572. GUIElementStyle dropDownScrollDownBtnStyle;
  573. dropDownScrollDownBtnStyle.normal.texture = getGUITexture(DropDownBoxBtnDownNormalTex);
  574. dropDownScrollDownBtnStyle.hover.texture = getGUITexture(DropDownBoxBtnDownHoverTex);
  575. dropDownScrollDownBtnStyle.active.texture = dropDownScrollDownBtnStyle.hover.texture;
  576. dropDownScrollDownBtnStyle.fixedHeight = true;
  577. dropDownScrollDownBtnStyle.fixedWidth = false;
  578. dropDownScrollDownBtnStyle.height = 7;
  579. dropDownScrollDownBtnStyle.width = 30;
  580. dropDownScrollDownBtnStyle.border.left = 1;
  581. dropDownScrollDownBtnStyle.border.right = 1;
  582. dropDownScrollDownBtnStyle.border.top = 1;
  583. dropDownScrollDownBtnStyle.border.bottom = 1;
  584. skin->setStyle("ListBoxScrollDownBtn", dropDownScrollDownBtnStyle);
  585. skin->setStyle("MenuBarScrollDownBtn", dropDownScrollDownBtnStyle);
  586. skin->setStyle("ContextMenuScrollDownBtn", dropDownScrollDownBtnStyle);
  587. // DropDown entry button
  588. GUIElementStyle dropDownEntryBtnStyle;
  589. dropDownEntryBtnStyle.normal.texture = getGUITexture(DropDownBoxEntryNormalTex);
  590. dropDownEntryBtnStyle.hover.texture = getGUITexture(DropDownBoxEntryHoverTex);
  591. dropDownEntryBtnStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
  592. dropDownEntryBtnStyle.normalOn.texture = dropDownEntryBtnStyle.hover.texture;
  593. dropDownEntryBtnStyle.hoverOn.texture = dropDownEntryBtnStyle.hover.texture;
  594. dropDownEntryBtnStyle.activeOn.texture = dropDownEntryBtnStyle.hover.texture;
  595. dropDownEntryBtnStyle.fixedHeight = true;
  596. dropDownEntryBtnStyle.fixedWidth = false;
  597. dropDownEntryBtnStyle.height = 14;
  598. dropDownEntryBtnStyle.width = 30;
  599. dropDownEntryBtnStyle.border.left = 1;
  600. dropDownEntryBtnStyle.border.right = 1;
  601. dropDownEntryBtnStyle.border.top = 1;
  602. dropDownEntryBtnStyle.border.bottom = 1;
  603. dropDownEntryBtnStyle.font = font;
  604. dropDownEntryBtnStyle.fontSize = DefaultFontSize;
  605. dropDownEntryBtnStyle.textHorzAlign = THA_Left;
  606. dropDownEntryBtnStyle.textVertAlign = TVA_Top;
  607. skin->setStyle(GUIDropDownContent::ENTRY_STYLE_TYPE, dropDownEntryBtnStyle);
  608. // DropDown entry button with expand
  609. GUIElementStyle dropDownEntryExpBtnStyle;
  610. dropDownEntryExpBtnStyle.normal.texture = getGUITexture(DropDownBoxEntryExpNormalTex);
  611. dropDownEntryExpBtnStyle.hover.texture = getGUITexture(DropDownBoxEntryExpHoverTex);
  612. dropDownEntryExpBtnStyle.active.texture = dropDownEntryExpBtnStyle.hover.texture;
  613. dropDownEntryExpBtnStyle.normalOn.texture = dropDownEntryExpBtnStyle.hover.texture;
  614. dropDownEntryExpBtnStyle.hoverOn.texture = dropDownEntryExpBtnStyle.hover.texture;
  615. dropDownEntryExpBtnStyle.activeOn.texture = dropDownEntryExpBtnStyle.hover.texture;
  616. dropDownEntryExpBtnStyle.fixedHeight = true;
  617. dropDownEntryExpBtnStyle.fixedWidth = false;
  618. dropDownEntryExpBtnStyle.height = 14;
  619. dropDownEntryExpBtnStyle.width = 30;
  620. dropDownEntryExpBtnStyle.border.left = 1;
  621. dropDownEntryExpBtnStyle.border.right = 6;
  622. dropDownEntryExpBtnStyle.border.top = 1;
  623. dropDownEntryExpBtnStyle.border.bottom = 1;
  624. dropDownEntryExpBtnStyle.font = font;
  625. dropDownEntryExpBtnStyle.fontSize = DefaultFontSize;
  626. dropDownEntryExpBtnStyle.textHorzAlign = THA_Left;
  627. dropDownEntryExpBtnStyle.textVertAlign = TVA_Top;
  628. skin->setStyle(GUIDropDownContent::ENTRY_EXP_STYLE_TYPE, dropDownEntryExpBtnStyle);
  629. // Drop down separator
  630. GUIElementStyle dropDownSeparatorStyle;
  631. dropDownSeparatorStyle.normal.texture = getGUITexture(DropDownSeparatorTex);
  632. dropDownSeparatorStyle.fixedHeight = true;
  633. dropDownSeparatorStyle.fixedWidth = false;
  634. dropDownSeparatorStyle.height = 3;
  635. dropDownSeparatorStyle.width = 30;
  636. dropDownSeparatorStyle.border.left = 1;
  637. dropDownSeparatorStyle.border.right = 1;
  638. dropDownSeparatorStyle.border.top = 1;
  639. dropDownSeparatorStyle.border.bottom = 1;
  640. skin->setStyle(GUIDropDownContent::SEPARATOR_STYLE_TYPE, dropDownSeparatorStyle);
  641. // Drop down content
  642. GUIElementStyle dropDownContentStyle;
  643. dropDownContentStyle.minWidth = 50;
  644. dropDownContentStyle.minHeight = 20;
  645. dropDownContentStyle.subStyles[GUIDropDownContent::ENTRY_STYLE_TYPE] = GUIDropDownContent::ENTRY_STYLE_TYPE;
  646. dropDownContentStyle.subStyles[GUIDropDownContent::ENTRY_EXP_STYLE_TYPE] = GUIDropDownContent::ENTRY_EXP_STYLE_TYPE;
  647. dropDownContentStyle.subStyles[GUIDropDownContent::SEPARATOR_STYLE_TYPE] = GUIDropDownContent::SEPARATOR_STYLE_TYPE;
  648. skin->setStyle("ListBoxContent", dropDownContentStyle);
  649. skin->setStyle("MenuBarContent", dropDownContentStyle);
  650. skin->setStyle("ContextMenuContent", dropDownContentStyle);
  651. // DropDown box frame
  652. GUIElementStyle dropDownBoxStyle;
  653. dropDownBoxStyle.normal.texture = getGUITexture(DropDownBoxBgTex);
  654. dropDownBoxStyle.hover.texture = dropDownEntryBtnStyle.normal.texture;
  655. dropDownBoxStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
  656. dropDownBoxStyle.fixedHeight = false;
  657. dropDownBoxStyle.fixedWidth = false;
  658. dropDownBoxStyle.border.left = 1;
  659. dropDownBoxStyle.border.right = 1;
  660. dropDownBoxStyle.border.top = 1;
  661. dropDownBoxStyle.border.bottom = 1;
  662. dropDownBoxStyle.margins.left = 1;
  663. dropDownBoxStyle.margins.right = 1;
  664. dropDownBoxStyle.margins.top = 1;
  665. dropDownBoxStyle.margins.bottom = 1;
  666. skin->setStyle("ListBoxFrame", dropDownBoxStyle);
  667. skin->setStyle("MenuBarFrame", dropDownBoxStyle);
  668. skin->setStyle("ContextMenuFrame", dropDownBoxStyle);
  669. /************************************************************************/
  670. /* MENU BAR */
  671. /************************************************************************/
  672. // MenuBar background
  673. GUIElementStyle menuBarBgStyle;
  674. menuBarBgStyle.normal.texture = getGUITexture(MenuBarBgTex);
  675. menuBarBgStyle.fixedHeight = false;
  676. menuBarBgStyle.fixedWidth = false;
  677. menuBarBgStyle.height = 4;
  678. menuBarBgStyle.width = 4;
  679. skin->setStyle("MenuBarBg", menuBarBgStyle);
  680. // MenuBar Banshee logo
  681. GUIElementStyle menuBarBansheeLogoStyle;
  682. menuBarBansheeLogoStyle.normal.texture = getGUITexture(MenuBarBansheeLogoTex);
  683. menuBarBansheeLogoStyle.fixedHeight = true;
  684. menuBarBansheeLogoStyle.fixedWidth = true;
  685. menuBarBansheeLogoStyle.height = 7;
  686. menuBarBansheeLogoStyle.width = 51;
  687. skin->setStyle("MenuBarBansheeLogo", menuBarBansheeLogoStyle);
  688. // MenuBar button
  689. GUIElementStyle menuBarBtnStyle;
  690. menuBarBtnStyle.normal.texture = getGUITexture(MenuBarBtnNormalTex);
  691. menuBarBtnStyle.hover.texture = getGUITexture(MenuBarBtnHoverTex);
  692. menuBarBtnStyle.active.texture = menuBarBtnStyle.hover.texture;
  693. menuBarBtnStyle.normalOn.texture = menuBarBtnStyle.hover.texture;
  694. menuBarBtnStyle.hoverOn.texture = menuBarBtnStyle.hover.texture;
  695. menuBarBtnStyle.activeOn.texture = menuBarBtnStyle.hover.texture;
  696. menuBarBtnStyle.fixedHeight = true;
  697. menuBarBtnStyle.fixedWidth = false;
  698. menuBarBtnStyle.height = 15;
  699. menuBarBtnStyle.width = 4;
  700. menuBarBtnStyle.margins.left = 2;
  701. menuBarBtnStyle.margins.right = 2;
  702. menuBarBtnStyle.margins.top = 2;
  703. menuBarBtnStyle.margins.bottom = 2;
  704. menuBarBtnStyle.font = font;
  705. menuBarBtnStyle.fontSize = DefaultFontSize;
  706. menuBarBtnStyle.textHorzAlign = THA_Left;
  707. menuBarBtnStyle.textVertAlign = TVA_Top;
  708. skin->setStyle("MenuBarBtn", menuBarBtnStyle);
  709. /************************************************************************/
  710. /* DOCK SLIDER */
  711. /************************************************************************/
  712. GUIElementStyle dockSliderBtnStyle;
  713. dockSliderBtnStyle.normal.texture = getGUITexture(DockSliderNormalTex);
  714. dockSliderBtnStyle.fixedHeight = false;
  715. dockSliderBtnStyle.fixedWidth = false;
  716. dockSliderBtnStyle.height = 2;
  717. dockSliderBtnStyle.width = 2;
  718. skin->setStyle("DockSliderBtn", dockSliderBtnStyle);
  719. /************************************************************************/
  720. /* TREE VIEW */
  721. /************************************************************************/
  722. // Expand button
  723. GUIElementStyle treeViewExpandButtonStyle;
  724. treeViewExpandButtonStyle.normal.texture = getGUITexture(TreeViewExpandButtonOffNormal);
  725. treeViewExpandButtonStyle.hover.texture = getGUITexture(TreeViewExpandButtonOffHover);
  726. treeViewExpandButtonStyle.active.texture = treeViewExpandButtonStyle.hover.texture;
  727. treeViewExpandButtonStyle.normalOn.texture = getGUITexture(TreeViewExpandButtonOnNormal);
  728. treeViewExpandButtonStyle.hoverOn.texture = getGUITexture(TreeViewExpandButtonOnHover);
  729. treeViewExpandButtonStyle.activeOn.texture = treeViewExpandButtonStyle.hoverOn.texture;
  730. treeViewExpandButtonStyle.margins.left = 4;
  731. treeViewExpandButtonStyle.margins.right = 4;
  732. treeViewExpandButtonStyle.margins.top = 5;
  733. treeViewExpandButtonStyle.margins.bottom = 4;
  734. treeViewExpandButtonStyle.fixedHeight = true;
  735. treeViewExpandButtonStyle.fixedWidth = true;
  736. treeViewExpandButtonStyle.height = 16;
  737. treeViewExpandButtonStyle.width = 16;
  738. skin->setStyle("TreeViewFoldoutBtn", treeViewExpandButtonStyle);
  739. // Entry
  740. GUIElementStyle treeViewEntryStyle;
  741. treeViewEntryStyle.font = font;
  742. treeViewEntryStyle.fontSize = DefaultFontSize;
  743. treeViewEntryStyle.fixedWidth = false;
  744. treeViewEntryStyle.fixedHeight = true;
  745. treeViewEntryStyle.height = 16;
  746. treeViewEntryStyle.minWidth = 10;
  747. skin->setStyle("TreeViewElementBtn", treeViewEntryStyle);
  748. // Selection background
  749. GUIElementStyle treeViewSelBackgroundStyle;
  750. treeViewSelBackgroundStyle.normal.texture = getGUITexture(TreeViewSelectionBackground);
  751. treeViewSelBackgroundStyle.fixedHeight = false;
  752. treeViewSelBackgroundStyle.fixedWidth = false;
  753. treeViewSelBackgroundStyle.height = 2;
  754. treeViewSelBackgroundStyle.width = 2;
  755. skin->setStyle("TreeViewSelectionBackground", treeViewSelBackgroundStyle);
  756. // Edit box
  757. GUIElementStyle treeViewEditBox;
  758. treeViewEditBox.normal.texture = getGUITexture(TreeViewEditBox);
  759. treeViewEditBox.hover.texture = treeViewEditBox.normal.texture;
  760. treeViewEditBox.focused.texture = treeViewEditBox.normal.texture;
  761. treeViewEditBox.active.texture = treeViewEditBox.normal.texture;
  762. treeViewEditBox.border.left = 1;
  763. treeViewEditBox.border.right = 1;
  764. treeViewEditBox.border.top = 1;
  765. treeViewEditBox.border.bottom = 1;
  766. treeViewEditBox.margins.left = 1;
  767. treeViewEditBox.margins.right = 1;
  768. treeViewEditBox.margins.top = 1;
  769. treeViewEditBox.margins.bottom = 1;
  770. treeViewEditBox.fixedHeight = true;
  771. treeViewEditBox.height = 13;
  772. treeViewEditBox.minWidth = 10;
  773. treeViewEditBox.font = font;
  774. treeViewEditBox.fontSize = DefaultFontSize;
  775. treeViewEditBox.textHorzAlign = THA_Left;
  776. treeViewEditBox.textVertAlign = TVA_Top;
  777. skin->setStyle(GUITreeViewEditBox::getGUITypeName(), treeViewEditBox);
  778. // Element highlight
  779. GUIElementStyle treeViewElementHighlight;
  780. treeViewElementHighlight.normal.texture = getGUITexture(TreeViewElementHighlight);
  781. treeViewElementHighlight.border.left = 1;
  782. treeViewElementHighlight.border.right = 1;
  783. treeViewElementHighlight.border.top = 1;
  784. treeViewElementHighlight.border.bottom = 1;
  785. skin->setStyle("TreeViewElementHighlight", treeViewElementHighlight);
  786. // Element separator highlight
  787. GUIElementStyle treeViewElementSepHighlight;
  788. treeViewElementSepHighlight.normal.texture = getGUITexture(TreeViewElementSepHighlight);
  789. treeViewElementSepHighlight.border.left = 1;
  790. treeViewElementSepHighlight.border.right = 1;
  791. treeViewElementSepHighlight.border.top = 1;
  792. treeViewElementSepHighlight.border.bottom = 1;
  793. skin->setStyle("TreeViewElementSepHighlight", treeViewElementSepHighlight);
  794. /************************************************************************/
  795. /* OBJECT DROP FIELD */
  796. /************************************************************************/
  797. GUIElementStyle objectDropStyle;
  798. objectDropStyle.normal.texture = getGUITexture(ObjectDropBtnNormalTex);
  799. objectDropStyle.normalOn.texture = getGUITexture(ObjectDropBtnNormalOnTex);
  800. objectDropStyle.fixedHeight = true;
  801. objectDropStyle.height = 15;
  802. objectDropStyle.minWidth = 50;
  803. objectDropStyle.font = font;
  804. objectDropStyle.fontSize = DefaultFontSize;
  805. objectDropStyle.textHorzAlign = THA_Center;
  806. objectDropStyle.textVertAlign = TVA_Center;
  807. skin->setStyle(ObjectFieldDropBtnStyleName, objectDropStyle);
  808. GUIElementStyle objectClearBtnStyle;
  809. objectClearBtnStyle.normal.texture = getGUITexture(ObjectClearBtnNormalTex);
  810. objectClearBtnStyle.hover.texture = getGUITexture(ObjectClearBtnHoverTex);
  811. objectClearBtnStyle.active.texture = getGUITexture(ObjectClearBtnActiveTex);
  812. objectClearBtnStyle.fixedHeight = true;
  813. objectClearBtnStyle.fixedWidth = true;
  814. objectClearBtnStyle.height = 15;
  815. objectClearBtnStyle.width = 13;
  816. skin->setStyle(ObjectFieldClearBtnStyleName, objectClearBtnStyle);
  817. GUIElementStyle editorObjectFieldStyle;
  818. editorObjectFieldStyle.fixedHeight = true;
  819. editorObjectFieldStyle.height = 15;
  820. editorObjectFieldStyle.minWidth = 30;
  821. editorObjectFieldStyle.subStyles[ObjectFieldLabelStyleName] = GUITextField::getLabelStyleType();
  822. editorObjectFieldStyle.subStyles[ObjectFieldDropBtnStyleName] = ObjectFieldDropBtnStyleName;
  823. editorObjectFieldStyle.subStyles[ObjectFieldClearBtnStyleName] = ObjectFieldClearBtnStyleName;
  824. skin->setStyle(ObjectFieldStyleName, editorObjectFieldStyle);
  825. /************************************************************************/
  826. /* EDITOR FIELDS */
  827. /************************************************************************/
  828. GUIElementStyle editorFieldLabelStyle;
  829. editorFieldLabelStyle.font = font;
  830. editorFieldLabelStyle.fontSize = DefaultFontSize;
  831. editorFieldLabelStyle.fixedWidth = false;
  832. editorFieldLabelStyle.fixedHeight = true;
  833. editorFieldLabelStyle.height = 11;
  834. editorFieldLabelStyle.minWidth = 10;
  835. editorFieldLabelStyle.textHorzAlign = THA_Left;
  836. skin->setStyle(GUITextField::getLabelStyleType(), editorFieldLabelStyle);
  837. GUIElementStyle editorIntFieldStyle;
  838. editorIntFieldStyle.fixedHeight = true;
  839. editorIntFieldStyle.height = 15;
  840. editorIntFieldStyle.minWidth = 30;
  841. editorIntFieldStyle.subStyles[GUIIntField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  842. editorIntFieldStyle.subStyles[GUIIntField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  843. skin->setStyle(GUIIntField::getGUITypeName(), editorIntFieldStyle);
  844. GUIElementStyle editorFloatFieldStyle;
  845. editorFloatFieldStyle.fixedHeight = true;
  846. editorFloatFieldStyle.height = 15;
  847. editorFloatFieldStyle.minWidth = 30;
  848. editorFloatFieldStyle.subStyles[GUIFloatField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  849. editorFloatFieldStyle.subStyles[GUIFloatField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  850. skin->setStyle(GUIFloatField::getGUITypeName(), editorFloatFieldStyle);
  851. GUIElementStyle editorTextFieldStyle;
  852. editorTextFieldStyle.fixedHeight = true;
  853. editorTextFieldStyle.height = 15;
  854. editorTextFieldStyle.minWidth = 30;
  855. editorTextFieldStyle.subStyles[GUITextField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  856. editorTextFieldStyle.subStyles[GUITextField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  857. skin->setStyle(GUITextField::getGUITypeName(), editorTextFieldStyle);
  858. GUIElementStyle editorColorFieldStyle;
  859. editorColorFieldStyle.fixedHeight = true;
  860. editorColorFieldStyle.height = 15;
  861. editorColorFieldStyle.minWidth = 30;
  862. editorColorFieldStyle.subStyles[GUIColorField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  863. editorColorFieldStyle.subStyles[GUIColorField::getColorInputStyleType()] = GUIColor::getGUITypeName();
  864. skin->setStyle(GUIColorField::getGUITypeName(), editorColorFieldStyle);
  865. GUIElementStyle editorToggleFieldStyle;
  866. editorToggleFieldStyle.fixedHeight = true;
  867. editorToggleFieldStyle.height = 15;
  868. editorToggleFieldStyle.minWidth = 30;
  869. editorToggleFieldStyle.subStyles[GUIToggleField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  870. editorToggleFieldStyle.subStyles[GUIToggleField::getToggleStyleType()] = GUIToggle::getGUITypeName();
  871. skin->setStyle(GUIToggleField::getGUITypeName(), editorToggleFieldStyle);
  872. GUIElementStyle editorVector2FieldStyle;
  873. editorVector2FieldStyle.fixedHeight = true;
  874. editorVector2FieldStyle.height = 30;
  875. editorVector2FieldStyle.minWidth = 30;
  876. editorVector2FieldStyle.subStyles[GUIVector2Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  877. editorVector2FieldStyle.subStyles[GUIVector2Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  878. skin->setStyle(GUIVector2Field::getGUITypeName(), editorVector2FieldStyle);
  879. GUIElementStyle editorVector3FieldStyle;
  880. editorVector3FieldStyle.fixedHeight = true;
  881. editorVector3FieldStyle.height = 30;
  882. editorVector3FieldStyle.minWidth = 30;
  883. editorVector3FieldStyle.subStyles[GUIVector3Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  884. editorVector3FieldStyle.subStyles[GUIVector3Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  885. skin->setStyle(GUIVector3Field::getGUITypeName(), editorVector3FieldStyle);
  886. GUIElementStyle editorVector4FieldStyle;
  887. editorVector4FieldStyle.fixedHeight = true;
  888. editorVector4FieldStyle.height = 30;
  889. editorVector4FieldStyle.minWidth = 30;
  890. editorVector4FieldStyle.subStyles[GUIVector4Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  891. editorVector4FieldStyle.subStyles[GUIVector4Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  892. skin->setStyle(GUIVector4Field::getGUITypeName(), editorVector4FieldStyle);
  893. /************************************************************************/
  894. /* COMPONENT FOLDOUT */
  895. /************************************************************************/
  896. GUIElementStyle cmpFoldoutBtnStyle;
  897. cmpFoldoutBtnStyle.normal.texture = getGUITexture(CmpFoldoutClosedNormalTex);
  898. cmpFoldoutBtnStyle.hover.texture = getGUITexture(CmpFoldoutClosedHoverTex);
  899. cmpFoldoutBtnStyle.active.texture = getGUITexture(CmpFoldoutOpenActiveTex);
  900. cmpFoldoutBtnStyle.normalOn.texture = getGUITexture(CmpFoldoutOpenNormalTex);
  901. cmpFoldoutBtnStyle.hoverOn.texture = getGUITexture(CmpFoldoutOpenHoverTex);
  902. cmpFoldoutBtnStyle.activeOn.texture = getGUITexture(CmpFoldoutOpenActiveTex);
  903. cmpFoldoutBtnStyle.fixedHeight = true;
  904. cmpFoldoutBtnStyle.fixedWidth = false;
  905. cmpFoldoutBtnStyle.height = 10;
  906. cmpFoldoutBtnStyle.minWidth = 10;
  907. cmpFoldoutBtnStyle.font = font;
  908. cmpFoldoutBtnStyle.fontSize = DefaultFontSize;
  909. cmpFoldoutBtnStyle.textHorzAlign = THA_Left;
  910. cmpFoldoutBtnStyle.textVertAlign = TVA_Center;
  911. cmpFoldoutBtnStyle.contentOffset = RectOffset(12, 0, 0, 0);
  912. cmpFoldoutBtnStyle.border.left = 8;
  913. skin->setStyle(GUIComponentFoldout::getFoldoutButtonStyleType(), cmpFoldoutBtnStyle);
  914. GUIElementStyle cmpFoldoutStyle;
  915. cmpFoldoutStyle.fixedHeight = true;
  916. cmpFoldoutStyle.height = 12;
  917. cmpFoldoutStyle.minWidth = 30;
  918. cmpFoldoutStyle.subStyles[GUIComponentFoldout::getFoldoutButtonStyleType()] = GUIComponentFoldout::getFoldoutButtonStyleType();
  919. skin->setStyle(GUIComponentFoldout::getGUITypeName(), cmpFoldoutStyle);
  920. /************************************************************************/
  921. /* FOLDOUT */
  922. /************************************************************************/
  923. GUIElementStyle foldoutBtnStyle;
  924. foldoutBtnStyle.normal.texture = getGUITexture(FoldoutClosedNormalTex);
  925. foldoutBtnStyle.hover.texture = getGUITexture(FoldoutClosedHoverTex);
  926. foldoutBtnStyle.active.texture = foldoutBtnStyle.hover.texture;
  927. foldoutBtnStyle.normalOn.texture = getGUITexture(FoldoutOpenNormalTex);
  928. foldoutBtnStyle.hoverOn.texture = getGUITexture(FoldoutOpenHoverTex);
  929. foldoutBtnStyle.activeOn.texture = foldoutBtnStyle.hoverOn.texture;
  930. foldoutBtnStyle.fixedHeight = true;
  931. foldoutBtnStyle.fixedWidth = true;
  932. foldoutBtnStyle.height = 10;
  933. foldoutBtnStyle.width = 8;
  934. skin->setStyle(GUIFoldout::getFoldoutButtonStyleType(), foldoutBtnStyle);
  935. GUIElementStyle foldoutStyle;
  936. foldoutStyle.fixedHeight = true;
  937. foldoutStyle.height = 12;
  938. foldoutStyle.minWidth = 30;
  939. foldoutStyle.subStyles[GUIFoldout::getLabelStyleType()] = GUIFoldout::getLabelStyleType();
  940. foldoutStyle.subStyles[GUIFoldout::getFoldoutButtonStyleType()] = GUIFoldout::getFoldoutButtonStyleType();
  941. skin->setStyle(GUIFoldout::getGUITypeName(), foldoutStyle);
  942. /************************************************************************/
  943. /* PROGRESS BAR */
  944. /************************************************************************/
  945. GUIElementStyle progressBarBgStyle;
  946. progressBarBgStyle.fixedHeight = true;
  947. progressBarBgStyle.height = 18;
  948. progressBarBgStyle.normal.texture = getGUITexture(ProgressBarBgTex);
  949. skin->setStyle(GUIProgressBar::getBackgroundStyleType(), progressBarBgStyle);
  950. GUIElementStyle progressBarFillStyle;
  951. progressBarFillStyle.fixedHeight = true;
  952. progressBarFillStyle.height = 12;
  953. progressBarFillStyle.normal.texture = getGUITexture(ProgressBarFillTex);
  954. skin->setStyle(GUIProgressBar::getBarStyleType(), progressBarFillStyle);
  955. GUIElementStyle progressBarStyle;
  956. progressBarStyle.fixedHeight = true;
  957. progressBarStyle.height = 18;
  958. progressBarStyle.minWidth = 100;
  959. progressBarStyle.margins.top = 3;
  960. progressBarStyle.margins.bottom = 3;
  961. progressBarStyle.subStyles[GUIProgressBar::getBarStyleType()] = GUIProgressBar::getBarStyleType();
  962. progressBarStyle.subStyles[GUIProgressBar::getBackgroundStyleType()] = GUIProgressBar::getBackgroundStyleType();
  963. skin->setStyle(GUIProgressBar::getGUITypeName(), progressBarStyle);
  964. /************************************************************************/
  965. /* COLOR PICKER SLIDER */
  966. /************************************************************************/
  967. GUIElementStyle colorPickerSliderHorzHandleStyle;
  968. colorPickerSliderHorzHandleStyle.fixedHeight = true;
  969. colorPickerSliderHorzHandleStyle.fixedWidth = true;
  970. colorPickerSliderHorzHandleStyle.height = 20;
  971. colorPickerSliderHorzHandleStyle.width = 7;
  972. colorPickerSliderHorzHandleStyle.normal.texture = getGUITexture(ColorPickerSliderHorzHandleTex);
  973. colorPickerSliderHorzHandleStyle.hover.texture = colorPickerSliderHorzHandleStyle.normal.texture;
  974. colorPickerSliderHorzHandleStyle.active.texture = colorPickerSliderHorzHandleStyle.normal.texture;
  975. skin->setStyle("ColorSliderHorzHandle", colorPickerSliderHorzHandleStyle);
  976. GUIElementStyle colorPickerSliderHorzStyle;
  977. colorPickerSliderHorzHandleStyle.fixedHeight = true;
  978. colorPickerSliderHorzHandleStyle.height = 32;
  979. colorPickerSliderHorzHandleStyle.minWidth = 20;
  980. colorPickerSliderHorzStyle.subStyles[GUISlider::getHandleStyleType()] = "ColorSliderHorzHandle";
  981. skin->setStyle("ColorSliderHorz", colorPickerSliderHorzStyle);
  982. GUIElementStyle colorPickerSliderVertHandleStyle;
  983. colorPickerSliderVertHandleStyle.fixedHeight = true;
  984. colorPickerSliderVertHandleStyle.fixedWidth = true;
  985. colorPickerSliderVertHandleStyle.height = 7;
  986. colorPickerSliderVertHandleStyle.width = 45;
  987. colorPickerSliderVertHandleStyle.normal.texture = getGUITexture(ColorPickerSliderVertHandleTex);
  988. colorPickerSliderVertHandleStyle.hover.texture = colorPickerSliderVertHandleStyle.normal.texture;
  989. colorPickerSliderVertHandleStyle.active.texture = colorPickerSliderVertHandleStyle.normal.texture;
  990. skin->setStyle("ColorSliderVertHandle", colorPickerSliderVertHandleStyle);
  991. GUIElementStyle colorPickerSliderVertStyle;
  992. colorPickerSliderVertStyle.fixedWidth = true;
  993. colorPickerSliderVertStyle.width = 30;
  994. colorPickerSliderVertStyle.minHeight = 20;
  995. colorPickerSliderVertStyle.subStyles[GUISlider::getHandleStyleType()] = "ColorSliderVertHandle";
  996. skin->setStyle("ColorSliderVert", colorPickerSliderVertStyle);
  997. GUIElementStyle colorPickerSlider2DHandleStyle;
  998. colorPickerSlider2DHandleStyle.fixedHeight = true;
  999. colorPickerSlider2DHandleStyle.fixedWidth = true;
  1000. colorPickerSlider2DHandleStyle.height = 8;
  1001. colorPickerSlider2DHandleStyle.width = 8;
  1002. colorPickerSlider2DHandleStyle.normal.texture = getGUITexture(ColorPickerSlider2DHandleTex);
  1003. colorPickerSlider2DHandleStyle.hover.texture = colorPickerSlider2DHandleStyle.normal.texture;
  1004. colorPickerSlider2DHandleStyle.active.texture = colorPickerSlider2DHandleStyle.normal.texture;
  1005. skin->setStyle("ColorSlider2DHandle", colorPickerSlider2DHandleStyle);
  1006. /************************************************************************/
  1007. /* OTHER */
  1008. /************************************************************************/
  1009. // Right-aligned label
  1010. GUIElementStyle rightAlignedLabelStyle;
  1011. rightAlignedLabelStyle.font = font;
  1012. rightAlignedLabelStyle.fontSize = DefaultFontSize;
  1013. rightAlignedLabelStyle.fixedWidth = false;
  1014. rightAlignedLabelStyle.fixedHeight = true;
  1015. rightAlignedLabelStyle.height = 11;
  1016. rightAlignedLabelStyle.minWidth = 10;
  1017. rightAlignedLabelStyle.textHorzAlign = THA_Right;
  1018. skin->setStyle("RightAlignedLabel", rightAlignedLabelStyle);
  1019. // Multi-line label
  1020. GUIElementStyle multiLinelabelStyle;
  1021. multiLinelabelStyle.font = font;
  1022. multiLinelabelStyle.fontSize = DefaultFontSize;
  1023. multiLinelabelStyle.fixedWidth = false;
  1024. multiLinelabelStyle.fixedHeight = true;
  1025. multiLinelabelStyle.height = 11;
  1026. multiLinelabelStyle.minWidth = 10;
  1027. multiLinelabelStyle.wordWrap = true;
  1028. skin->setStyle("MultiLineLabel", multiLinelabelStyle);
  1029. // Multi-line centered label
  1030. GUIElementStyle multiLineCenteredLabelStyle;
  1031. multiLineCenteredLabelStyle.font = font;
  1032. multiLineCenteredLabelStyle.fontSize = DefaultFontSize;
  1033. multiLineCenteredLabelStyle.fixedWidth = false;
  1034. multiLineCenteredLabelStyle.fixedHeight = true;
  1035. multiLineCenteredLabelStyle.height = 11;
  1036. multiLineCenteredLabelStyle.minWidth = 10;
  1037. multiLineCenteredLabelStyle.wordWrap = true;
  1038. multiLineCenteredLabelStyle.textHorzAlign = THA_Center;
  1039. skin->setStyle("MultiLineLabelCentered", multiLineCenteredLabelStyle);
  1040. // Selection area
  1041. GUIElementStyle selectionAreaStyle;
  1042. selectionAreaStyle.normal.texture = getGUITexture(SelectionAreaTex);
  1043. selectionAreaStyle.border.left = 1;
  1044. selectionAreaStyle.border.right = 1;
  1045. selectionAreaStyle.border.top = 1;
  1046. selectionAreaStyle.border.bottom = 1;
  1047. skin->setStyle("SelectionArea", selectionAreaStyle);
  1048. return skin;
  1049. }
  1050. HSpriteTexture BuiltinEditorResources::getGUITexture(const WString& name)
  1051. {
  1052. Path texturePath = FileSystem::getWorkingDirectoryPath();
  1053. texturePath.append(EditorSkinFolder);
  1054. texturePath.append(L"sprite_" + name + L".asset");
  1055. return Resources::instance().load<SpriteTexture>(texturePath);
  1056. }
  1057. HSpriteTexture BuiltinEditorResources::getGUIIcon(const WString& name)
  1058. {
  1059. Path texturePath = FileSystem::getWorkingDirectoryPath();
  1060. texturePath.append(EditorIconFolder);
  1061. texturePath.append(L"sprite_" + name + L".asset");
  1062. return Resources::instance().load<SpriteTexture>(texturePath);
  1063. }
  1064. HShader BuiltinEditorResources::getShader(const WString& name)
  1065. {
  1066. Path programPath = EditorShaderFolder;
  1067. programPath.append(name + L".asset");
  1068. return gResources().load<Shader>(programPath);
  1069. }
  1070. HMaterial BuiltinEditorResources::createDockDropOverlayMaterial() const
  1071. {
  1072. return Material::create(mShaderDockOverlay);
  1073. }
  1074. HMaterial BuiltinEditorResources::createSceneGridMaterial() const
  1075. {
  1076. return Material::create(mShaderSceneGrid);
  1077. }
  1078. HMaterial BuiltinEditorResources::createPicking(CullingMode cullMode) const
  1079. {
  1080. UINT32 modeIdx = (UINT32)cullMode;
  1081. return Material::create(mShaderPicking[modeIdx]);
  1082. }
  1083. HMaterial BuiltinEditorResources::createPickingAlpha(CullingMode cullMode) const
  1084. {
  1085. UINT32 modeIdx = (UINT32)cullMode;
  1086. return Material::create(mShaderPickingAlpha[modeIdx]);
  1087. }
  1088. HMaterial BuiltinEditorResources::createWireGizmoMat() const
  1089. {
  1090. return Material::create(mShaderGizmoWire);
  1091. }
  1092. HMaterial BuiltinEditorResources::createSolidGizmoMat() const
  1093. {
  1094. return Material::create(mShaderGizmoSolid);
  1095. }
  1096. HMaterial BuiltinEditorResources::createIconGizmoMat() const
  1097. {
  1098. return Material::create(mShaderGizmoIcon);
  1099. }
  1100. HMaterial BuiltinEditorResources::createGizmoPickingMat() const
  1101. {
  1102. return Material::create(mShaderGizmoPicking);
  1103. }
  1104. HMaterial BuiltinEditorResources::createAlphaGizmoPickingMat() const
  1105. {
  1106. return Material::create(mShaderGizmoAlphaPicking);
  1107. }
  1108. HMaterial BuiltinEditorResources::createWireHandleMat() const
  1109. {
  1110. return Material::create(mShaderHandleWire);
  1111. }
  1112. HMaterial BuiltinEditorResources::createSolidHandleMat() const
  1113. {
  1114. return Material::create(mShaderHandleSolid);
  1115. }
  1116. HMaterial BuiltinEditorResources::createSelectionMat() const
  1117. {
  1118. return Material::create(mShaderSelection);
  1119. }
  1120. HSpriteTexture BuiltinEditorResources::getLibraryIcon(ProjectIcon icon) const
  1121. {
  1122. switch (icon)
  1123. {
  1124. case ProjectIcon::Folder:
  1125. return getGUIIcon(FolderIconTex);
  1126. case ProjectIcon::Font:
  1127. return getGUIIcon(FontIconTex);
  1128. case ProjectIcon::Mesh:
  1129. return getGUIIcon(MeshIconTex);
  1130. case ProjectIcon::Texture:
  1131. return getGUIIcon(TextureIconTex);
  1132. case ProjectIcon::PlainText:
  1133. return getGUIIcon(PlainTextIconTex);
  1134. case ProjectIcon::ScriptCode:
  1135. return getGUIIcon(ScriptCodeIconTex);
  1136. case ProjectIcon::Shader:
  1137. return getGUIIcon(ShaderIconTex);
  1138. case ProjectIcon::ShaderInclude:
  1139. return getGUIIcon(ShaderIncludeIconTex);
  1140. case ProjectIcon::Material:
  1141. return getGUIIcon(MaterialIconTex);
  1142. case ProjectIcon::SpriteTexture:
  1143. return getGUIIcon(SpriteTextureIconTex);
  1144. }
  1145. return HSpriteTexture();
  1146. }
  1147. }