修正识别问题

This commit is contained in:
tianmo committed 2026-11-06 10:44:34 +08:00
1 parent d02370d6bd
commit e7f800aa8d
8 files changed
+128 -2

No files matched your search

@@ -2,7 +2,7 @@
// 每次改动递增。Eagle 里的 service 插件是启动时加载并常驻的,改完代码必须重新加载插件
// 才会生效;状态栏会显示这个版本号,方便确认加载的到底是不是最新代码。
const VERSION = 'v72';
const VERSION = 'v73';
const SHOW_DEV_VERSION = false;
const path = require('path');
@@ -176,6 +176,11 @@ function isTextureFile(name) {
return TEXTURE_EXTS.indexOf(ext) !== -1;
}
function textureFormatOf(name) {
const ext = extOf(name);
return ext === '.jpg' || ext === '.jpeg' ? 'jpeg' : ext;
}
/** 去掉文件名中的扩展名 */
function stemOf(name) {
const ext = extOf(name);
@@ -749,6 +754,8 @@ function discoverAssets(filePath, options) {
const pageFileName = path.posix.basename(pn);
let cands = textureFiles.filter((f) => f.name.toLowerCase() === pageFileName.toLowerCase());
if (cands.length === 0) cands = textureFiles.filter((f) => normalizeStem(f.name) === normalizeStem(pageFileName));
const sameFormat = cands.filter((f) => textureFormatOf(f.name) === textureFormatOf(pageFileName));
if (sameFormat.length > 0) cands = sameFormat;
let hit = selectBest(cands, atlas.fullPath);
if (strictStem && hit && Math.abs(importTimeOf(hit.fullPath) - importTimeOf(atlas.fullPath)) > allowedImportDelta) hit = null;
if (hit) texturePaths[pn] = hit.fullPath;
@@ -830,6 +837,7 @@ const spineUtilsApi = {
isSkeletonFile,
isAtlasFile,
isTextureFile,
textureFormatOf,
stemOf,
normalizeStem,
DEFAULT_SUFFIXES,