瀏覽代碼

userData To Material.js

Wittmann Tobias 8 年之前
父節點
當前提交
7640431961
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/materials/Material.js

+ 4 - 0
src/materials/Material.js

@@ -62,6 +62,8 @@ function Material() {
 	this.visible = true;
 	this.visible = true;
 
 
 	this.needsUpdate = true;
 	this.needsUpdate = true;
+	
+	this.userData = {};
 
 
 }
 }
 
 
@@ -153,6 +155,7 @@ Object.assign( Material.prototype, EventDispatcher.prototype, {
 		data.type = this.type;
 		data.type = this.type;
 
 
 		if ( this.name !== '' ) data.name = this.name;
 		if ( this.name !== '' ) data.name = this.name;
+		if ( JSON.stringify( this.userData ) !== '{}' ) data.userData = this.userData;
 
 
 		if ( this.color && this.color.isColor ) data.color = this.color.getHex();
 		if ( this.color && this.color.isColor ) data.color = this.color.getHex();
 
 
@@ -331,6 +334,7 @@ Object.assign( Material.prototype, EventDispatcher.prototype, {
 		}
 		}
 
 
 		this.clippingPlanes = dstPlanes;
 		this.clippingPlanes = dstPlanes;
+		this.userData = JSON.parse( JSON.stringify( source.userData ) );
 
 
 		return this;
 		return this;