diff --git a/js/cam/assemblers/Assembler.js b/js/cam/assemblers/Assembler.js index d2a821d9197095ceef55b5c2ceaf8c46b38849db..21ec4fca33f3f2a8e93d2103da7a43da0a601a65 100644 --- a/js/cam/assemblers/Assembler.js +++ b/js/cam/assemblers/Assembler.js @@ -79,9 +79,9 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', ' }; Assembler.prototype._buildAssemblerComponents = function(componentsJSON){ - var components = []; + var components = {}; _.each(componentsJSON, function(componentJSON, id){ - components[id] = new Component(id); + components[id] = new Component(id, componentJSON); }); return components; }; diff --git a/js/cam/assemblers/Component.js b/js/cam/assemblers/Component.js index e9d37f813224a31189bccbd409d9736fe320365f..9840473ed3b2dcf00b65674e670e67bd2005d35b 100644 --- a/js/cam/assemblers/Component.js +++ b/js/cam/assemblers/Component.js @@ -7,10 +7,10 @@ define(['underscore', 'cam', 'three'], function(_, cam, THREE){ var id = 0; - function Component(geometry, material, name){ + function Component(id, json){ this.object3D = new THREE.Object3D(); - this.id = "id" + id++; - this.name = name || ""; + this.id = id || "id" + id++; + this.name = json.name || ""; this.parent = null; this.children = []; } diff --git a/js/menus/templates/EditComponentMenuView.html b/js/menus/templates/EditComponentMenuView.html index 8d6abe637b1fb46476813ed62222a2c1466d7b49..d9c1bbdc896473e0ebd2c925924ca18d547cdd7b 100644 --- a/js/menus/templates/EditComponentMenuView.html +++ b/js/menus/templates/EditComponentMenuView.html @@ -19,7 +19,7 @@ Children: <% }); %> </ul> </div><br/> - <% _.each(components[editingComponent].children, function(childID){ console.log(components[editingComponent].children);%> + <% _.each(components[editingComponent].children, function(childID){ %> <%= components[childID].name %> <a class="removeChild" data-id="<%= childID %>" href="#">Remove</a><br/> <% }); %><br/> STL: STL Name<br/><br/>