Skip to content

Commit bbc3ea2

Browse files
tschwmrdoob
authored andcommitted
Object3D: Let .toJSON serialize .metadata to root.
1 parent 97c70d2 commit bbc3ea2

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/core/Object3D.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,7 @@ THREE.Object3D.prototype = {
596596
var isRootObject = ( meta === undefined );
597597

598598
var data = {};
599+
var output = { object: data };
599600

600601
// meta is a hash used to collect geometries, materials.
601602
// not providing it implies that this is the root object
@@ -610,7 +611,7 @@ THREE.Object3D.prototype = {
610611
images: {}
611612
};
612613

613-
data.metadata = {
614+
output.metadata = {
614615
version: 4.4,
615616
type: 'Object',
616617
generator: 'Object3D.toJSON'
@@ -641,8 +642,6 @@ THREE.Object3D.prototype = {
641642

642643
}
643644

644-
var output = {};
645-
646645
if ( isRootObject ) {
647646

648647
var geometries = extractFromCache( meta.geometries );
@@ -657,8 +656,6 @@ THREE.Object3D.prototype = {
657656

658657
}
659658

660-
output.object = data;
661-
662659
return output;
663660

664661
// extract data from the cache hash

0 commit comments

Comments
 (0)