[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

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

View File

@ -2,7 +2,7 @@
"name": "com.esotericsoftware.spine.spine-unity",
"displayName": "spine-unity Runtime",
"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",
"author": {
"name": "Esoteric Software",