aboutsummaryrefslogtreecommitdiff
path: root/js/lib/geom/line.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/geom/line.js')
-rwxr-xr-xjs/lib/geom/line.js26
1 files changed, 10 insertions, 16 deletions
diff --git a/js/lib/geom/line.js b/js/lib/geom/line.js
index c0322f46..eec4f6d9 100755
--- a/js/lib/geom/line.js
+++ b/js/lib/geom/line.js
@@ -89,17 +89,9 @@ exports.Line = Object.create(GeomObj, {
89 89
90 if(strokeMaterial) { 90 if(strokeMaterial) {
91 this._strokeMaterial = strokeMaterial.dup(); 91 this._strokeMaterial = strokeMaterial.dup();
92 } else {
93 this._strokeMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup();
94 } 92 }
95 93
96 if(strokeColor) { 94 this.initColors();
97 if(this._strokeMaterial.hasProperty("color")) {
98 this._strokeMaterial.setProperty( "color", this._strokeColor );
99 } else if (this._strokeMaterial && (this._strokeMaterial.gradientType === this._strokeColor.gradientMode)) {
100 this._strokeMaterial.setGradientData(this._strokeColor.color);
101 }
102 }
103 } 95 }
104 }, 96 },
105 97
@@ -245,7 +237,7 @@ exports.Line = Object.create(GeomObj, {
245 'strokeWidth' : this._strokeWidth, 237 'strokeWidth' : this._strokeWidth,
246 'strokeColor' : this._strokeColor, 238 'strokeColor' : this._strokeColor,
247 'strokeStyle' : this._strokeStyle, 239 'strokeStyle' : this._strokeStyle,
248 'strokeMat' : this._strokeMaterial ? this._strokeMaterial.getName() : MaterialsModel.getDefaultMaterialName(), 240 'strokeMat' : this._strokeMaterial ? this._strokeMaterial.getName() : null,
249 'materials' : this.exportMaterialsJSON() 241 'materials' : this.exportMaterialsJSON()
250 }; 242 };
251 243
@@ -265,15 +257,17 @@ exports.Line = Object.create(GeomObj, {
265 this._slope = jObj.slope; 257 this._slope = jObj.slope;
266 this._strokeStyle = jObj.strokeStyle; 258 this._strokeStyle = jObj.strokeStyle;
267 this._strokeColor = jObj.strokeColor; 259 this._strokeColor = jObj.strokeColor;
268 var strokeMaterialName = jObj.strokeMat;
269 260
270 var strokeMat = MaterialsModel.getMaterial( strokeMaterialName ); 261 if(jObj.strokeMat) {
271 if (!strokeMat) { 262 var strokeMat = MaterialsModel.getMaterial(jObj.strokeMat).dup();
272 console.log( "object material not found in library: " + strokeMaterialName ); 263 if (!strokeMat) {
273 strokeMat = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ); 264 console.log("object material not found in library: " + jObj.strokeMat);
265 } else {
266 this._strokeMaterial = strokeMat;
267 }
274 } 268 }
275 this._strokeMaterial = strokeMat;
276 269
270 this.initColors();
277 this.importMaterialsJSON( jObj.materials ); 271 this.importMaterialsJSON( jObj.materials );
278 } 272 }
279 }, 273 },