BsBuiltinEditorResources.cpp 67 KB

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