SelectionInspector.ts 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895
  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 EditorUI = require("../../EditorUI");
  23. import CreateComponentButton = require("./CreateComponentButton");
  24. import ScriptWidget = require("ui/ScriptWidget");
  25. import EditorEvents = require("editor/EditorEvents");
  26. import SerializableEditType = require("./SerializableEditType");
  27. import SelectionSection = require("./SelectionSection");
  28. import SelectionPrefabWidget = require("./SelectionPrefabWidget");
  29. import AttributeInfoEdit = require("./AttributeInfoEdit");
  30. class NodeSection extends SelectionSection {
  31. prefabWidget: SelectionPrefabWidget;
  32. transformEdits: AttributeInfoEdit[] = [];
  33. updateDelta: number = 0.0;
  34. constructor(editType: SerializableEditType) {
  35. super(editType);
  36. this.prefabWidget = new SelectionPrefabWidget();
  37. this.attrLayout.addChild(this.prefabWidget);
  38. this.transformEdits.push(this.attrEdits["Position"]);
  39. this.transformEdits.push(this.attrEdits["Rotation"]);
  40. this.transformEdits.push(this.attrEdits["Scale"]);
  41. this.subscribeToEvent("Update", (ev) => this.handleUpdate(ev));
  42. }
  43. handleUpdate(ev) {
  44. this.updateDelta -= ev.timeStep;
  45. if (this.updateDelta < 0.0) {
  46. this.updateDelta = 0.1;
  47. Atomic.ui.blockChangedEvents = true;
  48. for (var i in this.transformEdits) {
  49. this.transformEdits[i].refresh();
  50. }
  51. Atomic.ui.blockChangedEvents = false;
  52. }
  53. }
  54. }
  55. class ComponentSection extends SelectionSection {
  56. constructor(editType: SerializableEditType, inspector: SelectionInspector) {
  57. super(editType);
  58. var deleteButton = new Atomic.UIButton();
  59. deleteButton.text = "Delete Component";
  60. deleteButton.fontDescription = SelectionSection.fontDesc;
  61. deleteButton.onClick = () => {
  62. inspector.onComponentDelete(editType);
  63. return true;
  64. };
  65. var copyButton = new Atomic.UIButton();
  66. copyButton.text = "Copy Settings";
  67. copyButton.onClick = () => {
  68. inspector.onComponentCopy(editType);
  69. return true;
  70. };
  71. var pasteButton = new Atomic.UIButton();
  72. pasteButton.text = "Paste Settings";
  73. pasteButton.onClick = () => {
  74. inspector.onComponentPaste(editType);
  75. return true;
  76. };
  77. this.attrLayout.addChild(deleteButton);
  78. this.attrLayout.addChild(copyButton);
  79. this.attrLayout.addChild(pasteButton);
  80. }
  81. }
  82. class SceneSection extends SelectionSection {
  83. constructor(editType: SerializableEditType) {
  84. super(editType);
  85. }
  86. }
  87. interface AttributeEditResourceChangedEvent {
  88. attrInfoEdit: AttributeInfoEdit;
  89. resource: Atomic.Resource;
  90. }
  91. class JSComponentSection extends ComponentSection {
  92. constructor(editType: SerializableEditType, inspector: SelectionInspector) {
  93. super(editType, inspector);
  94. this.hasDynamicAttr = true;
  95. this.subscribeToEvent(this, "AttributeEditResourceChanged", (ev) => this.handleAttributeEditResourceChanged(ev));
  96. this.updateTitleFromComponentClass();
  97. }
  98. private handleAttributeEditResourceChanged(ev: AttributeEditResourceChangedEvent) {
  99. var jsc = <Atomic.JSComponent>this.editType.getFirstObject();
  100. if (!jsc)
  101. return;
  102. var attrInfos = jsc.getAttributes();
  103. this.updateDynamicAttrInfos(attrInfos);
  104. this.updateTitleFromComponentClass();
  105. }
  106. private updateTitleFromComponentClass() {
  107. this.text = this.editType.typeName;
  108. let jsc = this.editType.getFirstObject() as Atomic.JSComponent;
  109. if (jsc && jsc.componentFile) {
  110. this.text = jsc.componentFile.name.split("/").pop();
  111. }
  112. }
  113. }
  114. class CSComponentSection extends ComponentSection {
  115. constructor(editType: SerializableEditType, inspector: SelectionInspector) {
  116. super(editType, inspector);
  117. this.updateTextFromClassAttr();
  118. this.hasDynamicAttr = true;
  119. this.subscribeToEvent(this, "AttributeEditResourceChanged", (ev) => this.handleAttributeEditResourceChanged(ev));
  120. this.subscribeToEvent("CSComponentAssemblyChanged", (ev) => this.handleCSComponentAssemblyChanged(ev));
  121. this.subscribeToEvent("CSComponentClassChanged", (ev) => this.handleCSComponentClassChanged(ev));
  122. }
  123. private handleCSComponentAssemblyChanged(ev) {
  124. var csc = <AtomicNETScript.CSComponent>this.editType.getFirstObject();
  125. if (!csc)
  126. return;
  127. if (csc.componentFile == <Atomic.ScriptComponentFile> ev.resource) {
  128. var attrInfos = csc.getAttributes();
  129. this.updateDynamicAttrInfos(attrInfos);
  130. this.updateTextFromClassAttr();
  131. }
  132. }
  133. private handleCSComponentClassChanged(ev) {
  134. var csc = <AtomicNETScript.CSComponent>this.editType.getFirstObject();
  135. if (!csc)
  136. return;
  137. var attrInfos = csc.getAttributes();
  138. this.updateDynamicAttrInfos(attrInfos);
  139. this.updateTextFromClassAttr();
  140. }
  141. private handleAttributeEditResourceChanged(ev: AttributeEditResourceChangedEvent) {
  142. var csc = <AtomicNETScript.CSComponent>this.editType.getFirstObject();
  143. if (!csc)
  144. return;
  145. var attrInfos = csc.getAttributes();
  146. this.updateDynamicAttrInfos(attrInfos);
  147. }
  148. private updateTextFromClassAttr() {
  149. this.text = this.editType.typeName;
  150. var object = this.editType.getFirstObject();
  151. if (object) {
  152. var value = object.getAttribute("Class");
  153. if (value)
  154. this.text = value + " - C#";
  155. }
  156. }
  157. }
  158. // Node Inspector + Component Inspectors
  159. class SelectionInspector extends ScriptWidget {
  160. component: Atomic.Component;
  161. constructor(sceneEditor: Editor.SceneEditor3D) {
  162. super();
  163. this.sceneEditor = sceneEditor;
  164. var mainLayout = this.mainLayout = new Atomic.UILayout();
  165. mainLayout.spacing = 4;
  166. var lp = new Atomic.UILayoutParams();
  167. lp.width = 304;
  168. mainLayout.layoutDistribution = Atomic.UI_LAYOUT_DISTRIBUTION.UI_LAYOUT_DISTRIBUTION_GRAVITY;
  169. mainLayout.layoutPosition = Atomic.UI_LAYOUT_POSITION.UI_LAYOUT_POSITION_LEFT_TOP;
  170. mainLayout.layoutParams = lp;
  171. mainLayout.axis = Atomic.UI_AXIS.UI_AXIS_Y;
  172. this.addChild(mainLayout);
  173. var noticeLayout = this.multipleSelectNotice = new Atomic.UILayout();
  174. noticeLayout.axis = Atomic.UI_AXIS.UI_AXIS_Y;
  175. noticeLayout.layoutParams = lp;
  176. var noticeText = new Atomic.UITextField();
  177. noticeText.textAlign = Atomic.UI_TEXT_ALIGN.UI_TEXT_ALIGN_CENTER;
  178. noticeText.skinBg = "InspectorTextAttrName";
  179. noticeText.text = "Multiple Selection - Some components are hidden";
  180. noticeText.fontDescription = SelectionSection.fontDesc;
  181. noticeText.gravity = Atomic.UI_GRAVITY.UI_GRAVITY_LEFT_RIGHT;
  182. noticeText.layoutParams = lp;
  183. noticeLayout.addChild(noticeText);
  184. noticeLayout.visibility = Atomic.UI_WIDGET_VISIBILITY.UI_WIDGET_VISIBILITY_GONE;
  185. mainLayout.addChild(noticeLayout);
  186. this.createComponentButton = new CreateComponentButton();
  187. mainLayout.addChild(this.createComponentButton);
  188. this.subscribeToEvent(sceneEditor.scene, "SceneEditStateChangesBegin", (data) => this.handleSceneEditStateChangesBeginEvent());
  189. this.subscribeToEvent("SceneEditStateChange", (data) => this.handleSceneEditStateChangeEvent(data));
  190. this.subscribeToEvent(sceneEditor.scene, "SceneEditStateChangesEnd", (data) => this.handleSceneEditStateChangesEndEvent());
  191. this.subscribeToEvent(sceneEditor.scene, "SceneEditNodeRemoved", (ev: Editor.SceneEditNodeRemovedEvent) => this.handleSceneEditNodeRemoved(ev));
  192. this.subscribeToEvent(sceneEditor.scene, "SceneEditComponentAddedRemoved", (ev) => this.handleSceneEditComponentAddedRemovedEvent(ev));
  193. this.subscribeToEvent(this.createComponentButton, "SelectionCreateComponent", (data) => this.handleSelectionCreateComponent(data));
  194. }
  195. pruneSections() {
  196. var remove: SelectionSection[] = [];
  197. for (var i in this.sections) {
  198. var section = this.sections[i];
  199. var editType = section.editType;
  200. if (editType.typeName == "Node") {
  201. continue;
  202. }
  203. if (editType.typeName == "Scene") {
  204. var gotone = false;
  205. for (var j in this.nodes) {
  206. if (this.nodes[j].typeName == "Scene") {
  207. gotone = true;
  208. break;
  209. }
  210. }
  211. if (gotone)
  212. continue;
  213. }
  214. if (!editType.nodes.length) {
  215. remove.push(section);
  216. }
  217. }
  218. if (remove.length) {
  219. for (var i in remove) {
  220. var section = remove[i];
  221. this.removeSection(section);
  222. }
  223. this.suppressSections();
  224. }
  225. }
  226. suppressSections() {
  227. this.multipleSelectNotice.visibility = Atomic.UI_WIDGET_VISIBILITY.UI_WIDGET_VISIBILITY_GONE;
  228. for (var i in this.sections) {
  229. var section = this.sections[i];
  230. var editType = section.editType;
  231. if (editType.typeName == "Node" || editType.typeName == "Scene") {
  232. continue;
  233. }
  234. var suppressed = false;
  235. for (var j in this.nodes) {
  236. if (editType.nodes.indexOf(this.nodes[j]) == -1) {
  237. suppressed = true;
  238. break;
  239. }
  240. }
  241. if (suppressed)
  242. this.multipleSelectNotice.visibility = Atomic.UI_WIDGET_VISIBILITY.UI_WIDGET_VISIBILITY_VISIBLE;
  243. section.suppress(suppressed);
  244. }
  245. }
  246. refresh() {
  247. Atomic.ui.blockChangedEvents = true;
  248. this.pruneSections();
  249. this.suppressSections();
  250. for (var i in this.sections) {
  251. this.sections[i].refresh();
  252. }
  253. if (this.nodeSection) {
  254. this.nodeSection.prefabWidget.updateSelection(this.nodes);
  255. }
  256. Atomic.ui.blockChangedEvents = false;
  257. }
  258. addSection(editType: SerializableEditType) {
  259. var section: SelectionSection;
  260. if (editType.typeName == "Node") {
  261. this.nodeSection = new NodeSection(editType);
  262. section = this.nodeSection;
  263. } else if (editType.typeName == "Scene") {
  264. section = new SceneSection(editType);
  265. } else if (editType.typeName == "JSComponent") {
  266. section = new JSComponentSection(editType, this);
  267. } else if (editType.typeName == "CSComponent") {
  268. section = new CSComponentSection(editType, this);
  269. }
  270. else {
  271. section = new ComponentSection(editType, this);
  272. }
  273. section.value = SelectionInspector.sectionStates[editType.typeName] ? 1 : 0;
  274. this.mainLayout.removeChild(this.createComponentButton, false);
  275. this.mainLayout.removeChild(this.multipleSelectNotice, false);
  276. // sort it in alphabetically
  277. this.sections.push(section);
  278. this.sections.sort(function(a, b) {
  279. if (a.editType.typeName == "Node" && b.editType.typeName == "Scene")
  280. return -1;
  281. if (a.editType.typeName == "Scene" && b.editType.typeName == "Node")
  282. return 1;
  283. if (a.editType.typeName == "Node" || a.editType.typeName == "Scene")
  284. return -1;
  285. if (b.editType.typeName == "Node" || b.editType.typeName == "Scene")
  286. return 1;
  287. return a.editType.typeName.localeCompare(b.editType.typeName);
  288. });
  289. var idx = this.sections.indexOf(section);
  290. if (idx == 0) {
  291. if (this.sections.length == 1) {
  292. this.mainLayout.addChild(section);
  293. } else {
  294. this.mainLayout.addChildBefore(section, this.sections[1]);
  295. }
  296. }
  297. else if (idx == this.sections.length - 1) {
  298. this.mainLayout.addChild(section);
  299. }
  300. else {
  301. this.mainLayout.addChildAfter(section, this.sections[idx - 1]);
  302. }
  303. // move the create component button down
  304. this.mainLayout.addChild(this.multipleSelectNotice);
  305. this.mainLayout.addChild(this.createComponentButton);
  306. }
  307. removeSection(section: SelectionSection) {
  308. SelectionInspector.sectionStates[section.editType.typeName] = section.value ? true : false;
  309. var index = this.sections.indexOf(section);
  310. this.sections.splice(index, 1);
  311. this.mainLayout.removeChild(section);
  312. }
  313. removeSerializable(serial: Atomic.Serializable) {
  314. for (var i in this.sections) {
  315. var section = this.sections[i];
  316. var e = section.editType;
  317. var index = e.objects.indexOf(serial);
  318. if (index != -1) {
  319. e.objects.splice(index, 1);
  320. }
  321. if (serial.typeName == "Node") {
  322. index = e.nodes.indexOf(<Atomic.Node>serial);
  323. if (index != -1) {
  324. e.nodes.splice(index, 1);
  325. }
  326. }
  327. }
  328. }
  329. addSerializable(serial: Atomic.Serializable): SerializableEditType {
  330. var editType = this.getEditType(serial);
  331. // does it already exist?
  332. for (var i in this.sections) {
  333. var section = this.sections[i];
  334. var e = section.editType;
  335. if (e.compareTypes(editType, this.nodes.length > 1)) {
  336. e.addSerializable(serial);
  337. return e;
  338. }
  339. }
  340. this.addSection(editType);
  341. return editType;
  342. }
  343. getEditType(serial: Atomic.Serializable): SerializableEditType {
  344. var typeName = serial.typeName;
  345. if (SelectionInspector._editTypes[typeName]) {
  346. return new SelectionInspector._editTypes[typeName](serial);
  347. }
  348. return new SerializableEditType(serial);
  349. }
  350. addNode(node: Atomic.Node) {
  351. var index = this.nodes.indexOf(node);
  352. if (index == -1) {
  353. this.nodes.push(node);
  354. this.addSerializable(node);
  355. var components = node.getComponents();
  356. for (var i in components) {
  357. if (this.filterComponent(components[i]))
  358. continue;
  359. var editType = this.addSerializable(components[i]);
  360. editType.addNode(node);
  361. }
  362. this.refresh();
  363. }
  364. }
  365. removeNode(node: Atomic.Node) {
  366. var index = this.nodes.indexOf(node);
  367. if (index != -1) {
  368. this.nodes.splice(index, 1);
  369. this.removeSerializable(node);
  370. var components = node.getComponents();
  371. for (var i in components) {
  372. if (this.filterComponent(components[i]))
  373. continue;
  374. this.removeSerializable(components[i]);
  375. }
  376. this.refresh();
  377. }
  378. // save node section state
  379. if (!this.nodes.length && this.nodeSection)
  380. SelectionInspector.sectionStates["Node"] = this.nodeSection.value ? true : false;
  381. }
  382. handleSceneEditStateChangesBeginEvent() {
  383. this.stateChangesInProgress = true;
  384. }
  385. handleSceneEditNodeRemoved(ev: Editor.SceneEditNodeRemovedEvent) {
  386. this.removeNode(ev.node);
  387. }
  388. handleSceneEditComponentAddedRemovedEvent(ev: Editor.SceneEditComponentAddedRemovedEvent) {
  389. if (this.filterComponent(ev.component)) {
  390. // still refresh as may affect UI (for example PrefabComponents)
  391. this.refresh();
  392. return;
  393. }
  394. var editType;
  395. if (!ev.removed) {
  396. editType = this.addSerializable(ev.component);
  397. editType.addNode(ev.node);
  398. } else {
  399. for (var i in this.sections) {
  400. var section = this.sections[i];
  401. editType = section.editType;
  402. var index = editType.objects.indexOf(ev.component);
  403. if (index != -1) {
  404. editType.objects.splice(index, 1);
  405. index = editType.nodes.indexOf(ev.node);
  406. if (index != -1) {
  407. editType.nodes.splice(index, 1);
  408. }
  409. break;
  410. }
  411. }
  412. }
  413. this.refresh();
  414. }
  415. onComponentDelete(editType: SerializableEditType) {
  416. var removed: Atomic.Component[] = [];
  417. for (var i in editType.objects) {
  418. var c = <Atomic.Component>editType.objects[i];
  419. removed.push(c);
  420. }
  421. for (var i in removed) {
  422. var c = removed[i];
  423. var node = c.node;
  424. c.remove();
  425. this.removeSerializable(removed[i]);
  426. var index = editType.nodes.indexOf(node);
  427. if (index != -1) {
  428. editType.nodes.splice(index, 1);
  429. }
  430. }
  431. if (removed.length) {
  432. this.sceneEditor.scene.sendEvent("SceneEditEnd");
  433. this.refresh();
  434. }
  435. }
  436. onComponentCopy(editType: SerializableEditType) {
  437. var copy: Atomic.Component[] = [];
  438. for (var i in editType.objects) {
  439. var c = <Atomic.Component>editType.objects[i];
  440. copy.push(c);
  441. }
  442. for (var i in copy) {
  443. var c = copy[i];
  444. this.component = c;
  445. this.sceneEditor.scene.sendEvent("SceneEditComponentCopy", { component: this.component });
  446. this.refresh();
  447. }
  448. }
  449. onComponentPaste(editType: SerializableEditType) {
  450. var paste: Atomic.Component[] = [];
  451. for (var i in editType.objects) {
  452. var c = <Atomic.Component>editType.objects[i];
  453. paste.push(c);
  454. }
  455. for (var i in paste) {
  456. var c = paste[i];
  457. this.component = c;
  458. this.sceneEditor.scene.sendEvent("SceneEditComponentPaste", { component: this.component });
  459. this.refresh();
  460. }
  461. }
  462. handleSelectionCreateComponent(ev) {
  463. var valid = true;
  464. if (ev.componentTypeName != "JSComponent" && ev.componentTypeName != "CSComponent") {
  465. for (var i in this.nodes) {
  466. var node = this.nodes[i];
  467. if (node.getComponent(ev.componentTypeName, false)) {
  468. valid = false;
  469. break;
  470. }
  471. }
  472. }
  473. if (!valid) {
  474. EditorUI.showModalError("Component Create", "Unable to create component, a node with an existing " + ev.componentTypeName + " component is selected");
  475. return;
  476. }
  477. for (var i in this.nodes) {
  478. var node = this.nodes[i];
  479. var c = node.createComponent(ev.componentTypeName);
  480. if (!c) {
  481. console.log("ERROR: unable to create component ", ev.componentTypeName);
  482. return;
  483. }
  484. var editType = this.addSerializable(c);
  485. editType.addNode(node);
  486. for (var i in this.sections) {
  487. if (this.sections[i].editType == editType) {
  488. this.sections[i].value = 1;
  489. break;
  490. }
  491. }
  492. }
  493. this.refresh();
  494. }
  495. handleSceneEditStateChangeEvent(ev: Editor.SceneEditStateChangeEvent) {
  496. if (!this.stateChangesInProgress)
  497. return;
  498. if (this.stateChanges.indexOf(ev.serializable) == -1) {
  499. this.stateChanges.push(ev.serializable);
  500. }
  501. }
  502. getPrefabComponent(node: Atomic.Node): Atomic.PrefabComponent {
  503. if (node.getComponent("PrefabComponent"))
  504. return <Atomic.PrefabComponent>node.getComponent("PrefabComponent");
  505. if (node.parent)
  506. return this.getPrefabComponent(node.parent);
  507. return null;
  508. }
  509. filterComponent(component: Atomic.Component): boolean {
  510. if (component.typeName == "PrefabComponent") {
  511. return true;
  512. }
  513. return false;
  514. }
  515. handleSceneEditStateChangesEndEvent() {
  516. Atomic.ui.blockChangedEvents = true;
  517. var sections: SelectionSection[] = [];
  518. for (var i in this.stateChanges) {
  519. var serial = this.stateChanges[i];
  520. for (var j in this.sections) {
  521. var section = this.sections[j];
  522. if (sections.indexOf(section) != -1)
  523. continue;
  524. if (section.editType.objects.indexOf(serial) != -1) {
  525. sections.push(section);
  526. if (section.hasDynamicAttr) {
  527. var object = section.editType.getFirstObject();
  528. if (object) {
  529. var attrInfos = object.getAttributes();
  530. section.updateDynamicAttrInfos(attrInfos);
  531. }
  532. }
  533. section.refresh();
  534. }
  535. }
  536. }
  537. Atomic.ui.blockChangedEvents = false;
  538. this.stateChanges = [];
  539. this.stateChangesInProgress = false;
  540. }
  541. mainLayout: Atomic.UILayout;
  542. multipleSelectNotice: Atomic.UILayout;
  543. sceneEditor: Editor.SceneEditor3D;
  544. nodes: Atomic.Node[] = [];
  545. sections: SelectionSection[] = [];
  546. createComponentButton: CreateComponentButton;
  547. nodeSection: NodeSection;
  548. stateChangesInProgress: boolean = false;
  549. stateChanges: Atomic.Serializable[] = [];
  550. // ------------------------------------
  551. static registerEditType(typeName: string, type: typeof SerializableEditType) {
  552. SelectionInspector._editTypes[typeName] = type;
  553. }
  554. private static sectionStates: { [typeName: string]: boolean } = {};
  555. private static _editTypes: { [typeName: string]: typeof SerializableEditType } = {};
  556. private static Ctor = (() => {
  557. SelectionInspector.sectionStates["Node"] = true;
  558. })();
  559. }
  560. export = SelectionInspector;