From 9605df97370bcccb250ec8eab9a525166a0d60e8 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Tue, 30 Sep 2025 14:48:26 +0200 Subject: [PATCH] [unity] PMA workflow preset warning dialog only occurring once each import run, excluded Spine Examples assets. See #2940. --- .../Editor/Utility/AssetUtility.cs | 22 +++++++++++-------- .../Editor/Windows/WorkflowMismatchDialog.cs | 14 ++++++------ spine-unity/Assets/Spine/package.json | 2 +- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/AssetUtility.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/AssetUtility.cs index 5ca5b1eb5..7aa4232c1 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/AssetUtility.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/AssetUtility.cs @@ -92,6 +92,7 @@ namespace Spine.Unity.Editor { /// This leads to MissingReferenceException and other errors. public static readonly List protectFromStackGarbageCollection = new List(); public static HashSet assetsImportedInWrongState = new HashSet(); + public static bool isFirstPMAWorkflowMismatch = true; public static void HandleOnPostprocessAllAssets (string[] imported, List texturesWithoutMetaFile) { // In case user used "Assets -> Reimport All", during the import process, @@ -340,7 +341,8 @@ namespace Spine.Unity.Editor { public static void ImportSpineContent (string[] imported, List texturesWithoutMetaFile, bool reimport = false) { - + + isFirstPMAWorkflowMismatch = true; List atlasPaths = new List(); List imagePaths = new List(); List skeletonPaths = new List(); @@ -389,7 +391,6 @@ namespace Spine.Unity.Editor { } } } - AddDependentAtlasIfImageChanged(atlasPaths, imagePaths); // Import atlases first. @@ -652,12 +653,12 @@ namespace Spine.Unity.Editor { List vestigialMaterials = new List(); - bool isFirstImport; + bool isNewAtlas; if (atlasAsset == null) { - isFirstImport = true; + isNewAtlas = true; atlasAsset = SpineAtlasAsset.CreateInstance(); } else { - isFirstImport = false; + isNewAtlas = false; foreach (Material m in atlasAsset.materials) vestigialMaterials.Add(m); } @@ -670,7 +671,9 @@ namespace Spine.Unity.Editor { if (atlas != null) { foreach (AtlasPage page in atlas.Pages) pageFiles.Add(page.name); - IssuePMAWarnings(isFirstImport, atlas, atlasAsset); + bool isUserAtlas = !atlasPath.Contains("Spine Examples"); + if (isUserAtlas) + IssueAtlasWorkflowWarnings(isNewAtlas, atlas, atlasAsset); } bool atlasHasCustomMaterials = HasCustomMaterialsAssigned(vestigialMaterials, primaryName, pageFiles); @@ -772,7 +775,7 @@ namespace Spine.Unity.Editor { return loadedAtlas != null ? loadedAtlas : atlasAsset; } - static void IssuePMAWarnings (bool isFirstImport, Atlas atlas, SpineAtlasAsset atlasAsset) { + static void IssueAtlasWorkflowWarnings (bool isNewAtlas, Atlas atlas, SpineAtlasAsset atlasAsset) { bool isPMA = atlas.Pages.Count > 0 && atlas.Pages[0].pma; if (QualitySettings.activeColorSpace == ColorSpace.Linear && isPMA) { bool wasFixed = false; @@ -785,10 +788,11 @@ namespace Spine.Unity.Editor { + "b) switch to Gamma color space via\nProject Settings - Player - Other Settings - Color Space.\n", atlasAsset.name), atlasAsset); } - } else if (isFirstImport && SpineEditorUtilities.Preferences.UsesPMAWorkflow != isPMA) { + } else if (isNewAtlas && SpineEditorUtilities.Preferences.UsesPMAWorkflow != isPMA) { bool wasFixed = false; - if (SpineEditorUtilities.Preferences.ShowWorkflowMismatchDialog) + if (SpineEditorUtilities.Preferences.ShowWorkflowMismatchDialog && isFirstPMAWorkflowMismatch) wasFixed = ShowWorkflowMismatchDialog(atlasAsset, isLinearPMAMismatch: false, atlasIsPMA: isPMA); + isFirstPMAWorkflowMismatch = wasFixed; if (!wasFixed) { if (isPMA) Debug.LogWarning(string.Format("{0} :: Atlas was exported as PMA but Spine Preferences are set " + diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Windows/WorkflowMismatchDialog.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Windows/WorkflowMismatchDialog.cs index 285f9c417..6112c656d 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Windows/WorkflowMismatchDialog.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Windows/WorkflowMismatchDialog.cs @@ -42,7 +42,7 @@ namespace Spine.Unity.Editor { None = -1, Switch = 0, ReexportInstructions = 1, - Cancel = 2 + Ignore = 2 } const string REEXPORT_INSTRUCTIONS_URL = "https://esotericsoftware.com/spine-unity-assets#Correct-Texture-Packer-export"; @@ -110,7 +110,7 @@ namespace Spine.Unity.Editor { None = -1, Switch = 0, ReexportInstructions = 1, - Cancel = 2 + Ignore = 2 } const string REEXPORT_INSTRUCTIONS_URL = "https://esotericsoftware.com/spine-unity-assets#Correct-Texture-Packer-export"; @@ -225,8 +225,8 @@ namespace Spine.Unity.Editor { Close(); } GUILayout.Space(5); - if (GUILayout.Button("Cancel", GUILayout.Width(75), GUILayout.Height(24))) { - dialogResult = DialogResult.Cancel; + if (GUILayout.Button("Ignore", GUILayout.Width(75), GUILayout.Height(24))) { + dialogResult = DialogResult.Ignore; currentWindow = null; Close(); } @@ -293,8 +293,8 @@ namespace Spine.Unity.Editor { Close(); } GUILayout.Space(5); - if (GUILayout.Button("Cancel", GUILayout.Width(75), GUILayout.Height(24))) { - dialogResult = DialogResult.Cancel; + if (GUILayout.Button("Ignore", GUILayout.Width(75), GUILayout.Height(24))) { + dialogResult = DialogResult.Ignore; currentWindow = null; Close(); } @@ -304,7 +304,7 @@ namespace Spine.Unity.Editor { if (currentWindow == this) { currentWindow = null; if (dialogResult == DialogResult.None) - dialogResult = DialogResult.Cancel; + dialogResult = DialogResult.Ignore; } } } diff --git a/spine-unity/Assets/Spine/package.json b/spine-unity/Assets/Spine/package.json index 403959a69..a39c01145 100644 --- a/spine-unity/Assets/Spine/package.json +++ b/spine-unity/Assets/Spine/package.json @@ -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.9", + "version": "4.3.10", "unity": "2018.3", "author": { "name": "Esoteric Software",