Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix split animation #24

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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