MaterialInspector.ts 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. //
  2. // Copyright (c) 2014-2016 THUNDERBEAST GAMES LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. import ScriptWidget = require("ui/ScriptWidget");
  23. import EditorUI = require("ui/EditorUI");
  24. import TextureSelector = require("./TextureSelector");
  25. var techniqueSource = new Atomic.UIMenuItemSource();
  26. var solidSource = new Atomic.UIMenuItemSource();
  27. solidSource.addItem(new Atomic.UIMenuItem("Diffuse", "Diffuse"));
  28. solidSource.addItem(new Atomic.UIMenuItem("Diffuse Emissive", "Diffuse Emissive"));
  29. solidSource.addItem(new Atomic.UIMenuItem("Diffuse Normal", "Diffuse Normal"));
  30. solidSource.addItem(new Atomic.UIMenuItem("Diffuse Specular", "Diffuse Specular"));
  31. solidSource.addItem(new Atomic.UIMenuItem("Diffuse Normal Specular", "Diffuse Normal Specular"));
  32. solidSource.addItem(new Atomic.UIMenuItem("Diffuse Unlit", "Diffuse Unlit"));
  33. solidSource.addItem(new Atomic.UIMenuItem("No Texture", "No Texture"));
  34. var tranSource = new Atomic.UIMenuItemSource();
  35. tranSource.addItem(new Atomic.UIMenuItem("Alpha", "Alpha"));
  36. tranSource.addItem(new Atomic.UIMenuItem("Alpha Mask", "Alpha Mask"));
  37. tranSource.addItem(new Atomic.UIMenuItem("Additive", "Additive"));
  38. tranSource.addItem(new Atomic.UIMenuItem("Additive Alpha", "Additive Alpha"));
  39. tranSource.addItem(new Atomic.UIMenuItem("Emissive Alpha", "Emissive Alpha"));
  40. tranSource.addItem(new Atomic.UIMenuItem("Alpha AO", "Alpha AO"));
  41. tranSource.addItem(new Atomic.UIMenuItem("Alpha Mask AO", "Alpha Mask AO"));
  42. var lightmapSource = new Atomic.UIMenuItemSource();
  43. lightmapSource.addItem(new Atomic.UIMenuItem("Lightmap", "Lightmap"));
  44. lightmapSource.addItem(new Atomic.UIMenuItem("Lightmap Alpha", "Lightmap Alpha"));
  45. var projectSource = new Atomic.UIMenuItemSource();
  46. var _ = new Atomic.UIMenuItem();
  47. var techniqueLookup = {
  48. "Techniques/Diff.xml": "Diffuse",
  49. "Techniques/DiffEmissive.xml": "Diffuse Emissive",
  50. "Techniques/DiffNormal.xml": "Diffuse Normal",
  51. "Techniques/DiffSpec.xml": "Diffuse Specular",
  52. "Techniques/DiffNormalSpec.xml": "Diffuse Normal Specular",
  53. "Techniques/DiffUnlit.xml": "Diffuse Unlit",
  54. "Techniques/DiffAlpha.xml": "Alpha",
  55. "Techniques/DiffAlphaMask.xml": "Alpha Mask",
  56. "Techniques/DiffAdd.xml": "Additive",
  57. "Techniques/NoTexture.xml": "No Texture",
  58. "Techniques/DiffLightMap.xml": "Lightmap",
  59. "Techniques/DiffLightMapAlpha.xml": "Lightmap Alpha"
  60. };
  61. var techniqueReverseLookup = {};
  62. var projectTechniques = {};
  63. var projectTechniquesAddress = {};
  64. for (var key in techniqueLookup) {
  65. techniqueReverseLookup[techniqueLookup[key]] = key;
  66. }
  67. class MaterialInspector extends ScriptWidget {
  68. currentTexture: Atomic.UITextureWidget = null;
  69. tunit: number;
  70. textureWidget: Atomic.UITextureWidget;
  71. constructor() {
  72. super();
  73. this.fd.id = "Vera";
  74. this.fd.size = 11;
  75. this.subscribeToEvent(ToolCore.ResourceAddedEvent((ev: ToolCore.ResourceAddedEvent) => this.refreshTechniquesPopup()));
  76. }
  77. createShaderParametersSection(): Atomic.UISection {
  78. var section = new Atomic.UISection();
  79. section.text = "Shader Paramaters";
  80. section.value = 1;
  81. section.fontDescription = this.fd;
  82. var attrsVerticalLayout = new Atomic.UILayout(Atomic.UI_AXIS.UI_AXIS_Y);
  83. attrsVerticalLayout.spacing = 3;
  84. attrsVerticalLayout.layoutPosition = Atomic.UI_LAYOUT_POSITION.UI_LAYOUT_POSITION_LEFT_TOP;
  85. attrsVerticalLayout.layoutSize = Atomic.UI_LAYOUT_SIZE.UI_LAYOUT_SIZE_AVAILABLE;
  86. section.contentRoot.addChild(attrsVerticalLayout);
  87. var params = this.material.getShaderParameters();
  88. for (var i in params) {
  89. var attrLayout = new Atomic.UILayout();
  90. attrLayout.layoutDistribution = Atomic.UI_LAYOUT_DISTRIBUTION.UI_LAYOUT_DISTRIBUTION_GRAVITY;
  91. var name = new Atomic.UITextField();
  92. name.textAlign = Atomic.UI_TEXT_ALIGN.UI_TEXT_ALIGN_LEFT;
  93. name.skinBg = "InspectorTextAttrName";
  94. name.text = params[i].name;
  95. name.fontDescription = this.fd;
  96. attrLayout.addChild(name);
  97. var field = new Atomic.UIEditField();
  98. field.textAlign = Atomic.UI_TEXT_ALIGN.UI_TEXT_ALIGN_LEFT;
  99. field.skinBg = "TBAttrEditorField";
  100. field.fontDescription = this.fd;
  101. var lp = new Atomic.UILayoutParams();
  102. lp.width = 140;
  103. field.layoutParams = lp;
  104. field.id = params[i].name;
  105. field.text = params[i].valueString;
  106. field.subscribeToEvent(field, Atomic.UIWidgetEvent(function (ev: Atomic.UIWidgetEvent) {
  107. if (ev.type == Atomic.UI_EVENT_TYPE.UI_EVENT_TYPE_CHANGED) {
  108. var field = <Atomic.UIEditField>ev.target;
  109. this.material.setShaderParameter(field.id, field.text);
  110. }
  111. }.bind(this)));
  112. attrLayout.addChild(field);
  113. attrsVerticalLayout.addChild(attrLayout);
  114. // print(params[i].name, " : ", params[i].value, " : ", params[i].type);
  115. }
  116. return section;
  117. }
  118. getTextureThumbnail(texture: Atomic.Texture): Atomic.Texture {
  119. if (!texture) return null;
  120. var db = ToolCore.getAssetDatabase();
  121. var asset = db.getAssetByPath(texture.name);
  122. if (!asset)
  123. return texture;
  124. var thumbnail = asset.cachePath + "_thumbnail.png";
  125. var cache = Atomic.getResourceCache();
  126. var thumb = <Atomic.Texture2D>cache.getTempResource("Texture2D", thumbnail);
  127. if (thumb)
  128. return thumb;
  129. return texture;
  130. }
  131. onTechniqueSet(techniqueName: string) {
  132. this.techniqueButton.text = techniqueName;
  133. var cache = Atomic.getResourceCache();
  134. var technique = <Atomic.Technique>cache.getResource("Technique", techniqueReverseLookup[techniqueName]);
  135. var resourcePath = ToolCore.toolSystem.project.getResourcePath();
  136. if (technique == null) {
  137. var techniquePath = "";
  138. for (var i in projectTechniques) {
  139. if (techniqueName == projectTechniques[i]) {
  140. techniquePath = projectTechniquesAddress[i];
  141. break;
  142. }
  143. }
  144. techniquePath = techniquePath.replace(resourcePath, "");
  145. technique = <Atomic.Technique>cache.getResource("Technique", techniquePath);
  146. }
  147. this.material.setTechnique(0, technique);
  148. }
  149. createTechniquePopup(): Atomic.UIWidget {
  150. this.refreshTechniquesPopup();
  151. var button = this.techniqueButton = new Atomic.UIButton();
  152. var technique = this.material.getTechnique(0);
  153. var techniqueName = "";
  154. if (technique != null) {
  155. techniqueName = technique.name.replace("Techniques/", "").replace(".xml", "");
  156. } else {
  157. techniqueName = "UNDEFINED";
  158. }
  159. button.text = techniqueName;
  160. button.fontDescription = this.fd;
  161. var lp = new Atomic.UILayoutParams();
  162. lp.width = 140;
  163. button.layoutParams = lp;
  164. button.onClick = function () {
  165. var menu = new Atomic.UIMenuWindow(button, "technique popup");
  166. menu.fontDescription = this.fd;
  167. menu.show(techniqueSource);
  168. button.subscribeToEvent(button, Atomic.UIWidgetEvent(function (ev: Atomic.UIWidgetEvent) {
  169. if (ev.type != Atomic.UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK)
  170. return;
  171. if (ev.target && ev.target.id == "technique popup") {
  172. this.onTechniqueSet(ev.refid);
  173. }
  174. }.bind(this)));
  175. }.bind(this);
  176. return button;
  177. }
  178. acceptAssetDrag(importerTypeName: string, ev: Atomic.DragEndedEvent): ToolCore.AssetImporter {
  179. var dragObject = ev.dragObject;
  180. if (dragObject.object && dragObject.object.typeName == "Asset") {
  181. var asset = <ToolCore.Asset>dragObject.object;
  182. if (asset.importerTypeName == importerTypeName) {
  183. return asset.importer;
  184. }
  185. }
  186. return null;
  187. }
  188. openTextureSelectionBox(textureUnit: number, textureWidget: Atomic.UITextureWidget) {
  189. EditorUI.getModelOps().showResourceSelection("Select Texture", "TextureImporter", "Texture2D", function (asset: ToolCore.Asset, args: any) {
  190. if (asset == null) {
  191. this.createTextureRemoveButtonCallback(this.tunit, this.textureWidget);
  192. return;
  193. }
  194. var texture = <Atomic.Texture2D>Atomic.cache.getResource("Texture2D", asset.path);
  195. if (texture) {
  196. this.material.setTexture(textureUnit, texture);
  197. textureWidget.texture = this.getTextureThumbnail(texture);
  198. }
  199. }.bind(this));
  200. }
  201. // Big Texture Button(referenced texture file path in project frame)
  202. createTextureButtonCallback(textureUnit: number, textureWidget: Atomic.UITextureWidget) {
  203. return () => {
  204. var texture = this.material.getTexture(textureUnit);
  205. if (textureWidget.getTexture() != null) {
  206. this.sendEvent(Editor.InspectorProjectReferenceEventData({ "path": texture.getName() }));
  207. } else {
  208. this.openTextureSelectionBox(textureUnit, textureWidget);
  209. }
  210. return true;
  211. };
  212. }
  213. // Small Texture Button (Opens texture selection window)
  214. createTextureReferenceButtonCallback(textureUnit: number, textureWidget: Atomic.UITextureWidget) {
  215. return () => {
  216. this.tunit = textureUnit;
  217. this.textureWidget = textureWidget;
  218. this.openTextureSelectionBox(textureUnit, textureWidget);
  219. return true;
  220. };
  221. }
  222. //Remove Texture Button
  223. createTextureRemoveButtonCallback(textureUnit: number, textureWidget: Atomic.UITextureWidget) {
  224. var texture = this.material.getTexture(textureUnit);
  225. if (texture != null && textureWidget != null) {
  226. textureWidget.setTexture(null);
  227. this.material.setTexture(textureUnit, null);
  228. }
  229. }
  230. createTextureSection(): Atomic.UISection {
  231. var section = new Atomic.UISection();
  232. section.text = "Textures";
  233. section.value = 1;
  234. section.fontDescription = this.fd;
  235. var attrsVerticalLayout = new Atomic.UILayout(Atomic.UI_AXIS.UI_AXIS_Y);
  236. attrsVerticalLayout.spacing = 3;
  237. attrsVerticalLayout.layoutPosition = Atomic.UI_LAYOUT_POSITION.UI_LAYOUT_POSITION_LEFT_TOP;
  238. attrsVerticalLayout.layoutSize = Atomic.UI_LAYOUT_SIZE.UI_LAYOUT_SIZE_AVAILABLE;
  239. section.contentRoot.addChild(attrsVerticalLayout);
  240. // TODO: Filter on technique
  241. var textureUnits = [Atomic.TextureUnit.TU_DIFFUSE, Atomic.TextureUnit.TU_NORMAL, Atomic.TextureUnit.TU_SPECULAR, Atomic.TextureUnit.TU_EMISSIVE];
  242. for (var i in textureUnits) {
  243. var tunit: Atomic.TextureUnit = textureUnits[i];
  244. var tunitName = Atomic.Material.getTextureUnitName(tunit);
  245. var attrLayout = new Atomic.UILayout();
  246. attrLayout.layoutDistribution = Atomic.UI_LAYOUT_DISTRIBUTION.UI_LAYOUT_DISTRIBUTION_GRAVITY;
  247. var name = new Atomic.UITextField();
  248. name.textAlign = Atomic.UI_TEXT_ALIGN.UI_TEXT_ALIGN_LEFT;
  249. name.skinBg = "InspectorTextAttrName";
  250. name.text = tunitName;
  251. name.fontDescription = this.fd;
  252. attrLayout.addChild(name);
  253. var textureWidget = new Atomic.UITextureWidget();
  254. var tlp = new Atomic.UILayoutParams();
  255. tlp.width = 64;
  256. tlp.height = 64;
  257. textureWidget.layoutParams = tlp;
  258. textureWidget.texture = this.getTextureThumbnail(this.material.getTexture(tunit));
  259. var textureButton = new Atomic.UIButton();
  260. textureButton.skinBg = "TBButton.flatoutline";
  261. textureButton["tunit"] = tunit;
  262. textureButton["textureWidget"] = textureWidget;
  263. //Create drop-down buttons to open Texture Selection Dialog Box
  264. var textureRefButton = new Atomic.UIButton();
  265. textureRefButton.skinBg = "arrow.down";
  266. textureRefButton["tunit"] = tunit;
  267. textureRefButton["textureWidget"] = textureWidget;
  268. textureButton.onClick = this.createTextureButtonCallback(tunit, textureWidget);
  269. textureRefButton.onClick = this.createTextureReferenceButtonCallback(tunit, textureWidget);
  270. textureButton.contentRoot.addChild(textureWidget);
  271. attrLayout.addChild(textureButton);
  272. attrLayout.addChild(textureRefButton);
  273. attrsVerticalLayout.addChild(attrLayout);
  274. // handle dropping of texture on widget
  275. textureButton.subscribeToEvent(textureButton, Atomic.DragEndedEvent((ev: Atomic.DragEndedEvent) => {
  276. var importer = this.acceptAssetDrag("TextureImporter", ev);
  277. if (importer) {
  278. var textureImporter = <ToolCore.TextureImporter>importer;
  279. var asset = textureImporter.asset;
  280. var texture = <Atomic.Texture2D>Atomic.cache.getResource("Texture2D", asset.path);
  281. if (texture) {
  282. this.material.setTexture(ev.target["tunit"], texture);
  283. (<Atomic.UITextureWidget>ev.target["textureWidget"]).texture = this.getTextureThumbnail(texture);
  284. // note, ButtonID has been commented out because it doesn't appear to be used anywhere
  285. this.sendEvent(Editor.InspectorProjectReferenceEventData({ "path": texture.getName() /* "ButtonID": texture.getName() */ }));
  286. }
  287. }
  288. }));
  289. }
  290. return section;
  291. }
  292. loadProjectTechniques(directory: string, menuItem: Atomic.UIMenuItemSource) {
  293. var resourcePath = ToolCore.toolSystem.project.getResourcePath();
  294. var TechniqueAssets = ToolCore.getAssetDatabase().getFolderAssets(directory);
  295. for (var i = 0; i < TechniqueAssets.length; i++) {
  296. var asset = TechniqueAssets[i];
  297. if (TechniqueAssets[i].isFolder()) {
  298. if (this.scanDirectoryForTechniques(asset.path)) {
  299. var subfoldersource = new Atomic.UIMenuItemSource();
  300. _ = new Atomic.UIMenuItem(TechniqueAssets[i].name);
  301. _.subSource = subfoldersource;
  302. menuItem.addItem(_);
  303. this.loadProjectTechniques(asset.path, subfoldersource);
  304. }
  305. }
  306. else {
  307. projectTechniques[i] = TechniqueAssets[i].name;
  308. projectTechniquesAddress[i] = TechniqueAssets[i].path;
  309. menuItem.addItem(new Atomic.UIMenuItem(projectTechniques[i], projectTechniques[i]));
  310. }
  311. }
  312. }
  313. scanDirectoryForTechniques(directory: string): boolean {
  314. var techniqueAssets = ToolCore.getAssetDatabase().getFolderAssets(directory);
  315. for (var i = 0; i < techniqueAssets.length; i++) {
  316. var asset = techniqueAssets[i];
  317. if (techniqueAssets[i].isFolder()) {
  318. if (this.scanDirectoryForTechniques(asset.path)) {
  319. return true;
  320. }
  321. }
  322. else if (techniqueAssets[i].getExtension() == ".xml") {
  323. return true;
  324. }
  325. }
  326. return false;
  327. }
  328. refreshTechniquesPopup() {
  329. techniqueSource.clear();
  330. _ = new Atomic.UIMenuItem("Solid");
  331. _.subSource = solidSource;
  332. techniqueSource.addItem(_);
  333. _ = new Atomic.UIMenuItem("Transparency");
  334. _.subSource = tranSource;
  335. techniqueSource.addItem(_);
  336. _ = new Atomic.UIMenuItem("Lightmap");
  337. _.subSource = lightmapSource;
  338. techniqueSource.addItem(_);
  339. var projectTechniquesPath = ToolCore.toolSystem.project.getResourcePath() + "Techniques";
  340. if (Atomic.fileSystem.dirExists(projectTechniquesPath)) {
  341. if (this.scanDirectoryForTechniques(projectTechniquesPath)) {
  342. projectSource.clear();
  343. _ = new Atomic.UIMenuItem("Project");
  344. _.subSource = projectSource;
  345. techniqueSource.addItem(_);
  346. this.loadProjectTechniques(projectTechniquesPath, projectSource);
  347. }
  348. }
  349. }
  350. inspect(asset: ToolCore.Asset, material: Atomic.Material) {
  351. // Add folders to resource directory
  352. this.asset = asset;
  353. this.material = material;
  354. var mlp = new Atomic.UILayoutParams();
  355. mlp.width = 310;
  356. var materialLayout = new Atomic.UILayout();
  357. materialLayout.spacing = 4;
  358. materialLayout.layoutDistribution = Atomic.UI_LAYOUT_DISTRIBUTION.UI_LAYOUT_DISTRIBUTION_GRAVITY;
  359. materialLayout.layoutPosition = Atomic.UI_LAYOUT_POSITION.UI_LAYOUT_POSITION_LEFT_TOP;
  360. materialLayout.layoutParams = mlp;
  361. materialLayout.axis = Atomic.UI_AXIS.UI_AXIS_Y;
  362. // node attr layout
  363. var materialSection = new Atomic.UISection();
  364. materialSection.text = "Material";
  365. materialSection.value = 1;
  366. materialSection.fontDescription = this.fd;
  367. materialLayout.addChild(materialSection);
  368. var attrsVerticalLayout = new Atomic.UILayout(Atomic.UI_AXIS.UI_AXIS_Y);
  369. attrsVerticalLayout.spacing = 3;
  370. attrsVerticalLayout.layoutPosition = Atomic.UI_LAYOUT_POSITION.UI_LAYOUT_POSITION_LEFT_TOP;
  371. attrsVerticalLayout.layoutSize = Atomic.UI_LAYOUT_SIZE.UI_LAYOUT_SIZE_PREFERRED;
  372. // NAME
  373. var nameLayout = new Atomic.UILayout();
  374. nameLayout.layoutDistribution = Atomic.UI_LAYOUT_DISTRIBUTION.UI_LAYOUT_DISTRIBUTION_GRAVITY;
  375. var name = new Atomic.UITextField();
  376. name.textAlign = Atomic.UI_TEXT_ALIGN.UI_TEXT_ALIGN_LEFT;
  377. name.skinBg = "InspectorTextAttrName";
  378. name.text = "Name";
  379. name.fontDescription = this.fd;
  380. nameLayout.addChild(name);
  381. var field = new Atomic.UIEditField();
  382. field.textAlign = Atomic.UI_TEXT_ALIGN.UI_TEXT_ALIGN_LEFT;
  383. field.skinBg = "TBAttrEditorField";
  384. field.fontDescription = this.fd;
  385. var lp = new Atomic.UILayoutParams();
  386. lp.width = 160;
  387. field.layoutParams = lp;
  388. field.text = Atomic.splitPath(material.name).fileName;
  389. nameLayout.addChild(field);
  390. attrsVerticalLayout.addChild(nameLayout);
  391. // TECHNIQUE LAYOUT
  392. var techniqueLayout = new Atomic.UILayout();
  393. techniqueLayout.layoutSize = Atomic.UI_LAYOUT_SIZE.UI_LAYOUT_SIZE_GRAVITY;
  394. techniqueLayout.layoutDistribution = Atomic.UI_LAYOUT_DISTRIBUTION.UI_LAYOUT_DISTRIBUTION_PREFERRED;
  395. name = new Atomic.UITextField();
  396. name.textAlign = Atomic.UI_TEXT_ALIGN.UI_TEXT_ALIGN_LEFT;
  397. name.skinBg = "InspectorTextAttrName";
  398. name.text = "Technique";
  399. name.fontDescription = this.fd;
  400. techniqueLayout.addChild(name);
  401. var techniquePopup = this.createTechniquePopup();
  402. techniqueLayout.addChild(techniquePopup);
  403. attrsVerticalLayout.addChild(techniqueLayout);
  404. materialSection.contentRoot.addChild(attrsVerticalLayout);
  405. materialLayout.addChild(this.createTextureSection());
  406. materialLayout.addChild(this.createShaderParametersSection());
  407. var button = new Atomic.UIButton();
  408. button.fontDescription = this.fd;
  409. button.gravity = Atomic.UI_GRAVITY.UI_GRAVITY_RIGHT;
  410. button.text = "Save";
  411. button.onClick = function () {
  412. var importer = <ToolCore.MaterialImporter>this.asset.getImporter();
  413. importer.saveMaterial();
  414. }.bind(this);
  415. materialLayout.addChild(button);
  416. this.addChild(materialLayout);
  417. }
  418. techniqueButton: Atomic.UIButton;
  419. material: Atomic.Material;
  420. asset: ToolCore.Asset;
  421. nameTextField: Atomic.UITextField;
  422. fd: Atomic.UIFontDescription = new Atomic.UIFontDescription();
  423. }
  424. export = MaterialInspector;