From 290f1bf4e5f292751f1488546760b8ba29855442 Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Fri, 19 Jun 2015 16:22:28 -0700 Subject: [PATCH] sorting out new materials setup --- js/cells/DMACell.js | 2 +- js/cells/supercells/DMASuperCell.js | 3 +-- js/lattice/Lattice.js | 1 + js/menus/CompositeMenuView.js | 2 +- js/models/AppState.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/js/cells/DMACell.js b/js/cells/DMACell.js index e24a4b40..612f6e4b 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 f9a7a2c8..c75708fa 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 56a67d18..fcd2ad41 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 19462ee3..edfe9c57 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 9aaa851b..bdfdcdeb 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; -- GitLab