diff --git a/js/cells/DMACell.js b/js/cells/DMACell.js index e24a4b400b27cfc55d60c7198f38e7e46688939e..612f6e4ba3014c40cd9c2354116f8873ede33b8f 100644 --- a/js/cells/DMACell.js +++ b/js/cells/DMACell.js @@ -226,7 +226,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', ' console.warn("no material type set for cell"); return null; } - if (!returnTHREEObject) return this.material; + if (!returnTHREEObject) return materials[this.material]; if (!materials[this.material]) { console.warn("no material object found of type " + this.materials); return null; diff --git a/js/cells/supercells/DMASuperCell.js b/js/cells/supercells/DMASuperCell.js index f9a7a2c8af65991c09a9f52a2bcee73b25dae9e4..c75708fa0f106870457093e5800f213cb6ac12e7 100644 --- a/js/cells/supercells/DMASuperCell.js +++ b/js/cells/supercells/DMASuperCell.js @@ -40,7 +40,6 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'], if (material.sparseCells[x][y][z]){ if (material.sparseCells[x][y][z].material) { cellMaterial = material.sparseCells[x][y][z].material; - console.log(cellMaterial); this._makeSubCellForIndex({index: new THREE.Vector3(x,y,z), material:cellMaterial}, function(cell){ var index = cell.getIndex(); cells[index.x][index.y][index.z] = cell; @@ -48,7 +47,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'], } else console.warn("no material for composite cell definition subcell"); }//else no cell in this spot } else {//if not from composite definition, add subcell at all possible indices in supercell range - this._makeSubCellForIndex({index: new THREE.Vector3(x,y,z), material:this.material}, function(cell){ + this._makeSubCellForIndex({index: new THREE.Vector3(x,y,z), material:cellMaterial}, function(cell){ cells[x][y][z] = cell; }); } diff --git a/js/lattice/Lattice.js b/js/lattice/Lattice.js index 56a67d180c30cfbc70a61293a94466ffe5317b4b..fcd2ad41e59f07d7b58173a595a61f8cffc89317 100644 --- a/js/lattice/Lattice.js +++ b/js/lattice/Lattice.js @@ -220,6 +220,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre }, getCompositeData: function(){ + if (this.get("numCells") == 0) return null; return { cellsMin: this.get("cellsMin").clone(), cellsMax: this.get("cellsMax").clone(), diff --git a/js/menus/CompositeMenuView.js b/js/menus/CompositeMenuView.js index 19462ee339c4f45322ce7175d66eacb23bc188ab..edfe9c5752c99a94dbd71b3eda8bb2d6f4bcda8a 100644 --- a/js/menus/CompositeMenuView.js +++ b/js/menus/CompositeMenuView.js @@ -26,7 +26,7 @@ define(['jquery', 'underscore', 'menuParent', 'plist', 'lattice', 'globals', 'ma if (lattice.compositeEditor.changedAttributes().numCells !== undefined) dimensions = lattice.compositeEditor.calculateBoundingBox(); this.render(); }); - this.listenTo(lattice, "change", this.render); + this.listenTo(this.model, "change", this.render); dimensions = lattice.compositeEditor.calculateBoundingBox(); }, diff --git a/js/models/AppState.js b/js/models/AppState.js index 9aaa851ba4ab0ba846faf46b0a54dcaeff086e0a..bdfdcdeb47ac3978bbba5ddeb1108ede04e42a09 100644 --- a/js/models/AppState.js +++ b/js/models/AppState.js @@ -113,7 +113,7 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'globals'], fu if (materialType.substr(0,5) != "super") { if (this.previous("materialType").substr(0,5) != "super") return; //re init highlighter - require([this.getHighlighterFile()], function(HighlighterClass){ + require([this.lattice.getHighlighterFile()], function(HighlighterClass){ globals.highlighter = new HighlighterClass(); }); return;