BsBuiltinEditorResources.cpp 65 KB

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