Commit bbc11d4f authored by amandaghassaei's avatar amandaghassaei

fixed file import/export

parent 2169ab42
......@@ -22,7 +22,7 @@
"y": 1,
"z": 1
},
"sparseCells": [
"cells": [
[
[
{
......
......@@ -22,7 +22,7 @@
"y": 1,
"z": 1
},
"sparseCells": [
"cells": [
[
[
null,
......
......@@ -22,7 +22,7 @@
"y": 1,
"z": 1
},
"sparseCells": [
"cells": [
[
[
null,
......
......@@ -22,7 +22,7 @@
"y": 1,
"z": 1
},
"sparseCells": [
"cells": [
[
[
null,
......
......@@ -22,7 +22,7 @@
"y": 1,
"z": 1
},
"sparseCells": [
"cells": [
[
[
null,
......
......@@ -22,7 +22,7 @@
"y": 1,
"z": 1
},
"sparseCells": [
"cells": [
[
[
{
......
......@@ -209,12 +209,12 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'materialsPlis
_.extend(self, subclassObject);
self._initLatticeType();//init for lattice subclass
if (numCells > 0) {
self._setSparseCells(self.sparseCells, cellsMin);
self._setCells(self.cells, cellsMin);
}
});
},
setSparseCells: function(cells, offset){
setCells: function(cells, offset){
if (cells === undefined || cells == null) {
console.warn("no cells given to setSparseCells");
return;
......@@ -223,7 +223,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'materialsPlis
var cellsString = JSON.stringify(cells);
myConsole.write("lattice.setCells(" + cellsString + ", " + JSON.stringify(offset) + ")");
this._setSparseCells(JSON.parse(cellsString), offset);
this._setCells(JSON.parse(cellsString), offset);
},
_getSubclassForLatticeType: function(){
......
......@@ -246,21 +246,21 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
three.render();
},
//setSparsecells: function(cells, offset){
// if (cells === undefined || cells == null) {
// console.warn("no cells given to setcells");
// return;
// }
// this._setcells(cells, offset);
//},
//
//_setSparsecells: function(cells, offset){
//
// offset = offset || this.getOffset() || new THREE.Vector3(0,0,0);
// if(this.get("numCells")>0) this.clearCells();
// this.set("cellsMin", new THREE.Vector3(offset.x, offset.y, offset.z));
// this.parseCellsJSON(cells);
//},
setCells: function(cells, offset){
if (cells === undefined || cells == null) {
console.warn("no cells given to setcells");
return;
}
this._setCells(cells, offset);
},
_setCells: function(cells, offset){
offset = offset || this.getOffset() || new THREE.Vector3(0,0,0);
if(this.get("numCells")>0) this.clearCells();
this.set("cellsMin", new THREE.Vector3(offset.x, offset.y, offset.z));
this.parseCellsJSON(cells);
},
......@@ -546,7 +546,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
var index = (new THREE.Vector3(x, y, z)).add(cellsMin);
self._addCellAtIndex(index, json);
});
three.render();//todo doesn't work
three.render();
},
getSaveJSON: function(){
......
......@@ -106,7 +106,7 @@ define(['underscore', 'fileSaverLib', 'lattice', 'materials', 'ribbon', 'menuWra
lattice.clearCells();
var cells = data.assembly.cells;
_setData(lattice, _.omit(data.assembly, "cells"));
if (cells) lattice.setSparseCells(cells);
if (cells) lattice.setCells(cells);
ribbon.render();
menuWrapper.render();
if (data.emSim){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment