增加对3.7 3.8的二进制读取
This commit is contained in:
1 parent
1b67933cac
commit
4c5033d2f9
10 files changed
+526
-52
No files matched your search
+2
-17
@@ -22,7 +22,7 @@ const renderJobs = new Map();
|
||||
const refreshJobs = new Map();
|
||||
|
||||
/** 插件代码版本:每次改动递增,用于确认 Eagle 是否加载到最新代码 */
|
||||
const VERSION = 'v10';
|
||||
const VERSION = 'v11';
|
||||
|
||||
function coordinationKey(src) {
|
||||
const root = utils.findLibraryRoot(src) || path.dirname(path.dirname(src));
|
||||
@@ -65,7 +65,6 @@ async function runDiscovery(src, retries, delay) {
|
||||
// 分批拖入的跨批次补齐统一交给后台任务处理。
|
||||
assets = utils.discoverAssets(src, {
|
||||
strictStem: true,
|
||||
preferCompatibleJson: true,
|
||||
allowCrossBatch: false,
|
||||
});
|
||||
const signature = assetSignature(assets);
|
||||
@@ -180,17 +179,6 @@ module.exports = async ({ src, dest, item }) => {
|
||||
let version = utils.detectVersion(assets.skeletonPath);
|
||||
let runtimeDir = utils.chooseRuntimeDir(version, assets.isBinary);
|
||||
|
||||
// 3.6/3.7 二进制没有对应解析器。若有同批 JSON,资源发现阶段已自动切换;
|
||||
// 走到这里说明没有 JSON,直接显示 atlas 实际贴图,避免无意义地重复解析。
|
||||
if (assets.isBinary && version && parseFloat(version) < 3.8) {
|
||||
if (await writeAtlasFallback(assets, dest)) {
|
||||
log('旧版二进制无 JSON,已使用 atlas 贴图缩略图: ' + src);
|
||||
await refreshRelatedThumbnails(assets, dest, item && item.id);
|
||||
item.width = 400; item.height = 400;
|
||||
return resolve(item);
|
||||
}
|
||||
}
|
||||
|
||||
if (!runtimeDir) {
|
||||
if (await writeAtlasFallback(assets, dest)) {
|
||||
await refreshRelatedThumbnails(assets, dest, item && item.id);
|
||||
@@ -356,7 +344,6 @@ function scheduleBackgroundReconcile(src) {
|
||||
await sleep(delay);
|
||||
const assets = utils.discoverAssets(src, {
|
||||
strictStem: true,
|
||||
preferCompatibleJson: true,
|
||||
allowCrossBatch: true,
|
||||
});
|
||||
const signature = assetSignature(assets);
|
||||
@@ -370,9 +357,7 @@ function scheduleBackgroundReconcile(src) {
|
||||
const version = utils.detectVersion(assets.skeletonPath);
|
||||
const runtimeDir = utils.chooseRuntimeDir(version, assets.isBinary);
|
||||
let wrote = false;
|
||||
if (assets.isBinary && version && parseFloat(version) < 3.8) {
|
||||
wrote = await writeAtlasFallback(assets, tempPng);
|
||||
} else if (runtimeDir) {
|
||||
if (runtimeDir) {
|
||||
try {
|
||||
const png = await renderThumbnailShared(assets, { ...assets, version, runtimeDir, size: 400 });
|
||||
fs.writeFileSync(tempPng, png);
|
||||
|
||||
Reference in new issue
Block a user