From b9cbef5e238736fa60613faeedd3d529307d23c3 Mon Sep 17 00:00:00 2001
From: Amanda Ghassaei <amandaghassaei@gmail.com>
Date: Mon, 8 Jun 2015 22:12:49 -0700
Subject: [PATCH] still working on gik parts

---
 js/cells/DMACell.js | 2 +-
 js/cells/GIKCell.js | 8 ++------
 js/parts/DMAPart.js | 3 ++-
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/js/cells/DMACell.js b/js/cells/DMACell.js
index 7ab6ea12..9c7cf0ad 100644
--- a/js/cells/DMACell.js
+++ b/js/cells/DMACell.js
@@ -276,7 +276,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals'],
 
     //subcomponents
 
-    DMACell.prototype._initParts = function(){
+    DMACell.prototype._initParts = function(callback){
         return [];//override in subclasses
     };
 
diff --git a/js/cells/GIKCell.js b/js/cells/GIKCell.js
index 2c8bf84e..13af3375 100644
--- a/js/cells/GIKCell.js
+++ b/js/cells/GIKCell.js
@@ -31,16 +31,12 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cubeCell'],
 
         if (lattice.get("partType") == "lego") {
             require(['gikPart'], function(GIKPart){
-                for (var i=0;i<length;i++){
-                    parts.push(new GIKPart(i, self));
-                }
+                parts.push(new GIKPart(self.index.x, self));
                 callback(parts);
             });
         } else {
             require(['gikPartLowPoly'], function(GIKPartLowPoly){
-                for (var i=0;i<length;i++){
-                    parts.push(new GIKPartLowPoly(i, self));
-                }
+                parts.push(new GIKPartLowPoly(self.index.x, self));
                 callback(parts);
             });
         }
diff --git a/js/parts/DMAPart.js b/js/parts/DMAPart.js
index 35f55961..2d18f5f1 100644
--- a/js/parts/DMAPart.js
+++ b/js/parts/DMAPart.js
@@ -32,8 +32,9 @@ define(['underscore', 'three'], function(_, THREE){
     };
 
     DMAPart.prototype.destroy = function(){
+        console.log("destroy");
         if (this.mesh) {
-            this.mesh.parent.remove(this.mesh);
+            this.parentCell.removeChildren(this.mesh);
             this.mesh = null;
         }
         this.parentCell = null;
-- 
GitLab