BsBuiltinEditorResources.cpp 68 KB

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