Commit 296ee53c authored by Amanda Ghassaei's avatar Amanda Ghassaei

delete material

parent ab9187c1
......@@ -158,7 +158,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', '
DMACell.prototype.setDeleteMode = function(state){
var material;
if (!state && !this.materialName) return;//cell may be deleted by now
if (state) material = materials.list.deleteMaterial.threeMaterial;
if (state) material = materials.getDeleteMaterial();
else material = this.getMaterial(true);
if (!material) return;//no material object found
if (this.object3D.children[0].material == material) return;
......
......@@ -76,6 +76,10 @@ define(['underscore', 'three', 'appState', 'lattice', 'plist', 'threeModel'], fu
return materialsList[id];
}
function getDeleteMaterial(){
return materialsList.deleteMaterial.threeMaterial;
}
......@@ -260,6 +264,7 @@ define(['underscore', 'three', 'appState', 'lattice', 'plist', 'threeModel'], fu
getChildCellTypes:getChildCellTypes,
setToDefaultMaterial: setToDefaultMaterial,
setEditingMaterial: setEditingMaterial,
getEditingMaterial: getEditingMaterial
getEditingMaterial: getEditingMaterial,
getDeleteMaterial: getDeleteMaterial
};
});
\ No newline at end of file
......@@ -3,13 +3,12 @@
*/
define(['underscore', 'stlLoader', 'gikPart'], function(_, THREE, GIKPart){
define(['underscore', 'stlLoader', 'gikPart', 'materials'], function(_, THREE, GIKPart, materials){
var zScale = 1.08/8;
var unitGeo = new THREE.BoxGeometry(0.2, 0.2, zScale);
var bridgeGeo = new THREE.BoxGeometry(0.3, 0.4, zScale);
console.log(bridgeGeo);
bridgeGeo.vertices[4].y = 0;
bridgeGeo.vertices[5].y = 0;
bridgeGeo.vertices[2].y = -0.1;
......@@ -65,6 +64,11 @@ define(['underscore', 'stlLoader', 'gikPart'], function(_, THREE, GIKPart){
return GIKPart.prototype.getMaterial.call(this, returnTHREEObject);
};
DNAStraightPart.prototype.setMaterial = function(material){
if (material != materials.getDeleteMaterial()) material = this.getMaterial(true);
this.mesh.material = material;
};
DNAStraightPart.prototype._translatePart = function(mesh){
if (this._isBridge){
mesh.translateX(0.15+0.2);
......
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