From eb3eb4ed6dd6055cb18f5b744d48e435ee1fb62f Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Wed, 24 Jun 2015 22:15:28 -0700 Subject: [PATCH] composite children in material definitions --- js/lattice/CompositeEditorLattice.js | 2 +- js/menus/templates/CompositeMenuView.html | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/js/lattice/CompositeEditorLattice.js b/js/lattice/CompositeEditorLattice.js index 618f89ca..9c4aaac5 100644 --- a/js/lattice/CompositeEditorLattice.js +++ b/js/lattice/CompositeEditorLattice.js @@ -16,7 +16,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre defaults: _.extend(LatticeBase.prototype.defaults, { name: "", - color: null + color: null, }), __initialize: function(options, callback){ diff --git a/js/menus/templates/CompositeMenuView.html b/js/menus/templates/CompositeMenuView.html index bf882d68..4f18c256 100644 --- a/js/menus/templates/CompositeMenuView.html +++ b/js/menus/templates/CompositeMenuView.html @@ -14,7 +14,20 @@ Available Materials:<br/> </label> <% }); %> <% _.each(_.keys(materials), function(key){ - if (key == id || key.substr(0,5) != "super") return; %> + <!--if (key == id || key.substr(0,5) != "super") return;--> + <!--if (checkForLoops(key)) return;--> + <!--function checkForLoops(_key){--> + <!--console.log(materials[_key].compositeChildren);--> + <!--if (materials[_key].compositeChildren) {--> + <!--if (materials[_key].compositeChildren.indexOf(id)>0) return true;--> + <!--var childMatches = _.filter(materials[_key].compositeChildren, function(childKey){--> + <!--return checkForLoops(childKey);--> + <!--});--> + <!--if (childMatches.length>0) return true;--> + <!--}--> + <!--return false;--> + <!--}--> + %> <label class="radio colorSwatches"> <input type="radio" <%if (key == materialType){ %>checked<%}%> name="materialType" value="<%= key %>" data-toggle="radio" class="custom-radio appState"><span class="icons"><span class="icon-unchecked"></span><span class="icon-checked"></span></span> <div class="materialColorSwatch"> -- GitLab