增加模型库无工艺数据播放提示

This commit is contained in:
zhangshun
2026-06-01 13:07:50 +08:00
parent 57d3137640
commit 00f7dc1686

View File

@@ -629,6 +629,10 @@ function bindProcessPlaceholder(operations: PreviewOperation[]) {
}); });
document.querySelector<HTMLButtonElement>("#previewPlayBtn")?.addEventListener("click", () => { document.querySelector<HTMLButtonElement>("#previewPlayBtn")?.addEventListener("click", () => {
if (operations.length === 0) {
notify("当前模型暂无工艺数据");
return;
}
const operation = getSelectedOperation(operations); const operation = getSelectedOperation(operations);
updateStatus(operation); updateStatus(operation);
if (!operation) { if (!operation) {
@@ -639,7 +643,7 @@ function bindProcessPlaceholder(operations: PreviewOperation[]) {
notifyError(`工艺播放数据解析失败:${operation.parseError}`); notifyError(`工艺播放数据解析失败:${operation.parseError}`);
return; return;
} }
if (!operation.parsedCraftPlayData) { if (!operation.parsedCraftPlayData || operation.parsedCraftPlayData.OPERATION.frames.length === 0) {
notify("当前工艺暂无播放数据"); notify("当前工艺暂无播放数据");
return; return;
} }
@@ -653,10 +657,14 @@ function bindProcessPlaceholder(operations: PreviewOperation[]) {
} }
function startPreviewPlayback(operation: PreviewOperation) { function startPreviewPlayback(operation: PreviewOperation) {
if (!runtime?.context.modelObject || !operation.parsedCraftPlayData) { if (!runtime?.context.modelObject) {
notify("模型还未加载完成"); notify("模型还未加载完成");
return; return;
} }
if (!operation.parsedCraftPlayData || operation.parsedCraftPlayData.OPERATION.frames.length === 0) {
notify("当前工艺暂无播放数据");
return;
}
if (previewPlayback.isPlaying && previewPlayback.operation === operation) { if (previewPlayback.isPlaying && previewPlayback.operation === operation) {
return; return;