[unity] Fixed PMA workflow preset warning dialog only occurring on newly added atlas, not dependent ones where texture is reimported. See #2940.

This commit is contained in:
Harald Csaszar 2025-10-01 11:29:36 +02:00
parent 842c96a511
commit 9507491927
2 changed files with 13 additions and 11 deletions

View File

@ -391,17 +391,20 @@ namespace Spine.Unity.Editor {
} }
} }
} }
AddDependentAtlasIfImageChanged(atlasPaths, imagePaths); List<string> dependentAtlasPaths = new List<string>();
AddDependentAtlasIfImageChanged(dependentAtlasPaths, imagePaths);
atlasPaths.AddRange(dependentAtlasPaths);
// Import atlases first. // Import atlases first.
List<AtlasAssetBase> newAtlases = new List<AtlasAssetBase>(); List<AtlasAssetBase> newAtlases = new List<AtlasAssetBase>();
foreach (string ap in atlasPaths) { foreach (string atlasPath in atlasPaths) {
#if PROBLEMATIC_PACKAGE_ASSET_MODIFICATION #if PROBLEMATIC_PACKAGE_ASSET_MODIFICATION
if (ap.StartsWith("Packages")) if (ap.StartsWith("Packages"))
continue; continue;
#endif #endif
TextAsset atlasText = AssetDatabase.LoadAssetAtPath<TextAsset>(ap); TextAsset atlasText = AssetDatabase.LoadAssetAtPath<TextAsset>(atlasPath);
AtlasAssetBase atlas = IngestSpineAtlas(atlasText, texturesWithoutMetaFile); bool isExistingAtlas = dependentAtlasPaths.Contains(atlasPath);
AtlasAssetBase atlas = IngestSpineAtlas(atlasText, texturesWithoutMetaFile, isExistingAtlas);
newAtlases.Add(atlas); newAtlases.Add(atlas);
} }
AddDependentSkeletonIfAtlasChanged(skeletonPaths, atlasPaths); AddDependentSkeletonIfAtlasChanged(skeletonPaths, atlasPaths);
@ -638,7 +641,9 @@ namespace Spine.Unity.Editor {
return arr; return arr;
} }
static AtlasAssetBase IngestSpineAtlas (TextAsset atlasText, List<string> texturesWithoutMetaFile) { static AtlasAssetBase IngestSpineAtlas (TextAsset atlasText, List<string> texturesWithoutMetaFile,
bool isExistingAtlas) {
if (atlasText == null) { if (atlasText == null) {
Debug.LogWarning("Atlas source cannot be null!"); Debug.LogWarning("Atlas source cannot be null!");
return null; return null;
@ -650,15 +655,12 @@ namespace Spine.Unity.Editor {
string atlasPath = assetPath + "/" + primaryName + AtlasSuffix + ".asset"; string atlasPath = assetPath + "/" + primaryName + AtlasSuffix + ".asset";
SpineAtlasAsset atlasAsset = (SpineAtlasAsset)AssetDatabase.LoadAssetAtPath(atlasPath, typeof(SpineAtlasAsset)); SpineAtlasAsset atlasAsset = (SpineAtlasAsset)AssetDatabase.LoadAssetAtPath(atlasPath, typeof(SpineAtlasAsset));
bool isNewAtlas = !isExistingAtlas && atlasAsset == null;
List<Material> vestigialMaterials = new List<Material>(); List<Material> vestigialMaterials = new List<Material>();
bool isNewAtlas;
if (atlasAsset == null) { if (atlasAsset == null) {
isNewAtlas = true;
atlasAsset = SpineAtlasAsset.CreateInstance<SpineAtlasAsset>(); atlasAsset = SpineAtlasAsset.CreateInstance<SpineAtlasAsset>();
} else { } else {
isNewAtlas = false;
foreach (Material m in atlasAsset.materials) foreach (Material m in atlasAsset.materials)
vestigialMaterials.Add(m); vestigialMaterials.Add(m);
} }

View File

@ -2,7 +2,7 @@
"name": "com.esotericsoftware.spine.spine-unity", "name": "com.esotericsoftware.spine.spine-unity",
"displayName": "spine-unity Runtime", "displayName": "spine-unity Runtime",
"description": "This plugin provides the spine-unity runtime core and examples. Spine Examples can be installed via the Samples tab.", "description": "This plugin provides the spine-unity runtime core and examples. Spine Examples can be installed via the Samples tab.",
"version": "4.3.10", "version": "4.3.11",
"unity": "2018.3", "unity": "2018.3",
"author": { "author": {
"name": "Esoteric Software", "name": "Esoteric Software",