Compare commits
No commits in common. "5368e52f0d9e5e1c659337d9f31a9e71cc347037" and "2c62987281991fe7e559a214e247476875f5909f" have entirely different histories.
5368e52f0d
...
2c62987281
@ -159,7 +159,7 @@ export default defineConfig(async ({mode, command}) => {
|
||||
viteStaticCopy({
|
||||
targets: [
|
||||
{ src: 'node_modules/@astral3d/engine/dist/libs/*', dest: 'assets/libs' },
|
||||
{ src: 'node_modules/@astral3d/engine/dist/resource/**/*', dest: 'assets/resource' }
|
||||
{ src: 'node_modules/@astral3d/engine/dist/resource/**/*', dest: 'resource' }
|
||||
],
|
||||
}),
|
||||
...plugins
|
||||
|
||||
@ -964,11 +964,6 @@ export class Package {
|
||||
unpackConfig.onProgress && unpackConfig.onProgress(0);
|
||||
let totalZipNumber = 0, progress = 0;
|
||||
|
||||
// 每次解包前确保 loader 可用
|
||||
if (!this.loader) {
|
||||
this.loader = new ObjectLoader();
|
||||
}
|
||||
|
||||
await this.initOfflineSource(unpackConfig);
|
||||
|
||||
if (!this.offlineZipMap && !this.offlineFlatPackages) {
|
||||
@ -1003,7 +998,8 @@ export class Package {
|
||||
that.offlineFlatPackages = null;
|
||||
that.offlineFlatEntryBase = null;
|
||||
that.dataComponentMap = null;
|
||||
// 不清除 loader,避免连续导入时被上一轮异步收尾误清理
|
||||
// @ts-ignore 清除loader
|
||||
that.loader = undefined;
|
||||
}
|
||||
|
||||
const complete = () => {
|
||||
@ -1341,9 +1337,6 @@ export class Package {
|
||||
//const db = window.VIEWPORT.modules["db"];
|
||||
//const dbTable = `${useProjectState.getState().sceneId}-${useProjectState.getState().info.id}`;
|
||||
|
||||
// 在调用时捕获 loader 引用,防止 done() 清除 this.loader 后重试路径报错
|
||||
const loader = this.loader;
|
||||
|
||||
// map 存储 json 解析完成后执行的 function; key 为 uuid
|
||||
const funcMap = new Map<string, Function>();
|
||||
|
||||
@ -1440,13 +1433,7 @@ export class Package {
|
||||
|
||||
const parse = (json) => {
|
||||
if (check(json.object, json)) {
|
||||
if (!loader) {
|
||||
// 防止早退导致 callFunNum 无法归零,进度卡住
|
||||
this.callFunNum.value--;
|
||||
return;
|
||||
}
|
||||
try {
|
||||
loader.parse(json, (group) => {
|
||||
this.loader.parse(json, (group) => {
|
||||
const bones: Bone[] = [];
|
||||
group.getObjectsByProperty("type", "Bone", bones);
|
||||
if (bones.length > 0) {
|
||||
@ -1478,10 +1465,7 @@ export class Package {
|
||||
funcMap.forEach((func, uuid) => {
|
||||
func.call(this, uuid, group, rootGroupUuid);
|
||||
})
|
||||
})
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
})
|
||||
} else {
|
||||
const timer = setTimeout(() => {
|
||||
clearTimeout(timer);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user