修正识别问题
This commit is contained in:
1 parent
d02370d6bd
commit
e7f800aa8d
8 files changed
+128
-2
No files matched your search
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user