From 5b4f6b1618cf571a6bce5a631f976a008e04a64e Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 29 Mar 2012 15:52:08 -0700 Subject: Updated shapes to always check for its stroke and fill colors and materials instead of relying on the shapeModel cache because it can get out of sync. Signed-off-by: Nivesh Rajbhandari --- js/lib/geom/geom-obj.js | 82 +++++++++++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 40 deletions(-) (limited to 'js/lib/geom/geom-obj.js') diff --git a/js/lib/geom/geom-obj.js b/js/lib/geom/geom-obj.js index 3c4e4bbf..df4a018d 100755 --- a/js/lib/geom/geom-obj.js +++ b/js/lib/geom/geom-obj.js @@ -141,54 +141,56 @@ var GeomObj = function GLGeomObj() { this.setMaterialColor = function(c, type) { var i = 0, nMats = 0; - if(c.gradientMode) { - // Gradient support - if (this._materialArray && this._materialTypeArray) { - nMats = this._materialArray.length; - } + if(c) { + if(c.gradientMode) { + // Gradient support + if (this._materialArray && this._materialTypeArray) { + nMats = this._materialArray.length; + } - var stops = [], - colors = c.color; + var stops = [], + colors = c.color; - var len = colors.length; - // TODO - Current shaders only support 4 color stops - if(len > 4) { - len = 4; - } + var len = colors.length; + // TODO - Current shaders only support 4 color stops + if(len > 4) { + len = 4; + } - for(var n=0; n