Skip to content

Commit

Permalink
fix split animation (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
gameall3d authored and shrinktofit committed Jul 22, 2021
1 parent e579f84 commit b756cd6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
3 changes: 2 additions & 1 deletion editor/inspector/assets/fbx/animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ exports.methods = {
const splitInfo = animInfo.splits[this.splitClipIndex];

if (!animInfo) {
return;
return null;
}

const rawClipUUID = this.animationNameToUUIDMap.get(animInfo.name);
Expand All @@ -719,6 +719,7 @@ exports.methods = {

return {
rawClipUUID,
rawClipIndex: this.rawClipIndex,
clipUUID,
duration,
fps,
Expand Down
24 changes: 12 additions & 12 deletions editor/inspector/assets/fbx/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,19 +333,19 @@ const Elements = {
const timeline = this.$.animationTime;
timeline.addEventListener('change', this.onAnimationTimeChange.bind(this));
timeline.addEventListener('transform', this.updateEventInfo.bind(this));
}
},
},
currentTime: {
ready() {
const currentTime = this.$.currentTime;
currentTime.addEventListener('confirm', this.onAnimationTimeChange.bind(this));
}
},
},
timeCtrl: {
ready() {
this.$.timeCtrl.addEventListener('click', this.onTimeCtrlClick.bind(this));
}
}
},
},
};

exports.update = async function(assetList, metaList) {
Expand Down Expand Up @@ -389,7 +389,7 @@ exports.ready = function() {

this.onEditClipInfoChanged = async (clipInfo) => {
if (clipInfo) {
await Editor.Message.request('scene', 'execute-model-preview-animation-operation', 'setEditClip', clipInfo.rawClipUUID);
await Editor.Message.request('scene', 'execute-model-preview-animation-operation', 'setEditClip', clipInfo.rawClipUUID, clipInfo.rawClipIndex);
this.setCurEditClipInfo(clipInfo);
}
};
Expand Down Expand Up @@ -438,11 +438,11 @@ exports.close = function() {
};

exports.methods = {
async apply () {
async apply() {
// save animation event info
await this.events.apply.call(this);
},
async refreshPreview () {
async refreshPreview() {
const panel = this;

// After await, the panel no longer exists
Expand Down Expand Up @@ -497,7 +497,7 @@ exports.methods = {
if (!name || !this.curEditClipInfo) {
return;
}
switch(name) {
switch (name) {
case 'play':
this.onPlayButtonClick();
break;
Expand Down Expand Up @@ -537,14 +537,14 @@ exports.methods = {
this.events.update.call(this, eventInfos);
},

async stopAnimation () {
async stopAnimation() {
if (!this.curEditClipInfo) {
return;
}

await Editor.Message.request('scene', 'execute-model-preview-animation-operation', 'stop');
},
async onPlayButtonClick () {
async onPlayButtonClick() {
if (!this.curEditClipInfo) {
return;
}
Expand All @@ -564,7 +564,7 @@ exports.methods = {

this.isPreviewDataDirty = true;
},
async onAnimationTimeChange (event) {
async onAnimationTimeChange(event) {
event.stopPropagation();
if (!this.curEditClipInfo) {
return;
Expand All @@ -582,7 +582,7 @@ exports.methods = {
await Editor.Message.request('scene', 'execute-model-preview-animation-operation', 'setCurEditTime', curTime);
},

onModelAnimationUpdate (time) {
onModelAnimationUpdate(time) {
if (!this.curEditClipInfo) {
return;
}
Expand Down

0 comments on commit b756cd6

Please sign in to comment.