diff --git a/ShadowEditor.Web/src/serialization/BaseSerializer.js b/ShadowEditor.Web/src/serialization/BaseSerializer.js index 88bf9cf1..5b418b39 100644 --- a/ShadowEditor.Web/src/serialization/BaseSerializer.js +++ b/ShadowEditor.Web/src/serialization/BaseSerializer.js @@ -25,8 +25,9 @@ BaseSerializer.prototype.filter = function (obj) { * @param {*} obj 对象 */ BaseSerializer.prototype.toJSON = function (obj) { - var json = {}; - Object.assign(json, this.metadata); + var json = { + metadata: this.metadata + }; return json; }; diff --git a/ShadowEditor.Web/src/serialization/Converter.js b/ShadowEditor.Web/src/serialization/Converter.js index 978062ab..6841e93e 100644 --- a/ShadowEditor.Web/src/serialization/Converter.js +++ b/ShadowEditor.Web/src/serialization/Converter.js @@ -58,6 +58,7 @@ Converter.prototype.toJSON = function (app) { } else { camera = (new PerspectiveCameraSerializer()).toJSON(app.editor.camera); } + list.push(camera); // 脚本 Object.keys(app.editor.scripts).forEach(function (id) { diff --git a/ShadowEditor.Web/src/serialization/app/ConfigSerializer.js b/ShadowEditor.Web/src/serialization/app/ConfigSerializer.js index 7b6f2bfd..30866c1e 100644 --- a/ShadowEditor.Web/src/serialization/app/ConfigSerializer.js +++ b/ShadowEditor.Web/src/serialization/app/ConfigSerializer.js @@ -25,7 +25,7 @@ ConfigSerializer.prototype.filter = function (obj) { }; ConfigSerializer.prototype.toJSON = function (app) { - var json = BaseSerializer.prototype.toJSON(app); + var json = BaseSerializer.prototype.toJSON.call(this, app); Object.assign(json, app.editor.config.toJSON()); return json; }; diff --git a/ShadowEditor.Web/src/serialization/app/ScriptSerializer.js b/ShadowEditor.Web/src/serialization/app/ScriptSerializer.js index c5a43485..a510ea80 100644 --- a/ShadowEditor.Web/src/serialization/app/ScriptSerializer.js +++ b/ShadowEditor.Web/src/serialization/app/ScriptSerializer.js @@ -29,7 +29,7 @@ ScriptSerializer.prototype.toJSON = function (app) { var list = []; Object.keys(app.editor.scripts).forEach(id => { - var json = BaseSerializer.prototype.toJSON(app); + var json = BaseSerializer.prototype.toJSON.call(this, app); var name = app.editor.scripts[id].name; var source = app.editor.scripts[id].source; diff --git a/ShadowEditor.Web/src/serialization/camera/CameraSerializer.js b/ShadowEditor.Web/src/serialization/camera/CameraSerializer.js index fe7768f0..e3b2f774 100644 --- a/ShadowEditor.Web/src/serialization/camera/CameraSerializer.js +++ b/ShadowEditor.Web/src/serialization/camera/CameraSerializer.js @@ -22,7 +22,7 @@ CameraSerializer.prototype.filter = function (obj) { }; CameraSerializer.prototype.toJSON = function (obj) { - var json = Object3DSerializer.prototype.toJSON(obj); + var json = Object3DSerializer.prototype.toJSON.call(this, obj); json.matrixWorldInverse = obj.matrixWorldInverse; json.projectionMatrix = obj.projectionMatrix; diff --git a/ShadowEditor.Web/src/serialization/camera/OrthographicCameraSerializer.js b/ShadowEditor.Web/src/serialization/camera/OrthographicCameraSerializer.js index 02a9e741..5cafc815 100644 --- a/ShadowEditor.Web/src/serialization/camera/OrthographicCameraSerializer.js +++ b/ShadowEditor.Web/src/serialization/camera/OrthographicCameraSerializer.js @@ -22,7 +22,7 @@ OrthographicCameraSerializer.prototype.filter = function (obj) { }; OrthographicCameraSerializer.prototype.toJSON = function (obj) { - var json = CameraSerializer.prototype.toJSON(obj); + var json = CameraSerializer.prototype.toJSON.call(this, obj); json.bottom = obj.bottom; json.far = obj.far; diff --git a/ShadowEditor.Web/src/serialization/camera/PerspectiveCameraSerializer.js b/ShadowEditor.Web/src/serialization/camera/PerspectiveCameraSerializer.js index c3562c78..a8678ee6 100644 --- a/ShadowEditor.Web/src/serialization/camera/PerspectiveCameraSerializer.js +++ b/ShadowEditor.Web/src/serialization/camera/PerspectiveCameraSerializer.js @@ -22,7 +22,7 @@ PerspectiveCameraSerializer.prototype.filter = function (obj) { }; PerspectiveCameraSerializer.prototype.toJSON = function (obj) { - var json = CameraSerializer.prototype.toJSON(obj); + var json = CameraSerializer.prototype.toJSON.call(this, obj); json.aspect = obj.aspect; json.far = obj.far; diff --git a/ShadowEditor.Web/src/serialization/core/Object3DSerializer.js b/ShadowEditor.Web/src/serialization/core/Object3DSerializer.js index 30fe9cec..60d84368 100644 --- a/ShadowEditor.Web/src/serialization/core/Object3DSerializer.js +++ b/ShadowEditor.Web/src/serialization/core/Object3DSerializer.js @@ -21,7 +21,7 @@ Object3DSerializer.prototype.filter = function (obj) { }; Object3DSerializer.prototype.toJSON = function (obj) { - var json = BaseSerializer.prototype.toJSON(obj); + var json = BaseSerializer.prototype.toJSON.call(this, obj); json.type = obj.type; json.uuid = obj.uuid; diff --git a/ShadowEditor.Web/src/serialization/light/HemisphereLightSerializer.js b/ShadowEditor.Web/src/serialization/light/HemisphereLightSerializer.js index e2bcde03..4a0c1f80 100644 --- a/ShadowEditor.Web/src/serialization/light/HemisphereLightSerializer.js +++ b/ShadowEditor.Web/src/serialization/light/HemisphereLightSerializer.js @@ -12,7 +12,7 @@ HemisphereLightSerializer.prototype = Object.create(BaseSerializer.prototype); HemisphereLightSerializer.prototype.constructor = HemisphereLightSerializer; HemisphereLightSerializer.prototype.toJSON = function (obj) { - var json = LightSerializer.prototype.toJSON(obj); + var json = LightSerializer.prototype.toJSON.call(this, obj); json.skyColor = item.skyColor; json.groundColor = item.groundColor; diff --git a/ShadowEditor.Web/src/serialization/light/LightSerializer.js b/ShadowEditor.Web/src/serialization/light/LightSerializer.js index cff7bc0b..5e417989 100644 --- a/ShadowEditor.Web/src/serialization/light/LightSerializer.js +++ b/ShadowEditor.Web/src/serialization/light/LightSerializer.js @@ -12,7 +12,7 @@ LightSerializer.prototype = Object.create(BaseSerializer.prototype); LightSerializer.prototype.constructor = LightSerializer; LightSerializer.prototype.toJSON = function (obj) { - var json = Object3DSerializer.prototype.toJSON(obj); + var json = Object3DSerializer.prototype.toJSON.call(this, obj); json.color = item.color; json.intensity = item.intensity; diff --git a/ShadowEditor.Web/src/serialization/light/PointLightSerializer.js b/ShadowEditor.Web/src/serialization/light/PointLightSerializer.js index 4ba6e2ee..33a1c77d 100644 --- a/ShadowEditor.Web/src/serialization/light/PointLightSerializer.js +++ b/ShadowEditor.Web/src/serialization/light/PointLightSerializer.js @@ -12,7 +12,7 @@ PointLightSerializer.prototype = Object.create(BaseSerializer.prototype); PointLightSerializer.prototype.constructor = PointLightSerializer; PointLightSerializer.prototype.toJSON = function (obj) { - var json = LightSerializer.prototype.toJSON(obj); + var json = LightSerializer.prototype.toJSON.call(this, obj); json.distance = item.distance; json.decay = item.decay; diff --git a/ShadowEditor.Web/src/serialization/light/RectAreaLightSerializer.js b/ShadowEditor.Web/src/serialization/light/RectAreaLightSerializer.js index 578842d7..486b7ab5 100644 --- a/ShadowEditor.Web/src/serialization/light/RectAreaLightSerializer.js +++ b/ShadowEditor.Web/src/serialization/light/RectAreaLightSerializer.js @@ -12,7 +12,7 @@ RectAreaLightSerializer.prototype = Object.create(BaseSerializer.prototype); RectAreaLightSerializer.prototype.constructor = RectAreaLightSerializer; RectAreaLightSerializer.prototype.toJSON = function (obj) { - var json = LightSerializer.prototype.toJSON(obj); + var json = LightSerializer.prototype.toJSON.call(this, obj); json.width = item.width; json.height = item.height; diff --git a/ShadowEditor.Web/src/serialization/light/SpotLightSerializer.js b/ShadowEditor.Web/src/serialization/light/SpotLightSerializer.js index c318c869..f8c954bf 100644 --- a/ShadowEditor.Web/src/serialization/light/SpotLightSerializer.js +++ b/ShadowEditor.Web/src/serialization/light/SpotLightSerializer.js @@ -12,7 +12,7 @@ SpotLightSerializer.prototype = Object.create(BaseSerializer.prototype); SpotLightSerializer.prototype.constructor = SpotLightSerializer; SpotLightSerializer.prototype.toJSON = function (obj) { - var json = LightSerializer.prototype.toJSON(obj); + var json = LightSerializer.prototype.toJSON.call(this, obj); json.distance = item.distance; json.angle = item.angle;