From 4d57f5553c40a1e8ee540bc3d59beb15d1f59c25 Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Wed, 24 Jun 2015 21:50:25 -0700 Subject: [PATCH] references to chid materials --- js/lattice/CompositeEditorLattice.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/js/lattice/CompositeEditorLattice.js b/js/lattice/CompositeEditorLattice.js index f63612ea..618f89ca 100644 --- a/js/lattice/CompositeEditorLattice.js +++ b/js/lattice/CompositeEditorLattice.js @@ -79,11 +79,24 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre sparseCells: JSON.parse(JSON.stringify(this.sparseCells)), cellsMin: cellsMin, cellsMax: cellsMax, + elementaryChildren: this._getChildCellTypes(true), + compositeChildren: this._getChildCellTypes(false), dimensions: _dimensions }; return data; }, + _getChildCellTypes: function(elementaryTypes){ + var children = []; + this._loopCells(this.sparseCells, function(cell){ + if (!cell) return; + var isComposite = cell.materialName.substr(0,5) == "super"; + if ((elementaryTypes && !isComposite) || (!elementaryTypes && isComposite)) children.push(cell.materialName); + }); + if (children.length == 0) return null; + return _.uniq(children);//remove duplicates + }, + -- GitLab