提交 ba5e171d 编写于 作者: M Mr.doob

*.toJSON tweaks

上级 2d71e8ba
......@@ -1107,8 +1107,8 @@ THREE.BufferGeometry.prototype = {
// standard BufferGeometry serialization
data.type = this.type;
data.uuid = this.uuid;
data.type = this.type;
if ( this.name !== '' ) data.name = this.name;
if ( this.parameters !== undefined ) {
......
......@@ -803,8 +803,8 @@ THREE.Geometry.prototype = {
// standard Geometry serialization
data.type = this.type;
data.uuid = this.uuid;
data.type = this.type;
if ( this.name !== '' ) data.name = this.name;
if ( this.parameters !== undefined ) {
......
......@@ -597,8 +597,8 @@ THREE.Object3D.prototype = {
// standard Object3D serialization
data.type = this.type;
data.uuid = this.uuid;
data.type = this.type;
if ( this.name !== '' ) data.name = this.name;
if ( JSON.stringify( this.userData ) !== '{}' ) data.userData = this.userData;
if ( this.visible !== true ) data.visible = this.visible;
......@@ -619,23 +619,22 @@ THREE.Object3D.prototype = {
// wrap serialized object with additional data
var output;
var output = {};
if ( isRootObject ) {
output = {
metadata: metadata,
geometries: extractFromCache(meta.geometries),
materials: extractFromCache(meta.materials),
object: data
};
output.metadata = metadata;
} else {
var geometries = extractFromCache( meta.geometries );
var materials = extractFromCache( meta.materials );
output = { object: data };
if ( geometries.length > 0 ) output.geometries = geometries;
if ( materials.length > 0 ) output.materials = materials;
}
output.object = data;
return output;
// extract data from the cache hash
......
......@@ -121,8 +121,8 @@ THREE.Material.prototype = {
};
// standard Material serialization
data.type = this.type;
data.uuid = this.uuid;
data.type = this.type;
if ( this.name !== '' ) data.name = this.name;
if ( this.opacity < 1 ) data.opacity = this.opacity;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册