SelectionInspector.ts 23 KB

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