This repository was archived by the owner on Dec 12, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 11export default ( ( ) => {
22
33const isDevtoolsSerialization = meta => ! ! ( meta && meta . devtoolsConfig ) ;
4+ const isObject = o => Object . prototype . toString . call ( o ) === '[object Object]' ;
45const tempPosition = new THREE . Vector3 ( ) ;
56const tempRotation = new THREE . Quaternion ( ) ;
67const tempScale = new THREE . Vector3 ( ) ;
@@ -44,16 +45,15 @@ return function InstrumentedToJSON (meta) {
4445
4546 let textureData ;
4647 if ( this . isTexture ) {
47- // If `image` is a plain object, probably from DataTexture
48- // or a texture from a render target, hide it during serialization
49- // so an attempt to turn it into a data URL doesn't throw.
48+ // If `image` is a plain object (via DataTexture or WebGLRenderTarget)
49+ // or an array of plain objects (via CompressedTexture) hide it during
50+ // serialization so an attempt to turn it into a data URL doesn't throw.
5051 // Patch for DataTexture.toJSON (https://github.com/mrdoob/three.js/pull/17745)
51- if ( Object . prototype . toString . call ( this . image ) === '[object Object]' ) {
52+ if ( isObject ( this . image ) || ( Array . isArray ( this . image ) && this . image . some ( isObject ) ) ) {
5253 textureData = this . image ;
5354 this . image = undefined ;
5455 }
5556 }
56-
5757
5858 let children ;
5959 if ( this . isObject3D && ! serializeChildren ) {
You can’t perform that action at this time.
0 commit comments