mirror of
https://github.com/tengge1/ShadowEditor.git
synced 2026-01-25 15:08:11 +00:00
修复补间动画保存载入bug。
This commit is contained in:
parent
6098e2697a
commit
3ac603c0bd
@ -149,7 +149,7 @@ BasicAnimationComponent.prototype.updateUI = function (animation) {
|
||||
|
||||
name.setValue(this.animation.name);
|
||||
|
||||
if (this.animation.target === null) {
|
||||
if (this.animation.target === undefined || this.animation.target === null) {
|
||||
target.setValue('(无)');
|
||||
} else {
|
||||
var obj = this.app.editor.objectByUuid(this.animation.target);
|
||||
|
||||
@ -280,6 +280,26 @@ ScenePanel.prototype.onLoadScene = function (obj) {
|
||||
|
||||
if (obj.animations) {
|
||||
Object.assign(this.app.editor.animations, obj.animations);
|
||||
} else {
|
||||
this.app.editor.animations = [{
|
||||
id: null,
|
||||
uuid: THREE.Math.generateUUID(),
|
||||
layer: 0,
|
||||
layerName: '动画层1',
|
||||
animations: []
|
||||
}, {
|
||||
id: null,
|
||||
uuid: THREE.Math.generateUUID(),
|
||||
layer: 1,
|
||||
layerName: '动画层2',
|
||||
animations: []
|
||||
}, {
|
||||
id: null,
|
||||
uuid: THREE.Math.generateUUID(),
|
||||
layer: 2,
|
||||
layerName: '动画层3',
|
||||
animations: []
|
||||
}];
|
||||
}
|
||||
|
||||
if (obj.scene) {
|
||||
@ -296,6 +316,7 @@ ScenePanel.prototype.onLoadScene = function (obj) {
|
||||
}
|
||||
|
||||
this.app.call('sceneLoaded', this);
|
||||
this.app.call('animationChanged', this, this.app.editor.animations);
|
||||
};
|
||||
|
||||
// ------------------------------- 编辑场景 ---------------------------------------
|
||||
|
||||
@ -12,11 +12,27 @@ AnimationSerializer.prototype = Object.create(BaseSerializer.prototype);
|
||||
AnimationSerializer.prototype.constructor = AnimationSerializer;
|
||||
|
||||
AnimationSerializer.prototype.toJSON = function (list) {
|
||||
return list.slice();
|
||||
var jsons = [];
|
||||
|
||||
list.forEach(n => {
|
||||
var json = BaseSerializer.prototype.toJSON.call(this, n);
|
||||
Object.assign(json, n);
|
||||
jsons.push(json);
|
||||
});
|
||||
|
||||
return jsons;
|
||||
};
|
||||
|
||||
AnimationSerializer.prototype.fromJSON = function (jsons) {
|
||||
return jsons.slice();
|
||||
var list = [];
|
||||
|
||||
jsons.forEach(n => {
|
||||
var obj = Object.assign({}, n);
|
||||
delete obj.metadata;
|
||||
list.push(obj);
|
||||
});
|
||||
|
||||
return list;
|
||||
};
|
||||
|
||||
export default AnimationSerializer;
|
||||
Loading…
x
Reference in New Issue
Block a user