From 45499ad227513f248b55afd190b5f23c7edabdaa Mon Sep 17 00:00:00 2001
From: Amanda Ghassaei <amandaghassaei@gmail.com>
Date: Mon, 8 Jun 2015 16:31:22 -0700
Subject: [PATCH] low poly vox parts

---
 js/cells/DMACell.js                | 7 +++++++
 js/lattice/Lattice.js              | 2 +-
 js/parts/OctaEdgeVoxPartLowPoly.js | 1 +
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/js/cells/DMACell.js b/js/cells/DMACell.js
index 28e2757c..cdad1a39 100644
--- a/js/cells/DMACell.js
+++ b/js/cells/DMACell.js
@@ -339,6 +339,13 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals'],
     };
 
     DMACell.prototype.destroyParts = function(){
+        if (!this.parts && !this.cells) return;
+        if (this.cells){
+            _.each(this.cells, function(cell){
+                if (cell) cell.destroyParts();
+            });
+            return;
+        }
         if (!this.parts) return;
         _.each(this.parts, function(part){
             if (part) part.destroy();
diff --git a/js/lattice/Lattice.js b/js/lattice/Lattice.js
index d170a147..a5cdd3bc 100644
--- a/js/lattice/Lattice.js
+++ b/js/lattice/Lattice.js
@@ -329,7 +329,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
         //events
 
         _updatePartType: function(){
-            this._iterCells(this.cells, function(cell){
+            this._iterCells(this.sparseCells, function(cell){
                 if (cell) cell.destroyParts();
             });
             this._updateForMode();
diff --git a/js/parts/OctaEdgeVoxPartLowPoly.js b/js/parts/OctaEdgeVoxPartLowPoly.js
index 8f6d785a..90580fe3 100644
--- a/js/parts/OctaEdgeVoxPartLowPoly.js
+++ b/js/parts/OctaEdgeVoxPartLowPoly.js
@@ -10,6 +10,7 @@ define(['underscore', 'three', 'part', 'bin!octaEdgeVoxPartLowPolySTL', 'stlLoad
     unitGeo.computeBoundingBox();
     var unitScale = 0.706/unitGeo.boundingBox.max.y;
     unitGeo.applyMatrix(new THREE.Matrix4().makeScale(unitScale, unitScale, unitScale));
+    unitGeo.applyMatrix(new THREE.Matrix4().makeRotationZ(Math.PI/4));
 
     function OctaEdgeVoxPartLowPoly(type, parent){
         DMAPart.call(this, type, parent);
-- 
GitLab