|
@@ -126,7 +126,9 @@ Object.assign( Texture.prototype, EventDispatcher.prototype, {
|
|
|
|
|
|
toJSON: function ( meta ) {
|
|
|
|
|
|
- if ( meta.textures[ this.uuid ] !== undefined ) {
|
|
|
+ var isRootObject = ( meta === undefined || typeof meta === 'string' );
|
|
|
+
|
|
|
+ if ( ! isRootObject && meta.textures[ this.uuid ] !== undefined ) {
|
|
|
|
|
|
return meta.textures[ this.uuid ];
|
|
|
|
|
@@ -210,7 +212,7 @@ Object.assign( Texture.prototype, EventDispatcher.prototype, {
|
|
|
|
|
|
}
|
|
|
|
|
|
- if ( meta.images[ image.uuid ] === undefined ) {
|
|
|
+ if ( ! isRootObject && meta.images[ image.uuid ] === undefined ) {
|
|
|
|
|
|
meta.images[ image.uuid ] = {
|
|
|
uuid: image.uuid,
|
|
@@ -223,7 +225,11 @@ Object.assign( Texture.prototype, EventDispatcher.prototype, {
|
|
|
|
|
|
}
|
|
|
|
|
|
- meta.textures[ this.uuid ] = output;
|
|
|
+ if ( ! isRootObject ) {
|
|
|
+
|
|
|
+ meta.textures[ this.uuid ] = output;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
return output;
|
|
|
|