BsBuiltinEditorResources.cpp 68 KB

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