BsBuiltinEditorResources.cpp 68 KB

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