BsBuiltinEditorResources.cpp 63 KB

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