BsBuiltinEditorResources.cpp 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245
  1. #include "BsBuiltinEditorResources.h"
  2. #include "BsGUIElementStyle.h"
  3. #include "BsGUILabel.h"
  4. #include "BsGUIButton.h"
  5. #include "BsGUIInputBox.h"
  6. #include "BsGUIToggle.h"
  7. #include "BsGUIColor.h"
  8. #include "BsTextSprite.h"
  9. #include "BsSpriteTexture.h"
  10. #include "BsGUITreeViewEditBox.h"
  11. #include "BsGUIIntField.h"
  12. #include "BsGUIFloatField.h"
  13. #include "BsGUIColorField.h"
  14. #include "BsGUITextField.h"
  15. #include "BsGUIToggleField.h"
  16. #include "BsGUIVector2Field.h"
  17. #include "BsGUIVector3Field.h"
  18. #include "BsGUIVector4Field.h"
  19. #include "BsGUIComponentFoldout.h"
  20. #include "BsGUIFoldout.h"
  21. #include "BsFont.h"
  22. #include "BsFontImportOptions.h"
  23. #include "BsImporter.h"
  24. #include "BsGpuProgram.h"
  25. #include "BsShader.h"
  26. #include "BsTechnique.h"
  27. #include "BsPass.h"
  28. #include "BsMaterial.h"
  29. #include "BsBlendState.h"
  30. #include "BsDepthStencilState.h"
  31. #include "BsGpuProgramImportOptions.h"
  32. #include "BsResources.h"
  33. #include "BsRTTIType.h"
  34. #include "BsFileSystem.h"
  35. namespace BansheeEngine
  36. {
  37. const String BuiltinEditorResources::ObjectFieldStyleName = "GUIObjectField";
  38. const String BuiltinEditorResources::ObjectFieldLabelStyleName = "EditorFieldLabel";
  39. const String BuiltinEditorResources::ObjectFieldDropBtnStyleName = "DropButton";
  40. const String BuiltinEditorResources::ObjectFieldClearBtnStyleName = "ObjectClearButton";
  41. const Path BuiltinEditorResources::DefaultSkinFolderRaw = L"..\\..\\..\\..\\Data\\Raw\\Editor\\Skin\\";
  42. const Path BuiltinEditorResources::DefaultShaderFolderRaw = L"..\\..\\..\\..\\Data\\Raw\\Editor\\Shaders\\";
  43. const Path BuiltinEditorResources::DefaultSkinFolder = L"..\\..\\..\\..\\Data\\Editor\\Skin\\";
  44. const Path BuiltinEditorResources::DefaultShaderFolder = L"..\\..\\..\\..\\Data\\Editor\\Shaders\\";
  45. const WString BuiltinEditorResources::HLSL11ShaderSubFolder = L"HLSL11/";
  46. const WString BuiltinEditorResources::HLSL9ShaderSubFolder = L"HLSL9/";
  47. const WString BuiltinEditorResources::GLSLShaderSubFolder = L"GLSL/";
  48. const WString BuiltinEditorResources::DefaultFontFilename = L"arial.ttf";
  49. const UINT32 BuiltinEditorResources::DefaultFontSize = 10;
  50. const WString BuiltinEditorResources::WindowBackgroundTexture = L"WindowBgTile.psd";
  51. const WString BuiltinEditorResources::ButtonNormalTex = L"ButtonNormal.psd";
  52. const WString BuiltinEditorResources::ButtonHoverTex = L"ButtonHover.psd";
  53. const WString BuiltinEditorResources::ButtonActiveTex = L"ButtonActive.psd";
  54. const WString BuiltinEditorResources::ToggleNormalTex = L"ToggleNormal.psd";
  55. const WString BuiltinEditorResources::ToggleHoverTex = L"ToggleHover.psd";
  56. const WString BuiltinEditorResources::ToggleActiveTex = L"ToggleActive.psd";
  57. const WString BuiltinEditorResources::ToggleNormalOnTex = L"ToggleOnNormal.psd";
  58. const WString BuiltinEditorResources::ToggleHoverOnTex = L"ToggleOnHover.psd";
  59. const WString BuiltinEditorResources::ToggleActiveOnTex = L"ToggleOnActive.psd";
  60. const WString BuiltinEditorResources::ObjectDropBtnNormalTex = L"ObjectFieldDropNormal.psd";
  61. const WString BuiltinEditorResources::ObjectDropBtnNormalOnTex = L"ObjectFieldDropOnNormal.psd";
  62. const WString BuiltinEditorResources::ObjectClearBtnNormalTex = L"ObjectFieldBtnNormal.psd";
  63. const WString BuiltinEditorResources::ObjectClearBtnHoverTex = L"ObjectFieldBtnHover.psd";
  64. const WString BuiltinEditorResources::ObjectClearBtnActiveTex = L"ObjectFieldBtnActive.psd";
  65. const WString BuiltinEditorResources::FoldoutOpenNormalTex = L"FoldoutOpenNormal.psd";
  66. const WString BuiltinEditorResources::FoldoutOpenHoverTex = L"FoldoutOpenHover.psd";
  67. const WString BuiltinEditorResources::FoldoutClosedNormalTex = L"FoldoutClosedNormal.psd";
  68. const WString BuiltinEditorResources::FoldoutClosedHoverTex = L"FoldoutClosedHover.psd";
  69. const WString BuiltinEditorResources::CmpFoldoutOpenNormalTex = L"CmpFoldoutOpenNormal.psd";
  70. const WString BuiltinEditorResources::CmpFoldoutOpenHoverTex = L"CmpFoldoutOpenHover.psd";
  71. const WString BuiltinEditorResources::CmpFoldoutOpenActiveTex = L"CmpFoldoutOpenActive.psd";
  72. const WString BuiltinEditorResources::CmpFoldoutClosedNormalTex = L"CmpFoldoutClosedNormal.psd";
  73. const WString BuiltinEditorResources::CmpFoldoutClosedHoverTex = L"CmpFoldoutClosedHover.psd";
  74. const WString BuiltinEditorResources::CmpFoldoutClosedActiveTex = L"CmpFoldoutClosedActive.psd";
  75. const WString BuiltinEditorResources::WindowFrameNormal = L"WindowFrameNormal.psd";
  76. const WString BuiltinEditorResources::WindowFrameFocused = L"WindowFrameFocused.psd";
  77. const WString BuiltinEditorResources::WindowTitleBarBg = L"WindowTitleBarBg.psd";
  78. const WString BuiltinEditorResources::WindowCloseButtonNormal = L"WindowCloseBtnNormal.psd";
  79. const WString BuiltinEditorResources::WindowCloseButtonHover = L"WindowCloseBtnHover.psd";
  80. const WString BuiltinEditorResources::WindowMinButtonNormal = L"WindowMaxBtnNormal.psd";
  81. const WString BuiltinEditorResources::WindowMinButtonHover = L"WindowMaxBtnHover.psd";
  82. const WString BuiltinEditorResources::WindowMaxButtonNormal = L"WindowMinBtnNormal.psd";
  83. const WString BuiltinEditorResources::WindowMaxButtonHover = L"WindowMinBtnHover.psd";
  84. const WString BuiltinEditorResources::TabbedBarBtnNormal = L"TabbedButtonNormal.psd";
  85. const WString BuiltinEditorResources::TabbedBarBtnActive = L"TabbedButtonActive.psd";
  86. const WString BuiltinEditorResources::InputBoxNormalTex = L"InputBoxNormal.psd";
  87. const WString BuiltinEditorResources::InputBoxHoverTex = L"InputBoxHover.psd";
  88. const WString BuiltinEditorResources::InputBoxFocusedTex = L"InputBoxFocused.psd";
  89. const WString BuiltinEditorResources::ScrollBarUpNormalTex = L"ScrollBarUpNormal.psd";
  90. const WString BuiltinEditorResources::ScrollBarUpHoverTex = L"ScrollBarUpHover.psd";
  91. const WString BuiltinEditorResources::ScrollBarUpActiveTex = L"ScrollBarUpActive.psd";
  92. const WString BuiltinEditorResources::ScrollBarDownNormalTex = L"ScrollBarDownNormal.psd";
  93. const WString BuiltinEditorResources::ScrollBarDownHoverTex = L"ScrollBarDownHover.psd";
  94. const WString BuiltinEditorResources::ScrollBarDownActiveTex = L"ScrollBarDownActive.psd";
  95. const WString BuiltinEditorResources::ScrollBarLeftNormalTex = L"ScrollBarLeftNormal.psd";
  96. const WString BuiltinEditorResources::ScrollBarLeftHoverTex = L"ScrollBarLeftHover.psd";
  97. const WString BuiltinEditorResources::ScrollBarLeftActiveTex = L"ScrollBarLeftActive.psd";
  98. const WString BuiltinEditorResources::ScrollBarRightNormalTex = L"ScrollBarRightNormal.psd";
  99. const WString BuiltinEditorResources::ScrollBarRightHoverTex = L"ScrollBarRightHover.psd";
  100. const WString BuiltinEditorResources::ScrollBarRightActiveTex = L"ScrollBarRightActive.psd";
  101. const WString BuiltinEditorResources::ScrollBarHandleHorzNormalTex = L"ScrollBarHorzHandleNormal.psd";
  102. const WString BuiltinEditorResources::ScrollBarHandleHorzHoverTex = L"ScrollBarHorzHandleHover.psd";
  103. const WString BuiltinEditorResources::ScrollBarHandleHorzActiveTex = L"ScrollBarHorzHandleActive.psd";
  104. const WString BuiltinEditorResources::ScrollBarHandleVertNormalTex = L"ScrollBarVertHandleNormal.psd";
  105. const WString BuiltinEditorResources::ScrollBarHandleVertHoverTex = L"ScrollBarVertHandleHover.psd";
  106. const WString BuiltinEditorResources::ScrollBarHandleVertActiveTex = L"ScrollBarVertHandleActive.psd";
  107. const WString BuiltinEditorResources::DropDownBtnNormalTex = L"DropDownNormal.psd";
  108. const WString BuiltinEditorResources::DropDownBtnHoverTex = L"DropDownHover.psd";
  109. const WString BuiltinEditorResources::DropDownBoxBgTex = L"DropDownBoxBg.psd";
  110. const WString BuiltinEditorResources::DropDownBoxEntryNormalTex = L"DropDownButtonNormal.psd";
  111. const WString BuiltinEditorResources::DropDownBoxEntryHoverTex = L"DropDownButtonHover.psd";
  112. const WString BuiltinEditorResources::DropDownBoxBtnUpNormalTex = L"DropDownBoxBtnUpNormal.psd";
  113. const WString BuiltinEditorResources::DropDownBoxBtnUpHoverTex = L"DropDownBoxBtnUpHover.psd";
  114. const WString BuiltinEditorResources::DropDownBoxBtnDownNormalTex = L"DropDownBoxBtnDownNormal.psd";
  115. const WString BuiltinEditorResources::DropDownBoxBtnDownHoverTex = L"DropDownBoxBtnDownHover.psd";
  116. const WString BuiltinEditorResources::DropDownBoxEntryExpNormalTex = L"DropDownExpNormal.psd";
  117. const WString BuiltinEditorResources::DropDownBoxEntryExpHoverTex = L"DropDownExpHover.psd";
  118. const WString BuiltinEditorResources::DropDownSeparatorTex = L"DropDownSeparator.psd";
  119. const WString BuiltinEditorResources::DropDownBoxBtnUpArrowTex = L"DropDownBoxBtnUpArrow.psd";
  120. const WString BuiltinEditorResources::DropDownBoxBtnDownArrowTex = L"DropDownBoxBtnDownArrow.psd";
  121. const WString BuiltinEditorResources::ScrollBarBgTex = L"ScrollBarBg.psd";
  122. const WString BuiltinEditorResources::MenuBarBgTex = L"MenuBarBg.psd";
  123. const WString BuiltinEditorResources::MenuBarBtnNormalTex = L"MenuBarButtonNormal.psd";
  124. const WString BuiltinEditorResources::MenuBarBtnHoverTex = L"MenuBarButtonHover.psd";
  125. const WString BuiltinEditorResources::MenuBarBansheeLogoTex = L"MenuBarBansheeLogo.psd";
  126. const WString BuiltinEditorResources::DockSliderNormalTex = L"DockSliderBtn.psd";
  127. const WString BuiltinEditorResources::TreeViewExpandButtonOffNormal = L"TreeViewExpandButtonOffNormal.psd";
  128. const WString BuiltinEditorResources::TreeViewExpandButtonOffHover = L"TreeViewExpandButtonOffHover.psd";
  129. const WString BuiltinEditorResources::TreeViewExpandButtonOnNormal = L"TreeViewExpandButtonOnNormal.psd";
  130. const WString BuiltinEditorResources::TreeViewExpandButtonOnHover = L"TreeViewExpandButtonOnHover.psd";
  131. const WString BuiltinEditorResources::TreeViewSelectionBackground = L"TreeViewSelectionBackground.psd";
  132. const WString BuiltinEditorResources::TreeViewEditBox = L"TreeViewEditBox.psd";
  133. const WString BuiltinEditorResources::TreeViewElementHighlight = L"TreeViewElementHighlight.psd";
  134. const WString BuiltinEditorResources::TreeViewElementSepHighlight = L"TreeViewElementSepHighlight.psd";
  135. /************************************************************************/
  136. /* SHADERS */
  137. /************************************************************************/
  138. struct GpuProgramImportData
  139. {
  140. WString filename;
  141. String entryPoint;
  142. GpuProgramType type;
  143. GpuProgramProfile profile;
  144. String language;
  145. WString folder;
  146. };
  147. const WString BuiltinEditorResources::ShaderDockOverlayVSFile = L"dockDropOverlayVS.gpuprog";
  148. const WString BuiltinEditorResources::ShaderDockOverlayPSFile = L"dockDropOverlayPS.gpuprog";
  149. const WString BuiltinEditorResources::SceneGridVSFile = L"sceneGridVS.gpuprog";
  150. const WString BuiltinEditorResources::SceneGridPSFile = L"sceneGridPS.gpuprog";
  151. BuiltinEditorResources::BuiltinEditorResources(RenderSystemPlugin activeRSPlugin)
  152. :mRenderSystemPlugin(activeRSPlugin)
  153. {
  154. switch (activeRSPlugin)
  155. {
  156. case RenderSystemPlugin::DX11:
  157. mActiveShaderSubFolder = HLSL11ShaderSubFolder;
  158. mActiveRenderSystem = RenderSystemDX11;
  159. break;
  160. case RenderSystemPlugin::DX9:
  161. mActiveShaderSubFolder = HLSL9ShaderSubFolder;
  162. mActiveRenderSystem = RenderSystemDX9;
  163. break;
  164. case RenderSystemPlugin::OpenGL:
  165. mActiveShaderSubFolder = GLSLShaderSubFolder;
  166. mActiveRenderSystem = RenderSystemOpenGL;
  167. break;
  168. }
  169. preprocess();
  170. initDockDropOverlayShader();
  171. initSceneGridShader();
  172. Path fontPath = FileSystem::getWorkingDirectoryPath();
  173. fontPath.append(DefaultSkinFolder);
  174. fontPath.append(DefaultFontFilename + L".asset");
  175. HFont font = Resources::instance().load<Font>(fontPath);
  176. // Label
  177. GUIElementStyle labelStyle;
  178. labelStyle.font = font;
  179. labelStyle.fontSize = DefaultFontSize;
  180. labelStyle.fixedWidth = false;
  181. labelStyle.fixedHeight = true;
  182. labelStyle.height = 11;
  183. labelStyle.minWidth = 10;
  184. mSkin.setStyle(GUILabel::getGUITypeName(), labelStyle);
  185. // Window frame
  186. GUIElementStyle windowFrameStyle;
  187. windowFrameStyle.normal.texture = getGUITexture(WindowFrameNormal);
  188. windowFrameStyle.focused.texture = getGUITexture(WindowFrameFocused);
  189. windowFrameStyle.border.left = 1;
  190. windowFrameStyle.border.right = 1;
  191. windowFrameStyle.border.top = 1;
  192. windowFrameStyle.border.bottom = 1;
  193. mSkin.setStyle("WindowFrame", windowFrameStyle);
  194. // Button
  195. GUIElementStyle buttonStyle;
  196. buttonStyle.normal.texture = getGUITexture(ButtonNormalTex);
  197. buttonStyle.hover.texture = getGUITexture(ButtonHoverTex);
  198. buttonStyle.active.texture = getGUITexture(ButtonActiveTex);
  199. buttonStyle.border.left = 6;
  200. buttonStyle.border.right = 6;
  201. buttonStyle.border.top = 6;
  202. buttonStyle.border.bottom = 6;
  203. buttonStyle.contentOffset.left = 3;
  204. buttonStyle.contentOffset.right = 3;
  205. buttonStyle.fixedHeight = true;
  206. buttonStyle.height = 15;
  207. buttonStyle.minWidth = 50;
  208. buttonStyle.font = font;
  209. buttonStyle.fontSize = DefaultFontSize;
  210. buttonStyle.textHorzAlign = THA_Center;
  211. buttonStyle.textVertAlign = TVA_Center;
  212. mSkin.setStyle(GUIButton::getGUITypeName(), buttonStyle);
  213. // Toggle
  214. GUIElementStyle toggleStyle;
  215. toggleStyle.normal.texture = getGUITexture(ToggleNormalTex);
  216. toggleStyle.hover.texture = getGUITexture(ToggleHoverTex);
  217. toggleStyle.active.texture = getGUITexture(ToggleActiveTex);
  218. toggleStyle.normalOn.texture = getGUITexture(ToggleNormalOnTex);
  219. toggleStyle.hoverOn.texture = getGUITexture(ToggleHoverOnTex);
  220. toggleStyle.activeOn.texture = getGUITexture(ToggleActiveOnTex);
  221. toggleStyle.fixedHeight = true;
  222. toggleStyle.fixedWidth = true;
  223. toggleStyle.height = 15;
  224. toggleStyle.width = 15;
  225. mSkin.setStyle(GUIToggle::getGUITypeName(), toggleStyle);
  226. // Color
  227. GUIElementStyle colorStyle;
  228. colorStyle.margins.left = 2;
  229. colorStyle.margins.right = 2;
  230. colorStyle.margins.top = 2;
  231. colorStyle.margins.bottom = 2;
  232. colorStyle.fixedHeight = true;
  233. colorStyle.height = 10;
  234. colorStyle.minWidth = 10;
  235. mSkin.setStyle(GUIColor::getGUITypeName(), colorStyle);
  236. // Window background texture
  237. GUIElementStyle windowBgStyle;
  238. windowBgStyle.normal.texture = getGUITexture(WindowBackgroundTexture);
  239. mSkin.setStyle("WindowBackground", windowBgStyle);
  240. // Window title bar background
  241. GUIElementStyle titleBarBgStyle;
  242. titleBarBgStyle.normal.texture = getGUITexture(WindowTitleBarBg);
  243. titleBarBgStyle.fixedHeight = true;
  244. titleBarBgStyle.height = 13;
  245. mSkin.setStyle("TitleBarBackground", titleBarBgStyle);
  246. // Tabbed title bar tab button
  247. GUIElementStyle tabbedBarButton;
  248. tabbedBarButton.normal.texture = getGUITexture(TabbedBarBtnNormal);
  249. tabbedBarButton.hover.texture = getGUITexture(TabbedBarBtnActive);
  250. tabbedBarButton.active.texture = tabbedBarButton.hover.texture;
  251. tabbedBarButton.normalOn.texture = tabbedBarButton.hover.texture;
  252. tabbedBarButton.hoverOn.texture = tabbedBarButton.hover.texture;
  253. tabbedBarButton.activeOn.texture = tabbedBarButton.hover.texture;
  254. tabbedBarButton.fixedHeight = true;
  255. tabbedBarButton.height = 13;
  256. tabbedBarButton.minWidth = 10;
  257. tabbedBarButton.maxWidth = 110;
  258. tabbedBarButton.font = font;
  259. tabbedBarButton.fontSize = DefaultFontSize;
  260. tabbedBarButton.textHorzAlign = THA_Center;
  261. tabbedBarButton.textVertAlign = TVA_Center;
  262. mSkin.setStyle("TabbedBarBtn", tabbedBarButton);
  263. // Tabbed title bar drag/drop button
  264. GUIElementStyle tabbedBarDropButton;
  265. tabbedBarDropButton.fixedHeight = true;
  266. tabbedBarDropButton.fixedWidth = true;
  267. tabbedBarDropButton.height = 13;
  268. tabbedBarDropButton.width = 6;
  269. mSkin.setStyle("TabbedBarDropArea", tabbedBarDropButton);
  270. // Window minimize button
  271. GUIElementStyle winMinButtonStyle;
  272. winMinButtonStyle.normal.texture = getGUITexture(WindowMinButtonNormal);
  273. winMinButtonStyle.hover.texture = getGUITexture(WindowMinButtonHover);
  274. winMinButtonStyle.active.texture = winMinButtonStyle.hover.texture;
  275. winMinButtonStyle.fixedHeight = true;
  276. winMinButtonStyle.fixedWidth = true;
  277. winMinButtonStyle.height = 7;
  278. winMinButtonStyle.width = 8;
  279. mSkin.setStyle("WinMinimizeBtn", winMinButtonStyle);
  280. // Window maximize button
  281. GUIElementStyle winMaxButtonStyle;
  282. winMaxButtonStyle.normal.texture = getGUITexture(WindowMaxButtonNormal);
  283. winMaxButtonStyle.hover.texture = getGUITexture(WindowMaxButtonHover);
  284. winMaxButtonStyle.active.texture = winMaxButtonStyle.hover.texture;
  285. winMaxButtonStyle.fixedHeight = true;
  286. winMaxButtonStyle.fixedWidth = true;
  287. winMaxButtonStyle.height = 8;
  288. winMaxButtonStyle.width = 8;
  289. mSkin.setStyle("WinMaximizeBtn", winMaxButtonStyle);
  290. // Window close button
  291. GUIElementStyle winCloseButtonStyle;
  292. winCloseButtonStyle.normal.texture = getGUITexture(WindowCloseButtonNormal);
  293. winCloseButtonStyle.hover.texture = getGUITexture(WindowCloseButtonHover);
  294. winCloseButtonStyle.active.texture = winCloseButtonStyle.hover.texture;
  295. winCloseButtonStyle.fixedHeight = true;
  296. winCloseButtonStyle.fixedWidth = true;
  297. winCloseButtonStyle.height = 7;
  298. winCloseButtonStyle.width = 8;
  299. mSkin.setStyle("WinCloseBtn", winCloseButtonStyle);
  300. // Input box
  301. GUIElementStyle inputBoxStyle;
  302. inputBoxStyle.normal.texture = getGUITexture(InputBoxNormalTex);
  303. inputBoxStyle.hover.texture = getGUITexture(InputBoxHoverTex);
  304. inputBoxStyle.focused.texture = getGUITexture(InputBoxFocusedTex);
  305. inputBoxStyle.active.texture = inputBoxStyle.normal.texture;
  306. inputBoxStyle.border.left = 1;
  307. inputBoxStyle.border.right = 1;
  308. inputBoxStyle.border.top = 1;
  309. inputBoxStyle.border.bottom = 1;
  310. inputBoxStyle.contentOffset.left = 3;
  311. inputBoxStyle.contentOffset.right = 3;
  312. inputBoxStyle.contentOffset.top = 2;
  313. inputBoxStyle.contentOffset.bottom = 2;
  314. inputBoxStyle.fixedHeight = true;
  315. inputBoxStyle.height = 15;
  316. inputBoxStyle.minWidth = 10;
  317. inputBoxStyle.font = font;
  318. inputBoxStyle.fontSize = DefaultFontSize;
  319. inputBoxStyle.textHorzAlign = THA_Left;
  320. inputBoxStyle.textVertAlign = TVA_Top;
  321. mSkin.setStyle(GUIInputBox::getGUITypeName(), inputBoxStyle);
  322. /************************************************************************/
  323. /* SCROLL BAR */
  324. /************************************************************************/
  325. // Up button
  326. GUIElementStyle scrollUpBtnStyle;
  327. scrollUpBtnStyle.normal.texture = getGUITexture(ScrollBarUpNormalTex);
  328. scrollUpBtnStyle.hover.texture = getGUITexture(ScrollBarUpHoverTex);
  329. scrollUpBtnStyle.active.texture = getGUITexture(ScrollBarUpActiveTex);
  330. scrollUpBtnStyle.fixedHeight = true;
  331. scrollUpBtnStyle.fixedWidth = true;
  332. scrollUpBtnStyle.height = 4;
  333. scrollUpBtnStyle.width = 8;
  334. mSkin.setStyle("ScrollUpBtn", scrollUpBtnStyle);
  335. // Down button
  336. GUIElementStyle scrollDownBtnStyle;
  337. scrollDownBtnStyle.normal.texture = getGUITexture(ScrollBarDownNormalTex);
  338. scrollDownBtnStyle.hover.texture = getGUITexture(ScrollBarDownHoverTex);
  339. scrollDownBtnStyle.active.texture = getGUITexture(ScrollBarDownActiveTex);
  340. scrollDownBtnStyle.fixedHeight = true;
  341. scrollDownBtnStyle.fixedWidth = true;
  342. scrollDownBtnStyle.height = 4;
  343. scrollDownBtnStyle.width = 8;
  344. mSkin.setStyle("ScrollDownBtn", scrollDownBtnStyle);
  345. // Left button
  346. GUIElementStyle scrollLeftBtnStyle;
  347. scrollLeftBtnStyle.normal.texture = getGUITexture(ScrollBarLeftNormalTex);
  348. scrollLeftBtnStyle.hover.texture = getGUITexture(ScrollBarLeftHoverTex);
  349. scrollLeftBtnStyle.active.texture = getGUITexture(ScrollBarLeftActiveTex);
  350. scrollLeftBtnStyle.fixedHeight = true;
  351. scrollLeftBtnStyle.fixedWidth = true;
  352. scrollLeftBtnStyle.height = 8;
  353. scrollLeftBtnStyle.width = 4;
  354. mSkin.setStyle("ScrollLeftBtn", scrollLeftBtnStyle);
  355. // Right button
  356. GUIElementStyle scrollRightBtnStyle;
  357. scrollRightBtnStyle.normal.texture = getGUITexture(ScrollBarRightNormalTex);
  358. scrollRightBtnStyle.hover.texture = getGUITexture(ScrollBarRightHoverTex);
  359. scrollRightBtnStyle.active.texture = getGUITexture(ScrollBarRightActiveTex);
  360. scrollRightBtnStyle.fixedHeight = true;
  361. scrollRightBtnStyle.fixedWidth = true;
  362. scrollRightBtnStyle.height = 8;
  363. scrollRightBtnStyle.width = 4;
  364. mSkin.setStyle("ScrollRightBtn", scrollRightBtnStyle);
  365. // Horizontal handle
  366. GUIElementStyle scrollBarHorzBtnStyle;
  367. scrollBarHorzBtnStyle.normal.texture = getGUITexture(ScrollBarHandleHorzNormalTex);
  368. scrollBarHorzBtnStyle.hover.texture = getGUITexture(ScrollBarHandleHorzHoverTex);
  369. scrollBarHorzBtnStyle.active.texture = getGUITexture(ScrollBarHandleHorzActiveTex);
  370. scrollBarHorzBtnStyle.fixedHeight = true;
  371. scrollBarHorzBtnStyle.fixedWidth = true;
  372. scrollBarHorzBtnStyle.height = 6;
  373. scrollBarHorzBtnStyle.width = 4;
  374. mSkin.setStyle("ScrollBarHorzBtn", scrollBarHorzBtnStyle);
  375. // Vertical handle
  376. GUIElementStyle scrollBarVertBtnStyle;
  377. scrollBarVertBtnStyle.normal.texture = getGUITexture(ScrollBarHandleVertNormalTex);
  378. scrollBarVertBtnStyle.hover.texture = getGUITexture(ScrollBarHandleVertHoverTex);
  379. scrollBarVertBtnStyle.active.texture = getGUITexture(ScrollBarHandleVertActiveTex);
  380. scrollBarVertBtnStyle.fixedHeight = true;
  381. scrollBarVertBtnStyle.fixedWidth = true;
  382. scrollBarVertBtnStyle.height = 4;
  383. scrollBarVertBtnStyle.width = 6;
  384. mSkin.setStyle("ScrollBarVertBtn", scrollBarVertBtnStyle);
  385. HSpriteTexture scrollBarBgPtr = getGUITexture(ScrollBarBgTex);
  386. // Vertical scroll bar
  387. GUIElementStyle vertScrollBarStyle;
  388. vertScrollBarStyle.normal.texture = scrollBarBgPtr;
  389. vertScrollBarStyle.hover.texture = scrollBarBgPtr;
  390. vertScrollBarStyle.active.texture = scrollBarBgPtr;
  391. vertScrollBarStyle.fixedHeight = false;
  392. vertScrollBarStyle.fixedWidth = true;
  393. vertScrollBarStyle.minHeight = 16;
  394. vertScrollBarStyle.width = 8;
  395. mSkin.setStyle("ScrollBarVert", vertScrollBarStyle);
  396. // Horizontal scroll bar
  397. GUIElementStyle horzScrollBarStyle;
  398. horzScrollBarStyle.normal.texture = scrollBarBgPtr;
  399. horzScrollBarStyle.hover.texture = scrollBarBgPtr;
  400. horzScrollBarStyle.active.texture = scrollBarBgPtr;
  401. horzScrollBarStyle.fixedHeight = true;
  402. horzScrollBarStyle.fixedWidth = false;
  403. horzScrollBarStyle.minWidth = 16;
  404. horzScrollBarStyle.height = 8;
  405. mSkin.setStyle("ScrollBarHorz", horzScrollBarStyle);
  406. /************************************************************************/
  407. /* DROP DOWN BOX */
  408. /************************************************************************/
  409. // ListBox button
  410. GUIElementStyle dropDownListStyle;
  411. dropDownListStyle.normal.texture = getGUITexture(DropDownBtnNormalTex);
  412. dropDownListStyle.hover.texture = getGUITexture(DropDownBtnHoverTex);
  413. dropDownListStyle.active.texture = dropDownListStyle.hover.texture;
  414. dropDownListStyle.normalOn.texture = dropDownListStyle.hover.texture;
  415. dropDownListStyle.hoverOn.texture = dropDownListStyle.hover.texture;
  416. dropDownListStyle.activeOn.texture = dropDownListStyle.hover.texture;
  417. dropDownListStyle.fixedHeight = true;
  418. dropDownListStyle.fixedWidth = false;
  419. dropDownListStyle.height = 13;
  420. dropDownListStyle.width = 30;
  421. dropDownListStyle.contentOffset.left = 3;
  422. dropDownListStyle.contentOffset.right = 11;
  423. dropDownListStyle.contentOffset.top = 1;
  424. dropDownListStyle.contentOffset.bottom = 1;
  425. dropDownListStyle.border.left = 1;
  426. dropDownListStyle.border.right = 10;
  427. dropDownListStyle.border.top = 1;
  428. dropDownListStyle.border.bottom = 1;
  429. dropDownListStyle.font = font;
  430. dropDownListStyle.fontSize = DefaultFontSize;
  431. dropDownListStyle.textHorzAlign = THA_Left;
  432. dropDownListStyle.textVertAlign = TVA_Top;
  433. mSkin.setStyle("ListBox", dropDownListStyle);
  434. // DropDown scroll up button arrow
  435. HTexture dropDownBtnScrollUpArrow = getGUITexture(DropDownBoxBtnUpArrowTex);
  436. GUIElementStyle dropDownScrollUpBtnArrowStyle;
  437. dropDownScrollUpBtnArrowStyle.normal.texture = getGUITexture(DropDownBoxBtnUpArrowTex);
  438. dropDownScrollUpBtnArrowStyle.hover.texture = dropDownScrollUpBtnArrowStyle.normal.texture;
  439. dropDownScrollUpBtnArrowStyle.active.texture = dropDownScrollUpBtnArrowStyle.hover.texture;
  440. dropDownScrollUpBtnArrowStyle.fixedHeight = true;
  441. dropDownScrollUpBtnArrowStyle.fixedWidth = false;
  442. dropDownScrollUpBtnArrowStyle.height = 7;
  443. dropDownScrollUpBtnArrowStyle.width = 30;
  444. dropDownScrollUpBtnArrowStyle.border.left = 1;
  445. dropDownScrollUpBtnArrowStyle.border.right = 1;
  446. dropDownScrollUpBtnArrowStyle.border.top = 1;
  447. dropDownScrollUpBtnArrowStyle.border.bottom = 1;
  448. mSkin.setStyle("ListBoxScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
  449. mSkin.setStyle("MenuBarScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
  450. mSkin.setStyle("ContextMenuScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
  451. // DropDown scroll up button
  452. GUIElementStyle dropDownScrollUpBtnStyle;
  453. dropDownScrollUpBtnStyle.normal.texture = getGUITexture(DropDownBoxBtnUpNormalTex);
  454. dropDownScrollUpBtnStyle.hover.texture = getGUITexture(DropDownBoxBtnUpHoverTex);
  455. dropDownScrollUpBtnStyle.active.texture = dropDownScrollUpBtnStyle.hover.texture;
  456. dropDownScrollUpBtnStyle.fixedHeight = true;
  457. dropDownScrollUpBtnStyle.fixedWidth = false;
  458. dropDownScrollUpBtnStyle.height = 7;
  459. dropDownScrollUpBtnStyle.width = 30;
  460. dropDownScrollUpBtnStyle.border.left = 1;
  461. dropDownScrollUpBtnStyle.border.right = 1;
  462. dropDownScrollUpBtnStyle.border.top = 1;
  463. dropDownScrollUpBtnStyle.border.bottom = 1;
  464. mSkin.setStyle("ListBoxScrollUpBtn", dropDownScrollUpBtnStyle);
  465. mSkin.setStyle("MenuBarScrollUpBtn", dropDownScrollUpBtnStyle);
  466. mSkin.setStyle("ContextMenuScrollUpBtn", dropDownScrollUpBtnStyle);
  467. // DropDown scroll down button arrow
  468. GUIElementStyle dropDownScrollDownBtnArrowStyle;
  469. dropDownScrollDownBtnArrowStyle.normal.texture = getGUITexture(DropDownBoxBtnDownArrowTex);
  470. dropDownScrollDownBtnArrowStyle.hover.texture = dropDownScrollDownBtnArrowStyle.normal.texture;
  471. dropDownScrollDownBtnArrowStyle.active.texture = dropDownScrollDownBtnArrowStyle.hover.texture;
  472. dropDownScrollDownBtnArrowStyle.fixedHeight = true;
  473. dropDownScrollDownBtnArrowStyle.fixedWidth = false;
  474. dropDownScrollDownBtnArrowStyle.height = 7;
  475. dropDownScrollDownBtnArrowStyle.width = 30;
  476. dropDownScrollDownBtnArrowStyle.border.left = 1;
  477. dropDownScrollDownBtnArrowStyle.border.right = 1;
  478. dropDownScrollDownBtnArrowStyle.border.top = 1;
  479. dropDownScrollDownBtnArrowStyle.border.bottom = 1;
  480. mSkin.setStyle("ListBoxScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
  481. mSkin.setStyle("MenuBarScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
  482. mSkin.setStyle("ContextMenuScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
  483. // DropDown scroll down button
  484. GUIElementStyle dropDownScrollDownBtnStyle;
  485. dropDownScrollDownBtnStyle.normal.texture = getGUITexture(DropDownBoxBtnDownNormalTex);
  486. dropDownScrollDownBtnStyle.hover.texture = getGUITexture(DropDownBoxBtnDownHoverTex);
  487. dropDownScrollDownBtnStyle.active.texture = dropDownScrollDownBtnStyle.hover.texture;
  488. dropDownScrollDownBtnStyle.fixedHeight = true;
  489. dropDownScrollDownBtnStyle.fixedWidth = false;
  490. dropDownScrollDownBtnStyle.height = 7;
  491. dropDownScrollDownBtnStyle.width = 30;
  492. dropDownScrollDownBtnStyle.border.left = 1;
  493. dropDownScrollDownBtnStyle.border.right = 1;
  494. dropDownScrollDownBtnStyle.border.top = 1;
  495. dropDownScrollDownBtnStyle.border.bottom = 1;
  496. mSkin.setStyle("ListBoxScrollDownBtn", dropDownScrollDownBtnStyle);
  497. mSkin.setStyle("MenuBarScrollDownBtn", dropDownScrollDownBtnStyle);
  498. mSkin.setStyle("ContextMenuScrollDownBtn", dropDownScrollDownBtnStyle);
  499. // DropDown entry button
  500. GUIElementStyle dropDownEntryBtnStyle;
  501. dropDownEntryBtnStyle.normal.texture = getGUITexture(DropDownBoxEntryNormalTex);
  502. dropDownEntryBtnStyle.hover.texture = getGUITexture(DropDownBoxEntryHoverTex);
  503. dropDownEntryBtnStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
  504. dropDownEntryBtnStyle.fixedHeight = true;
  505. dropDownEntryBtnStyle.fixedWidth = false;
  506. dropDownEntryBtnStyle.height = 14;
  507. dropDownEntryBtnStyle.width = 30;
  508. dropDownEntryBtnStyle.border.left = 1;
  509. dropDownEntryBtnStyle.border.right = 1;
  510. dropDownEntryBtnStyle.border.top = 1;
  511. dropDownEntryBtnStyle.border.bottom = 1;
  512. dropDownEntryBtnStyle.font = font;
  513. dropDownEntryBtnStyle.fontSize = DefaultFontSize;
  514. dropDownEntryBtnStyle.textHorzAlign = THA_Left;
  515. dropDownEntryBtnStyle.textVertAlign = TVA_Top;
  516. mSkin.setStyle("ListBoxEntryBtn", dropDownEntryBtnStyle);
  517. mSkin.setStyle("MenuBarEntryBtn", dropDownEntryBtnStyle);
  518. mSkin.setStyle("ContextMenuEntryBtn", dropDownEntryBtnStyle);
  519. // DropDown entry button with expand
  520. GUIElementStyle dropDownEntryExpBtnStyle;
  521. dropDownEntryExpBtnStyle.normal.texture = getGUITexture(DropDownBoxEntryExpNormalTex);
  522. dropDownEntryExpBtnStyle.hover.texture = getGUITexture(DropDownBoxEntryExpHoverTex);
  523. dropDownEntryExpBtnStyle.active.texture = dropDownEntryExpBtnStyle.hover.texture;
  524. dropDownEntryExpBtnStyle.fixedHeight = true;
  525. dropDownEntryExpBtnStyle.fixedWidth = false;
  526. dropDownEntryExpBtnStyle.height = 14;
  527. dropDownEntryExpBtnStyle.width = 30;
  528. dropDownEntryExpBtnStyle.border.left = 1;
  529. dropDownEntryExpBtnStyle.border.right = 6;
  530. dropDownEntryExpBtnStyle.border.top = 1;
  531. dropDownEntryExpBtnStyle.border.bottom = 1;
  532. dropDownEntryExpBtnStyle.font = font;
  533. dropDownEntryExpBtnStyle.fontSize = DefaultFontSize;
  534. dropDownEntryExpBtnStyle.textHorzAlign = THA_Left;
  535. dropDownEntryExpBtnStyle.textVertAlign = TVA_Top;
  536. mSkin.setStyle("ListBoxEntryExpBtn", dropDownEntryExpBtnStyle);
  537. mSkin.setStyle("MenuBarEntryExpBtn", dropDownEntryExpBtnStyle);
  538. mSkin.setStyle("ContextMenuEntryExpBtn", dropDownEntryExpBtnStyle);
  539. // DropDown box frame
  540. GUIElementStyle dropDownBoxStyle;
  541. dropDownBoxStyle.normal.texture = getGUITexture(DropDownBoxBgTex);
  542. dropDownBoxStyle.hover.texture = dropDownEntryBtnStyle.normal.texture;
  543. dropDownBoxStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
  544. dropDownBoxStyle.fixedHeight = false;
  545. dropDownBoxStyle.fixedWidth = false;
  546. dropDownBoxStyle.border.left = 1;
  547. dropDownBoxStyle.border.right = 1;
  548. dropDownBoxStyle.border.top = 1;
  549. dropDownBoxStyle.border.bottom = 1;
  550. dropDownBoxStyle.margins.left = 1;
  551. dropDownBoxStyle.margins.right = 1;
  552. dropDownBoxStyle.margins.top = 1;
  553. dropDownBoxStyle.margins.bottom = 1;
  554. mSkin.setStyle("ListBoxFrame", dropDownBoxStyle);
  555. mSkin.setStyle("MenuBarFrame", dropDownBoxStyle);
  556. mSkin.setStyle("ContextMenuFrame", dropDownBoxStyle);
  557. // Drop down separator
  558. GUIElementStyle dropDownSeparatorStyle;
  559. dropDownSeparatorStyle.normal.texture = getGUITexture(DropDownSeparatorTex);
  560. dropDownSeparatorStyle.fixedHeight = true;
  561. dropDownSeparatorStyle.fixedWidth = false;
  562. dropDownSeparatorStyle.height = 3;
  563. dropDownSeparatorStyle.width = 30;
  564. dropDownSeparatorStyle.border.left = 1;
  565. dropDownSeparatorStyle.border.right = 1;
  566. dropDownSeparatorStyle.border.top = 1;
  567. dropDownSeparatorStyle.border.bottom = 1;
  568. mSkin.setStyle("ListBoxSeparator", dropDownSeparatorStyle);
  569. mSkin.setStyle("MenuBarSeparator", dropDownSeparatorStyle);
  570. mSkin.setStyle("ContextMenuSeparator", dropDownSeparatorStyle);
  571. /************************************************************************/
  572. /* MENU BAR */
  573. /************************************************************************/
  574. // MenuBar background
  575. GUIElementStyle menuBarBgStyle;
  576. menuBarBgStyle.normal.texture = getGUITexture(MenuBarBgTex);
  577. menuBarBgStyle.fixedHeight = false;
  578. menuBarBgStyle.fixedWidth = false;
  579. menuBarBgStyle.height = 4;
  580. menuBarBgStyle.width = 4;
  581. mSkin.setStyle("MenuBarBg", menuBarBgStyle);
  582. // MenuBar Banshee logo
  583. GUIElementStyle menuBarBansheeLogoStyle;
  584. menuBarBansheeLogoStyle.normal.texture = getGUITexture(MenuBarBansheeLogoTex);
  585. menuBarBansheeLogoStyle.fixedHeight = true;
  586. menuBarBansheeLogoStyle.fixedWidth = true;
  587. menuBarBansheeLogoStyle.height = 7;
  588. menuBarBansheeLogoStyle.width = 51;
  589. mSkin.setStyle("MenuBarBansheeLogo", menuBarBansheeLogoStyle);
  590. // MenuBar button
  591. GUIElementStyle menuBarBtnStyle;
  592. menuBarBtnStyle.normal.texture = getGUITexture(MenuBarBtnNormalTex);
  593. menuBarBtnStyle.hover.texture = getGUITexture(MenuBarBtnHoverTex);
  594. menuBarBtnStyle.active.texture = menuBarBtnStyle.hover.texture;
  595. menuBarBtnStyle.normalOn.texture = menuBarBtnStyle.hover.texture;
  596. menuBarBtnStyle.hoverOn.texture = menuBarBtnStyle.hover.texture;
  597. menuBarBtnStyle.activeOn.texture = menuBarBtnStyle.hover.texture;
  598. menuBarBtnStyle.fixedHeight = true;
  599. menuBarBtnStyle.fixedWidth = false;
  600. menuBarBtnStyle.height = 15;
  601. menuBarBtnStyle.width = 4;
  602. menuBarBtnStyle.margins.left = 2;
  603. menuBarBtnStyle.margins.right = 2;
  604. menuBarBtnStyle.margins.top = 2;
  605. menuBarBtnStyle.margins.bottom = 2;
  606. menuBarBtnStyle.font = font;
  607. menuBarBtnStyle.fontSize = DefaultFontSize;
  608. menuBarBtnStyle.textHorzAlign = THA_Left;
  609. menuBarBtnStyle.textVertAlign = TVA_Top;
  610. mSkin.setStyle("MenuBarBtn", menuBarBtnStyle);
  611. /************************************************************************/
  612. /* DOCK SLIDER */
  613. /************************************************************************/
  614. GUIElementStyle dockSliderBtnStyle;
  615. dockSliderBtnStyle.normal.texture = getGUITexture(DockSliderNormalTex);
  616. dockSliderBtnStyle.fixedHeight = false;
  617. dockSliderBtnStyle.fixedWidth = false;
  618. dockSliderBtnStyle.height = 2;
  619. dockSliderBtnStyle.width = 2;
  620. mSkin.setStyle("DockSliderBtn", dockSliderBtnStyle);
  621. /************************************************************************/
  622. /* TREE VIEW */
  623. /************************************************************************/
  624. // Expand button
  625. GUIElementStyle treeViewExpandButtonStyle;
  626. treeViewExpandButtonStyle.normal.texture = getGUITexture(TreeViewExpandButtonOffNormal);
  627. treeViewExpandButtonStyle.hover.texture = getGUITexture(TreeViewExpandButtonOffHover);
  628. treeViewExpandButtonStyle.active.texture = treeViewExpandButtonStyle.hover.texture;
  629. treeViewExpandButtonStyle.normalOn.texture = getGUITexture(TreeViewExpandButtonOnNormal);
  630. treeViewExpandButtonStyle.hoverOn.texture = getGUITexture(TreeViewExpandButtonOnHover);
  631. treeViewExpandButtonStyle.activeOn.texture = treeViewExpandButtonStyle.hoverOn.texture;
  632. treeViewExpandButtonStyle.margins.left = 4;
  633. treeViewExpandButtonStyle.margins.right = 4;
  634. treeViewExpandButtonStyle.margins.top = 5;
  635. treeViewExpandButtonStyle.margins.bottom = 4;
  636. treeViewExpandButtonStyle.fixedHeight = true;
  637. treeViewExpandButtonStyle.fixedWidth = true;
  638. treeViewExpandButtonStyle.height = 16;
  639. treeViewExpandButtonStyle.width = 16;
  640. mSkin.setStyle("TreeViewFoldoutBtn", treeViewExpandButtonStyle);
  641. // Entry
  642. GUIElementStyle treeViewEntryStyle;
  643. treeViewEntryStyle.font = font;
  644. treeViewEntryStyle.fontSize = DefaultFontSize;
  645. treeViewEntryStyle.fixedWidth = false;
  646. treeViewEntryStyle.fixedHeight = true;
  647. treeViewEntryStyle.height = 16;
  648. treeViewEntryStyle.minWidth = 10;
  649. mSkin.setStyle("TreeViewElementBtn", treeViewEntryStyle);
  650. // Selection background
  651. GUIElementStyle treeViewSelBackgroundStyle;
  652. treeViewSelBackgroundStyle.normal.texture = getGUITexture(TreeViewSelectionBackground);
  653. treeViewSelBackgroundStyle.fixedHeight = false;
  654. treeViewSelBackgroundStyle.fixedWidth = false;
  655. treeViewSelBackgroundStyle.height = 2;
  656. treeViewSelBackgroundStyle.width = 2;
  657. mSkin.setStyle("TreeViewSelectionBackground", treeViewSelBackgroundStyle);
  658. // Edit box
  659. GUIElementStyle treeViewEditBox;
  660. treeViewEditBox.normal.texture = getGUITexture(TreeViewEditBox);
  661. treeViewEditBox.hover.texture = treeViewEditBox.normal.texture;
  662. treeViewEditBox.focused.texture = treeViewEditBox.normal.texture;
  663. treeViewEditBox.active.texture = treeViewEditBox.normal.texture;
  664. treeViewEditBox.border.left = 1;
  665. treeViewEditBox.border.right = 1;
  666. treeViewEditBox.border.top = 1;
  667. treeViewEditBox.border.bottom = 1;
  668. treeViewEditBox.margins.left = 1;
  669. treeViewEditBox.margins.right = 1;
  670. treeViewEditBox.margins.top = 1;
  671. treeViewEditBox.margins.bottom = 1;
  672. treeViewEditBox.fixedHeight = true;
  673. treeViewEditBox.height = 13;
  674. treeViewEditBox.minWidth = 10;
  675. treeViewEditBox.font = font;
  676. treeViewEditBox.fontSize = DefaultFontSize;
  677. treeViewEditBox.textHorzAlign = THA_Left;
  678. treeViewEditBox.textVertAlign = TVA_Top;
  679. mSkin.setStyle(GUITreeViewEditBox::getGUITypeName(), treeViewEditBox);
  680. // Element highlight
  681. GUIElementStyle treeViewElementHighlight;
  682. treeViewElementHighlight.normal.texture = getGUITexture(TreeViewElementHighlight);
  683. treeViewElementHighlight.border.left = 1;
  684. treeViewElementHighlight.border.right = 1;
  685. treeViewElementHighlight.border.top = 1;
  686. treeViewElementHighlight.border.bottom = 1;
  687. mSkin.setStyle("TreeViewElementHighlight", treeViewElementHighlight);
  688. // Element separator highlight
  689. GUIElementStyle treeViewElementSepHighlight;
  690. treeViewElementSepHighlight.normal.texture = getGUITexture(TreeViewElementSepHighlight);
  691. treeViewElementSepHighlight.border.left = 1;
  692. treeViewElementSepHighlight.border.right = 1;
  693. treeViewElementSepHighlight.border.top = 1;
  694. treeViewElementSepHighlight.border.bottom = 1;
  695. mSkin.setStyle("TreeViewElementSepHighlight", treeViewElementSepHighlight);
  696. /************************************************************************/
  697. /* OBJECT DROP FIELD */
  698. /************************************************************************/
  699. GUIElementStyle objectDropStyle;
  700. objectDropStyle.normal.texture = getGUITexture(ObjectDropBtnNormalTex);
  701. objectDropStyle.normalOn.texture = getGUITexture(ObjectDropBtnNormalOnTex);
  702. objectDropStyle.fixedHeight = true;
  703. objectDropStyle.height = 15;
  704. objectDropStyle.minWidth = 50;
  705. objectDropStyle.font = font;
  706. objectDropStyle.fontSize = DefaultFontSize;
  707. objectDropStyle.textHorzAlign = THA_Center;
  708. objectDropStyle.textVertAlign = TVA_Center;
  709. mSkin.setStyle(ObjectFieldDropBtnStyleName, objectDropStyle);
  710. GUIElementStyle objectClearBtnStyle;
  711. objectClearBtnStyle.normal.texture = getGUITexture(ObjectClearBtnNormalTex);
  712. objectClearBtnStyle.hover.texture = getGUITexture(ObjectClearBtnHoverTex);
  713. objectClearBtnStyle.active.texture = getGUITexture(ObjectClearBtnActiveTex);
  714. objectClearBtnStyle.fixedHeight = true;
  715. objectClearBtnStyle.fixedWidth = true;
  716. objectClearBtnStyle.height = 15;
  717. objectClearBtnStyle.width = 13;
  718. mSkin.setStyle(ObjectFieldClearBtnStyleName, objectClearBtnStyle);
  719. GUIElementStyle editorObjectFieldStyle;
  720. editorObjectFieldStyle.fixedHeight = true;
  721. editorObjectFieldStyle.height = 15;
  722. editorObjectFieldStyle.minWidth = 30;
  723. editorObjectFieldStyle.subStyles[ObjectFieldLabelStyleName] = GUITextField::getLabelStyleType();
  724. editorObjectFieldStyle.subStyles[ObjectFieldDropBtnStyleName] = ObjectFieldDropBtnStyleName;
  725. editorObjectFieldStyle.subStyles[ObjectFieldClearBtnStyleName] = ObjectFieldClearBtnStyleName;
  726. mSkin.setStyle(ObjectFieldStyleName, editorObjectFieldStyle);
  727. /************************************************************************/
  728. /* EDITOR FIELDS */
  729. /************************************************************************/
  730. GUIElementStyle editorFieldLabelStyle;
  731. editorFieldLabelStyle.font = font;
  732. editorFieldLabelStyle.fontSize = DefaultFontSize;
  733. editorFieldLabelStyle.fixedWidth = false;
  734. editorFieldLabelStyle.fixedHeight = true;
  735. editorFieldLabelStyle.height = 11;
  736. editorFieldLabelStyle.minWidth = 10;
  737. editorFieldLabelStyle.textHorzAlign = THA_Left;
  738. mSkin.setStyle(GUITextField::getLabelStyleType(), editorFieldLabelStyle);
  739. GUIElementStyle editorIntFieldStyle;
  740. editorIntFieldStyle.fixedHeight = true;
  741. editorIntFieldStyle.height = 15;
  742. editorIntFieldStyle.minWidth = 30;
  743. editorIntFieldStyle.subStyles[GUIIntField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  744. editorIntFieldStyle.subStyles[GUIIntField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  745. mSkin.setStyle(GUIIntField::getGUITypeName(), editorIntFieldStyle);
  746. GUIElementStyle editorFloatFieldStyle;
  747. editorFloatFieldStyle.fixedHeight = true;
  748. editorFloatFieldStyle.height = 15;
  749. editorFloatFieldStyle.minWidth = 30;
  750. editorFloatFieldStyle.subStyles[GUIFloatField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  751. editorFloatFieldStyle.subStyles[GUIFloatField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  752. mSkin.setStyle(GUIFloatField::getGUITypeName(), editorFloatFieldStyle);
  753. GUIElementStyle editorTextFieldStyle;
  754. editorTextFieldStyle.fixedHeight = true;
  755. editorTextFieldStyle.height = 15;
  756. editorTextFieldStyle.minWidth = 30;
  757. editorTextFieldStyle.subStyles[GUITextField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  758. editorTextFieldStyle.subStyles[GUITextField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  759. mSkin.setStyle(GUITextField::getGUITypeName(), editorTextFieldStyle);
  760. GUIElementStyle editorColorFieldStyle;
  761. editorColorFieldStyle.fixedHeight = true;
  762. editorColorFieldStyle.height = 15;
  763. editorColorFieldStyle.minWidth = 30;
  764. editorColorFieldStyle.subStyles[GUIColorField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  765. editorColorFieldStyle.subStyles[GUIColorField::getColorInputStyleType()] = GUIColor::getGUITypeName();
  766. mSkin.setStyle(GUIColorField::getGUITypeName(), editorColorFieldStyle);
  767. GUIElementStyle editorToggleFieldStyle;
  768. editorToggleFieldStyle.fixedHeight = true;
  769. editorToggleFieldStyle.height = 15;
  770. editorToggleFieldStyle.minWidth = 30;
  771. editorToggleFieldStyle.subStyles[GUIToggleField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  772. editorToggleFieldStyle.subStyles[GUIToggleField::getToggleStyleType()] = GUIToggle::getGUITypeName();
  773. mSkin.setStyle(GUIToggleField::getGUITypeName(), editorToggleFieldStyle);
  774. GUIElementStyle editorVector2FieldStyle;
  775. editorVector2FieldStyle.fixedHeight = true;
  776. editorVector2FieldStyle.height = 30;
  777. editorVector2FieldStyle.minWidth = 30;
  778. editorVector2FieldStyle.subStyles[GUIVector2Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  779. editorVector2FieldStyle.subStyles[GUIVector2Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  780. mSkin.setStyle(GUIVector2Field::getGUITypeName(), editorVector2FieldStyle);
  781. GUIElementStyle editorVector3FieldStyle;
  782. editorVector3FieldStyle.fixedHeight = true;
  783. editorVector3FieldStyle.height = 30;
  784. editorVector3FieldStyle.minWidth = 30;
  785. editorVector3FieldStyle.subStyles[GUIVector3Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  786. editorVector3FieldStyle.subStyles[GUIVector3Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  787. mSkin.setStyle(GUIVector3Field::getGUITypeName(), editorVector3FieldStyle);
  788. GUIElementStyle editorVector4FieldStyle;
  789. editorVector4FieldStyle.fixedHeight = true;
  790. editorVector4FieldStyle.height = 30;
  791. editorVector4FieldStyle.minWidth = 30;
  792. editorVector4FieldStyle.subStyles[GUIVector4Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  793. editorVector4FieldStyle.subStyles[GUIVector4Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  794. mSkin.setStyle(GUIVector4Field::getGUITypeName(), editorVector4FieldStyle);
  795. /************************************************************************/
  796. /* COMPONENT FOLDOUT */
  797. /************************************************************************/
  798. GUIElementStyle cmpFoldoutBtnStyle;
  799. cmpFoldoutBtnStyle.normal.texture = getGUITexture(CmpFoldoutClosedNormalTex);
  800. cmpFoldoutBtnStyle.hover.texture = getGUITexture(CmpFoldoutClosedHoverTex);
  801. cmpFoldoutBtnStyle.active.texture = getGUITexture(CmpFoldoutOpenActiveTex);
  802. cmpFoldoutBtnStyle.normalOn.texture = getGUITexture(CmpFoldoutOpenNormalTex);
  803. cmpFoldoutBtnStyle.hoverOn.texture = getGUITexture(CmpFoldoutOpenHoverTex);
  804. cmpFoldoutBtnStyle.activeOn.texture = getGUITexture(CmpFoldoutOpenActiveTex);
  805. cmpFoldoutBtnStyle.fixedHeight = true;
  806. cmpFoldoutBtnStyle.fixedWidth = false;
  807. cmpFoldoutBtnStyle.height = 10;
  808. cmpFoldoutBtnStyle.minWidth = 10;
  809. cmpFoldoutBtnStyle.font = font;
  810. cmpFoldoutBtnStyle.fontSize = DefaultFontSize;
  811. cmpFoldoutBtnStyle.textHorzAlign = THA_Left;
  812. cmpFoldoutBtnStyle.textVertAlign = TVA_Center;
  813. cmpFoldoutBtnStyle.contentOffset = RectOffset(12, 0, 0, 0);
  814. cmpFoldoutBtnStyle.border.left = 8;
  815. mSkin.setStyle(GUIComponentFoldout::getFoldoutButtonStyleType(), cmpFoldoutBtnStyle);
  816. GUIElementStyle cmpFoldoutStyle;
  817. cmpFoldoutStyle.fixedHeight = true;
  818. cmpFoldoutStyle.height = 12;
  819. cmpFoldoutStyle.minWidth = 30;
  820. cmpFoldoutStyle.subStyles[GUIComponentFoldout::getFoldoutButtonStyleType()] = GUIComponentFoldout::getFoldoutButtonStyleType();
  821. mSkin.setStyle(GUIComponentFoldout::getGUITypeName(), cmpFoldoutStyle);
  822. /************************************************************************/
  823. /* FOLDOUT */
  824. /************************************************************************/
  825. GUIElementStyle foldoutBtnStyle;
  826. foldoutBtnStyle.normal.texture = getGUITexture(FoldoutClosedNormalTex);
  827. foldoutBtnStyle.hover.texture = getGUITexture(FoldoutClosedHoverTex);
  828. foldoutBtnStyle.active.texture = foldoutBtnStyle.hover.texture;
  829. foldoutBtnStyle.normalOn.texture = getGUITexture(FoldoutOpenNormalTex);
  830. foldoutBtnStyle.hoverOn.texture = getGUITexture(FoldoutOpenHoverTex);
  831. foldoutBtnStyle.activeOn.texture = foldoutBtnStyle.hoverOn.texture;
  832. foldoutBtnStyle.fixedHeight = true;
  833. foldoutBtnStyle.fixedWidth = true;
  834. foldoutBtnStyle.height = 10;
  835. foldoutBtnStyle.width = 8;
  836. mSkin.setStyle(GUIFoldout::getFoldoutButtonStyleType(), foldoutBtnStyle);
  837. GUIElementStyle foldoutStyle;
  838. foldoutStyle.fixedHeight = true;
  839. foldoutStyle.height = 12;
  840. foldoutStyle.minWidth = 30;
  841. foldoutStyle.subStyles[GUIFoldout::getLabelStyleType()] = GUIFoldout::getLabelStyleType();
  842. foldoutStyle.subStyles[GUIFoldout::getFoldoutButtonStyleType()] = GUIFoldout::getFoldoutButtonStyleType();
  843. mSkin.setStyle(GUIFoldout::getGUITypeName(), foldoutStyle);
  844. }
  845. void BuiltinEditorResources::preprocess()
  846. {
  847. static const WString GUI_TEXTURES[] =
  848. { WindowBackgroundTexture, ButtonNormalTex, ButtonHoverTex, ButtonActiveTex, ToggleNormalTex,
  849. ToggleHoverTex, ToggleActiveTex, ToggleNormalOnTex, ToggleHoverOnTex, ToggleActiveOnTex,
  850. ObjectDropBtnNormalTex, ObjectDropBtnNormalOnTex, ObjectClearBtnNormalTex, ObjectClearBtnHoverTex,
  851. ObjectClearBtnActiveTex, FoldoutOpenNormalTex, FoldoutOpenHoverTex, FoldoutClosedNormalTex,
  852. FoldoutClosedHoverTex, CmpFoldoutOpenNormalTex, CmpFoldoutOpenHoverTex, CmpFoldoutOpenActiveTex,
  853. CmpFoldoutClosedNormalTex, CmpFoldoutClosedHoverTex, CmpFoldoutClosedActiveTex, WindowFrameNormal,
  854. WindowFrameFocused, WindowTitleBarBg, WindowCloseButtonNormal, WindowCloseButtonHover, WindowMinButtonNormal,
  855. WindowMinButtonHover, WindowMaxButtonNormal, WindowMaxButtonHover, TabbedBarBtnNormal, TabbedBarBtnActive,
  856. InputBoxNormalTex, InputBoxHoverTex, InputBoxFocusedTex, ScrollBarUpNormalTex, ScrollBarUpHoverTex,
  857. ScrollBarUpActiveTex, ScrollBarDownNormalTex, ScrollBarDownHoverTex, ScrollBarDownActiveTex, ScrollBarLeftNormalTex,
  858. ScrollBarLeftHoverTex, ScrollBarLeftActiveTex, ScrollBarRightNormalTex, ScrollBarRightHoverTex, ScrollBarRightActiveTex,
  859. ScrollBarHandleHorzNormalTex, ScrollBarHandleHorzHoverTex, ScrollBarHandleHorzActiveTex, ScrollBarHandleVertNormalTex,
  860. ScrollBarHandleVertHoverTex, ScrollBarHandleVertActiveTex, DropDownBtnNormalTex, DropDownBtnHoverTex,
  861. DropDownBoxBgTex, DropDownBoxEntryNormalTex, DropDownBoxEntryHoverTex, DropDownBoxBtnUpNormalTex,
  862. DropDownBoxBtnUpHoverTex, DropDownBoxBtnDownNormalTex, DropDownBoxBtnDownHoverTex, DropDownBoxEntryExpNormalTex,
  863. DropDownBoxEntryExpHoverTex, DropDownSeparatorTex, DropDownBoxBtnUpArrowTex, DropDownBoxBtnDownArrowTex,
  864. ScrollBarBgTex, MenuBarBgTex, MenuBarBtnNormalTex, MenuBarBtnHoverTex, MenuBarBansheeLogoTex, DockSliderNormalTex,
  865. TreeViewExpandButtonOffNormal, TreeViewExpandButtonOffHover, TreeViewExpandButtonOnNormal, TreeViewExpandButtonOnHover,
  866. TreeViewSelectionBackground, TreeViewEditBox, TreeViewElementHighlight, TreeViewElementSepHighlight };
  867. static const GpuProgramImportData GPU_PROGRAM_IMPORT_DATA[] =
  868. {
  869. { SceneGridVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  870. { SceneGridPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_PS_4_0, "hlsl", HLSL11ShaderSubFolder },
  871. { ShaderDockOverlayVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  872. { ShaderDockOverlayPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_PS_4_0, "hlsl", HLSL11ShaderSubFolder },
  873. { SceneGridVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_2_0, "hlsl", HLSL9ShaderSubFolder },
  874. { SceneGridPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_PS_2_0, "hlsl", HLSL9ShaderSubFolder },
  875. { ShaderDockOverlayVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_2_0, "hlsl", HLSL9ShaderSubFolder },
  876. { ShaderDockOverlayPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_PS_2_0, "hlsl", HLSL9ShaderSubFolder },
  877. { SceneGridVSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  878. { SceneGridPSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_PS_4_0, "glsl", GLSLShaderSubFolder },
  879. { ShaderDockOverlayVSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  880. { ShaderDockOverlayPSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_PS_4_0, "glsl", GLSLShaderSubFolder }
  881. };
  882. if (FileSystem::exists(DefaultSkinFolderRaw))
  883. {
  884. FileSystem::remove(DefaultSkinFolder);
  885. for (auto& tex : GUI_TEXTURES)
  886. importGUITexture(tex);
  887. {
  888. Path fontPath = FileSystem::getWorkingDirectoryPath();
  889. fontPath.append(DefaultSkinFolderRaw);
  890. fontPath.append(DefaultFontFilename);
  891. ImportOptionsPtr fontImportOptions = Importer::instance().createImportOptions(fontPath);
  892. if (rtti_is_of_type<FontImportOptions>(fontImportOptions))
  893. {
  894. FontImportOptions* importOptions = static_cast<FontImportOptions*>(fontImportOptions.get());
  895. Vector<UINT32> fontSizes;
  896. fontSizes.push_back(DefaultFontSize);
  897. importOptions->setFontSizes(fontSizes);
  898. importOptions->setAntialiasing(false);
  899. }
  900. HFont font = Importer::instance().import(fontPath, fontImportOptions);
  901. Path outputPath = FileSystem::getWorkingDirectoryPath();
  902. outputPath.append(DefaultSkinFolder);
  903. outputPath.append(DefaultFontFilename + L".asset");
  904. Resources::instance().save(font, outputPath, true);
  905. // Save font texture pages as well. TODO - Later maybe figure out a more automatic way to do this
  906. const FontData* fontData = font->getFontDataForSize(DefaultFontSize);
  907. Path texPageOutputPath = FileSystem::getWorkingDirectoryPath();
  908. texPageOutputPath.append(DefaultSkinFolder);
  909. UINT32 pageIdx = 0;
  910. for (auto tex : fontData->texturePages)
  911. {
  912. texPageOutputPath.setFilename(DefaultFontFilename + L"_texpage_" + toWString(pageIdx) + L".asset");
  913. Resources::instance().save(tex, texPageOutputPath, true);
  914. }
  915. }
  916. }
  917. if (FileSystem::exists(DefaultShaderFolderRaw))
  918. {
  919. Path shaderFolder = DefaultShaderFolder;
  920. shaderFolder.append(mActiveShaderSubFolder);
  921. FileSystem::remove(shaderFolder);
  922. for (auto& importData : GPU_PROGRAM_IMPORT_DATA)
  923. {
  924. if (importData.folder != mActiveShaderSubFolder)
  925. continue;
  926. Path gpuProgInputLoc = DefaultShaderFolderRaw;
  927. gpuProgInputLoc.append(importData.folder);
  928. gpuProgInputLoc.append(importData.filename);
  929. Path gpuProgOutputLoc = DefaultShaderFolder;
  930. gpuProgOutputLoc.append(importData.folder);
  931. gpuProgOutputLoc.append(importData.filename + L".asset");
  932. ImportOptionsPtr gpuProgImportOptions = Importer::instance().createImportOptions(gpuProgInputLoc);
  933. if (rtti_is_of_type<GpuProgramImportOptions>(gpuProgImportOptions))
  934. {
  935. GpuProgramImportOptions* importOptions = static_cast<GpuProgramImportOptions*>(gpuProgImportOptions.get());
  936. importOptions->setEntryPoint(importData.entryPoint);
  937. importOptions->setLanguage(importData.language);
  938. importOptions->setProfile(importData.profile);
  939. importOptions->setType(importData.type);
  940. }
  941. HGpuProgram gpuProgram = Importer::instance().import(gpuProgInputLoc, gpuProgImportOptions);
  942. Resources::instance().save(gpuProgram, gpuProgOutputLoc, true);
  943. }
  944. }
  945. Resources::instance().unloadAllUnused();
  946. }
  947. void BuiltinEditorResources::importGUITexture(const WString& name)
  948. {
  949. Path texturePath = FileSystem::getWorkingDirectoryPath();
  950. texturePath.append(DefaultSkinFolderRaw);
  951. texturePath.append(name);
  952. Path texOutputPath = FileSystem::getWorkingDirectoryPath();
  953. texOutputPath.append(DefaultSkinFolder);
  954. Path spriteTexOutputPath = texOutputPath;
  955. texOutputPath.append(name + L".asset");
  956. spriteTexOutputPath.append(L"sprite_" + name + L".asset");
  957. HTexture tex = Importer::instance().import<Texture>(texturePath);
  958. Resources::instance().save(tex, texOutputPath, true);
  959. HSpriteTexture spriteTex = SpriteTexture::create(tex);
  960. Resources::instance().save(spriteTex, spriteTexOutputPath, true);
  961. }
  962. HSpriteTexture BuiltinEditorResources::getGUITexture(const WString& name)
  963. {
  964. Path texturePath = FileSystem::getWorkingDirectoryPath();
  965. texturePath.append(DefaultSkinFolder);
  966. texturePath.append(L"sprite_" + name + L".asset");
  967. return Resources::instance().load<SpriteTexture>(texturePath);
  968. }
  969. HGpuProgram BuiltinEditorResources::getGpuProgram(const WString& name)
  970. {
  971. Path programPath = DefaultShaderFolder;
  972. programPath.append(mActiveShaderSubFolder);
  973. programPath.append(name + L".asset");
  974. return gResources().load<GpuProgram>(programPath);
  975. }
  976. void BuiltinEditorResources::initDockDropOverlayShader()
  977. {
  978. HGpuProgram vsProgram = getGpuProgram(ShaderDockOverlayVSFile);
  979. HGpuProgram psProgram = getGpuProgram(ShaderDockOverlayPSFile);
  980. mShaderDockOverlay = Shader::create("DockDropOverlayShader");
  981. mShaderDockOverlay->addParameter("invViewportWidth", "invViewportWidth", GPDT_FLOAT1);
  982. mShaderDockOverlay->addParameter("invViewportHeight", "invViewportHeight", GPDT_FLOAT1);
  983. mShaderDockOverlay->addParameter("tintColor", "tintColor", GPDT_FLOAT4);
  984. mShaderDockOverlay->addParameter("highlightColor", "highlightColor", GPDT_FLOAT4);
  985. mShaderDockOverlay->addParameter("highlightActive", "highlightActive", GPDT_FLOAT4);
  986. TechniquePtr newTechnique = mShaderDockOverlay->addTechnique(mActiveRenderSystem, RendererInvariant);
  987. PassPtr newPass = newTechnique->addPass();
  988. newPass->setVertexProgram(vsProgram);
  989. newPass->setFragmentProgram(psProgram);
  990. BLEND_STATE_DESC desc;
  991. desc.renderTargetDesc[0].blendEnable = true;
  992. desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
  993. desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
  994. desc.renderTargetDesc[0].blendOp = BO_ADD;
  995. HBlendState blendState = BlendState::create(desc);
  996. newPass->setBlendState(blendState);
  997. DEPTH_STENCIL_STATE_DESC depthStateDesc;
  998. depthStateDesc.depthReadEnable = false;
  999. depthStateDesc.depthWriteEnable = false;
  1000. HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
  1001. newPass->setDepthStencilState(depthState);
  1002. }
  1003. void BuiltinEditorResources::initSceneGridShader()
  1004. {
  1005. HGpuProgram vsProgram = getGpuProgram(SceneGridVSFile);
  1006. HGpuProgram psProgram = getGpuProgram(SceneGridPSFile);
  1007. mShaderSceneGrid = Shader::create("DebugDraw3DShader");
  1008. mShaderSceneGrid->addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
  1009. TechniquePtr newTechnique = mShaderSceneGrid->addTechnique(mActiveRenderSystem, RendererInvariant);
  1010. PassPtr newPass = newTechnique->addPass();
  1011. newPass->setVertexProgram(vsProgram);
  1012. newPass->setFragmentProgram(psProgram);
  1013. BLEND_STATE_DESC desc;
  1014. desc.renderTargetDesc[0].blendEnable = true;
  1015. desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
  1016. desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
  1017. desc.renderTargetDesc[0].blendOp = BO_ADD;
  1018. HBlendState blendState = BlendState::create(desc);
  1019. newPass->setBlendState(blendState);
  1020. }
  1021. HMaterial BuiltinEditorResources::createDockDropOverlayMaterial() const
  1022. {
  1023. return Material::create(mShaderDockOverlay);
  1024. }
  1025. HMaterial BuiltinEditorResources::createSceneGridMaterial() const
  1026. {
  1027. return Material::create(mShaderSceneGrid);
  1028. }
  1029. }