Browse Source

Object3D: Let .toJSON serialize .metadata to root.

tschw 10 years ago
parent
commit
bbc3ea232c
1 changed files with 2 additions and 5 deletions
  1. 2 5
      src/core/Object3D.js

+ 2 - 5
src/core/Object3D.js

@@ -596,6 +596,7 @@ THREE.Object3D.prototype = {
 		var isRootObject = ( meta === undefined );
 
 		var data = {};
+		var output = { object: data };
 
 		// meta is a hash used to collect geometries, materials.
 		// not providing it implies that this is the root object
@@ -610,7 +611,7 @@ THREE.Object3D.prototype = {
 				images: {}
 			};
 
-			data.metadata = {
+			output.metadata = {
 				version: 4.4,
 				type: 'Object',
 				generator: 'Object3D.toJSON'
@@ -641,8 +642,6 @@ THREE.Object3D.prototype = {
 
 		}
 
-		var output = {};
-
 		if ( isRootObject ) {
 
 			var geometries = extractFromCache( meta.geometries );
@@ -657,8 +656,6 @@ THREE.Object3D.prototype = {
 
 		}
 
-		output.object = data;
-
 		return output;
 
 		// extract data from the cache hash