Skip to content
Snippets Groups Projects
Commit fc3adf4a authored by Amanda Ghassaei's avatar Amanda Ghassaei
Browse files

data in outs for composite

parent f47ef62a
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,7 @@ define(['underscore', 'backbone', 'appState', 'lattice', 'globals', 'plist', 'th
function(_, Backbone, appState, lattice, globals, plist, THREE, three){
var defaults = {
compositeId: null,
compositeColor: makeRandomColor(),
numCompositeCells:0,
compositeCellsMin: null,
......@@ -21,21 +22,39 @@ define(['underscore', 'backbone', 'appState', 'lattice', 'globals', 'plist', 'th
_initCompositeEditor: function(){
_initCompositeEditor: function(id, data){
var self = this;
_.each(_.keys(defaults), function(key){
self.set(key, defaults[key], {silent:true});
});
this.compositeCells = [[[null]]];
if (data){
_.each(_.keys(data), function(key){
self.set(key, defaults[key], {silent:true});
});
this.compositeCells = data.cells;//todo
this.set("compositeId", id, {silent:true});
}
},
_changeRandomColor: function(){
this.set("compositeColor", makeRandomColor());
},
_makeNewCompositeMaterial: function(name){
var id = this.get("compositeId");
var data = {
name: name,
color: this.get("compositeColor"),
altColor: this.get("compositeColor"),
numCells: this.get("numCompositeCells"),
dimensions: new THREE.Vector3.subVectors(this.get("compositeCellsMax"), this.get("compositeCellsMin"))
};
globals.materials.id = data;//todo trigger change on all instances
},
_undoCompositeEditor: function(){
console.log("undo");
var self = this;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment