[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.
public static readonly List<ScriptableObject> protectFromStackGarbageCollection = new List<ScriptableObject>();
public static HashSet<string> assetsImportedInWrongState = new HashSet<string>();
public static bool isFirstPMAWorkflowMismatch = true;
public static void HandleOnPostprocessAllAssets (string[] imported, List<string> texturesWithoutMetaFile) {
// In case user used "Assets -> Reimport All", during the import process,
@ -341,6 +342,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>();
List<PathAndProblemInfo> skeletonPaths = new List<PathAndProblemInfo>();
@ -389,7 +391,6 @@ namespace Spine.Unity.Editor {
}
}
}
AddDependentAtlasIfImageChanged(atlasPaths, imagePaths);
// Import atlases first.
@ -652,12 +653,12 @@ namespace Spine.Unity.Editor {
List<Material> vestigialMaterials = new List<Material>();
bool isFirstImport;
bool isNewAtlas;
if (atlasAsset == null) {
isFirstImport = true;
isNewAtlas = true;
atlasAsset = SpineAtlasAsset.CreateInstance<SpineAtlasAsset>();
} 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 " +

View File

@ -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;
}
}
}

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