MaterialInspector.ts 21 KB

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