BsBuiltinEditorResources.cpp 55 KB

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