BsBuiltinEditorResources.cpp 59 KB

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