BsBuiltinEditorResources.cpp 66 KB

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