|
@@ -611,27 +611,43 @@ Object.assign( Object3D.prototype, EventDispatcher.prototype, {
|
|
|
|
|
|
//
|
|
|
|
|
|
- if ( this.geometry !== undefined ) {
|
|
|
+ function serialise( library, element ) {
|
|
|
|
|
|
- if ( meta.geometries[ this.geometry.uuid ] === undefined ) {
|
|
|
+ if ( library[ element.uuid ] === undefined ) {
|
|
|
|
|
|
- meta.geometries[ this.geometry.uuid ] = this.geometry.toJSON( meta );
|
|
|
+ library[ element.uuid ] = element.toJSON( meta );
|
|
|
|
|
|
}
|
|
|
|
|
|
- object.geometry = this.geometry.uuid;
|
|
|
+ return element.uuid;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if ( this.geometry !== undefined ) {
|
|
|
+
|
|
|
+ object.geometry = serialise( meta.geometries, this.geometry );
|
|
|
|
|
|
}
|
|
|
|
|
|
if ( this.material !== undefined ) {
|
|
|
|
|
|
- if ( meta.materials[ this.material.uuid ] === undefined ) {
|
|
|
+ if ( Array.isArray( this.material ) ) {
|
|
|
|
|
|
- meta.materials[ this.material.uuid ] = this.material.toJSON( meta );
|
|
|
+ var uuids = [];
|
|
|
|
|
|
- }
|
|
|
+ for ( var i = 0, l = this.material.length; i < l; i ++ ) {
|
|
|
|
|
|
- object.material = this.material.uuid;
|
|
|
+ uuids.push( serialise( meta.materials, this.material[ i ] ) );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ object.material = uuids;
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ object.material = serialise( meta.materials, this.material );
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|