[unity] PMA workflow preset warning dialog only occurring once each import run, excluded Spine Examples assets. See #2940.

This commit is contained in:
Harald Csaszar 2025-09-30 14:48:26 +02:00
parent 6e7e285b28
commit 9605df9737
3 changed files with 21 additions and 17 deletions

View File

@ -92,6 +92,7 @@ namespace Spine.Unity.Editor {
/// This leads to MissingReferenceException and other errors. /// This leads to MissingReferenceException and other errors.
public static readonly List<ScriptableObject> protectFromStackGarbageCollection = new List<ScriptableObject>(); public static readonly List<ScriptableObject> protectFromStackGarbageCollection = new List<ScriptableObject>();
public static HashSet<string> assetsImportedInWrongState = new HashSet<string>(); public static HashSet<string> assetsImportedInWrongState = new HashSet<string>();
public static bool isFirstPMAWorkflowMismatch = true;
public static void HandleOnPostprocessAllAssets (string[] imported, List<string> texturesWithoutMetaFile) { public static void HandleOnPostprocessAllAssets (string[] imported, List<string> texturesWithoutMetaFile) {
// In case user used "Assets -> Reimport All", during the import process, // 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<string> texturesWithoutMetaFile, public static void ImportSpineContent (string[] imported, List<string> texturesWithoutMetaFile,
bool reimport = false) { bool reimport = false) {
isFirstPMAWorkflowMismatch = true;
List<string> atlasPaths = new List<string>(); List<string> atlasPaths = new List<string>();
List<string> imagePaths = new List<string>(); List<string> imagePaths = new List<string>();
List<PathAndProblemInfo> skeletonPaths = new List<PathAndProblemInfo>(); List<PathAndProblemInfo> skeletonPaths = new List<PathAndProblemInfo>();
@ -389,7 +391,6 @@ namespace Spine.Unity.Editor {
} }
} }
} }
AddDependentAtlasIfImageChanged(atlasPaths, imagePaths); AddDependentAtlasIfImageChanged(atlasPaths, imagePaths);
// Import atlases first. // Import atlases first.
@ -652,12 +653,12 @@ namespace Spine.Unity.Editor {
List<Material> vestigialMaterials = new List<Material>(); List<Material> vestigialMaterials = new List<Material>();
bool isFirstImport; bool isNewAtlas;
if (atlasAsset == null) { if (atlasAsset == null) {
isFirstImport = true; isNewAtlas = true;
atlasAsset = SpineAtlasAsset.CreateInstance<SpineAtlasAsset>(); atlasAsset = SpineAtlasAsset.CreateInstance<SpineAtlasAsset>();
} else { } else {
isFirstImport = false; isNewAtlas = false;
foreach (Material m in atlasAsset.materials) foreach (Material m in atlasAsset.materials)
vestigialMaterials.Add(m); vestigialMaterials.Add(m);
} }
@ -670,7 +671,9 @@ 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(isFirstImport, atlas, atlasAsset); bool isUserAtlas = !atlasPath.Contains("Spine Examples");
if (isUserAtlas)
IssueAtlasWorkflowWarnings(isNewAtlas, atlas, atlasAsset);
} }
bool atlasHasCustomMaterials = HasCustomMaterialsAssigned(vestigialMaterials, primaryName, pageFiles); bool atlasHasCustomMaterials = HasCustomMaterialsAssigned(vestigialMaterials, primaryName, pageFiles);
@ -772,7 +775,7 @@ namespace Spine.Unity.Editor {
return loadedAtlas != null ? loadedAtlas : atlasAsset; 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; 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;
@ -785,10 +788,11 @@ 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 (isFirstImport && SpineEditorUtilities.Preferences.UsesPMAWorkflow != isPMA) { } else if (isNewAtlas && SpineEditorUtilities.Preferences.UsesPMAWorkflow != isPMA) {
bool wasFixed = false; bool wasFixed = false;
if (SpineEditorUtilities.Preferences.ShowWorkflowMismatchDialog) if (SpineEditorUtilities.Preferences.ShowWorkflowMismatchDialog && isFirstPMAWorkflowMismatch)
wasFixed = ShowWorkflowMismatchDialog(atlasAsset, isLinearPMAMismatch: false, atlasIsPMA: isPMA); wasFixed = ShowWorkflowMismatchDialog(atlasAsset, isLinearPMAMismatch: false, atlasIsPMA: isPMA);
isFirstPMAWorkflowMismatch = wasFixed;
if (!wasFixed) { if (!wasFixed) {
if (isPMA) if (isPMA)
Debug.LogWarning(string.Format("{0} :: Atlas was exported as PMA but Spine Preferences are set " + Debug.LogWarning(string.Format("{0} :: Atlas was exported as PMA but Spine Preferences are set " +

View File

@ -42,7 +42,7 @@ namespace Spine.Unity.Editor {
None = -1, None = -1,
Switch = 0, Switch = 0,
ReexportInstructions = 1, ReexportInstructions = 1,
Cancel = 2 Ignore = 2
} }
const string REEXPORT_INSTRUCTIONS_URL = "https://esotericsoftware.com/spine-unity-assets#Correct-Texture-Packer-export"; 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, None = -1,
Switch = 0, Switch = 0,
ReexportInstructions = 1, ReexportInstructions = 1,
Cancel = 2 Ignore = 2
} }
const string REEXPORT_INSTRUCTIONS_URL = "https://esotericsoftware.com/spine-unity-assets#Correct-Texture-Packer-export"; const string REEXPORT_INSTRUCTIONS_URL = "https://esotericsoftware.com/spine-unity-assets#Correct-Texture-Packer-export";
@ -225,8 +225,8 @@ namespace Spine.Unity.Editor {
Close(); Close();
} }
GUILayout.Space(5); GUILayout.Space(5);
if (GUILayout.Button("Cancel", GUILayout.Width(75), GUILayout.Height(24))) { if (GUILayout.Button("Ignore", GUILayout.Width(75), GUILayout.Height(24))) {
dialogResult = DialogResult.Cancel; dialogResult = DialogResult.Ignore;
currentWindow = null; currentWindow = null;
Close(); Close();
} }
@ -293,8 +293,8 @@ namespace Spine.Unity.Editor {
Close(); Close();
} }
GUILayout.Space(5); GUILayout.Space(5);
if (GUILayout.Button("Cancel", GUILayout.Width(75), GUILayout.Height(24))) { if (GUILayout.Button("Ignore", GUILayout.Width(75), GUILayout.Height(24))) {
dialogResult = DialogResult.Cancel; dialogResult = DialogResult.Ignore;
currentWindow = null; currentWindow = null;
Close(); Close();
} }
@ -304,7 +304,7 @@ namespace Spine.Unity.Editor {
if (currentWindow == this) { if (currentWindow == this) {
currentWindow = null; currentWindow = null;
if (dialogResult == DialogResult.None) if (dialogResult == DialogResult.None)
dialogResult = DialogResult.Cancel; dialogResult = DialogResult.Ignore;
} }
} }
} }

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