[unity] Fixed PMA workflow preset related warnings only occurring on first import. Closes #2940.

This commit is contained in:
Harald Csaszar 2025-09-29 17:18:00 +02:00
parent 83ba44ed37
commit c4a3239e51
2 changed files with 9 additions and 6 deletions

View File

@ -652,9 +652,12 @@ namespace Spine.Unity.Editor {
List<Material> vestigialMaterials = new List<Material>(); List<Material> vestigialMaterials = new List<Material>();
if (atlasAsset == null) bool isFirstImport;
if (atlasAsset == null) {
isFirstImport = true;
atlasAsset = SpineAtlasAsset.CreateInstance<SpineAtlasAsset>(); atlasAsset = SpineAtlasAsset.CreateInstance<SpineAtlasAsset>();
else { } else {
isFirstImport = false;
foreach (Material m in atlasAsset.materials) foreach (Material m in atlasAsset.materials)
vestigialMaterials.Add(m); vestigialMaterials.Add(m);
} }
@ -667,7 +670,7 @@ namespace Spine.Unity.Editor {
if (atlas != null) { if (atlas != null) {
foreach (AtlasPage page in atlas.Pages) foreach (AtlasPage page in atlas.Pages)
pageFiles.Add(page.name); pageFiles.Add(page.name);
IssuePMAWarnings(atlas, atlasAsset); IssuePMAWarnings(isFirstImport, atlas, atlasAsset);
} }
bool atlasHasCustomMaterials = HasCustomMaterialsAssigned(vestigialMaterials, primaryName, pageFiles); bool atlasHasCustomMaterials = HasCustomMaterialsAssigned(vestigialMaterials, primaryName, pageFiles);
@ -769,7 +772,7 @@ namespace Spine.Unity.Editor {
return loadedAtlas != null ? loadedAtlas : atlasAsset; return loadedAtlas != null ? loadedAtlas : atlasAsset;
} }
static void IssuePMAWarnings (Atlas atlas, SpineAtlasAsset atlasAsset) { static void IssuePMAWarnings (bool isFirstImport, Atlas atlas, SpineAtlasAsset atlasAsset) {
bool isPMA = atlas.Pages.Count > 0 && atlas.Pages[0].pma; bool isPMA = atlas.Pages.Count > 0 && atlas.Pages[0].pma;
if (QualitySettings.activeColorSpace == ColorSpace.Linear && isPMA) { if (QualitySettings.activeColorSpace == ColorSpace.Linear && isPMA) {
bool wasFixed = false; bool wasFixed = false;
@ -782,7 +785,7 @@ namespace Spine.Unity.Editor {
+ "b) switch to Gamma color space via\nProject Settings - Player - Other Settings - Color Space.\n", + "b) switch to Gamma color space via\nProject Settings - Player - Other Settings - Color Space.\n",
atlasAsset.name), atlasAsset); atlasAsset.name), atlasAsset);
} }
} else if (SpineEditorUtilities.Preferences.UsesPMAWorkflow != isPMA) { } else if (isFirstImport && SpineEditorUtilities.Preferences.UsesPMAWorkflow != isPMA) {
bool wasFixed = false; bool wasFixed = false;
if (SpineEditorUtilities.Preferences.ShowWorkflowMismatchDialog) if (SpineEditorUtilities.Preferences.ShowWorkflowMismatchDialog)
wasFixed = ShowWorkflowMismatchDialog(atlasAsset, isLinearPMAMismatch: false, atlasIsPMA: isPMA); wasFixed = ShowWorkflowMismatchDialog(atlasAsset, isLinearPMAMismatch: false, atlasIsPMA: isPMA);

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.8", "version": "4.3.9",
"unity": "2018.3", "unity": "2018.3",
"author": { "author": {
"name": "Esoteric Software", "name": "Esoteric Software",