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

composite materials get properties from elemetary manterials

parent cc7239fa
No related branches found
No related tags found
No related merge requests found
......@@ -102,10 +102,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
cellsMax: cellsMax,
elementaryChildren: materials.getChildCellTypes(this.sparseCells, true),
compositeChildren: materials.getChildCellTypes(this.sparseCells, false),
dimensions: _dimensions,
properties: {
}
dimensions: _dimensions
};
return data;
},
......
......@@ -34,6 +34,8 @@ define(['underscore', 'three', 'appState', 'lattice', 'plist', 'threeModel'], fu
var edited = false;
if (materialsList[id].sparseCells) edited = !(_.isEqual(data.sparseCells, materialsList[id].sparseCells));
if (data.elementaryChildren) data.properties = getPropertiesFromChildren(data.elementaryChildren);
_.each(_.keys(data), function(key){
if (data[key] && data[key].x) materialsList[id][key] = new THREE.Vector3(data[key].x, data[key].y, data[key].z);
else materialsList[id][key] = data[key];
......@@ -51,6 +53,7 @@ define(['underscore', 'three', 'appState', 'lattice', 'plist', 'threeModel'], fu
lattice.reinitAllCellsOfTypes(allChangedMaterialsList);
}
return false;
}
......@@ -117,6 +120,14 @@ define(['underscore', 'three', 'appState', 'lattice', 'plist', 'threeModel'], fu
return _.uniq(children);//remove duplicates
}
function getPropertiesFromChildren(children){
var properties = {};
_.each(children, function(child){
if (materialsList[child].properties.conductive) properties.conductive = true;
});
return properties;
}
function loopCells(cells, callback){
for (var x=0;x<cells.length;x++){
for (var y=0;y<cells[0].length;y++){
......
......@@ -6,7 +6,8 @@
define(['cell', 'lattice'], function(DMACell, lattice){
DMACell.prototype.isConductive = function(){
return this.getMaterial().properties.conductive;
var material = this.getMaterial();
return material.properties.conductive;
};
DMACell.prototype.setConductorGroupNum = function(num, force){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment