[unity] Added a workflow mismatch dialog showing whenever problematic PMA settings are detected at an atlas.

This commit is contained in:
Harald Csaszar 2025-09-26 14:30:05 +02:00
parent 77b677bc02
commit 201063bbf4
7 changed files with 436 additions and 48 deletions

View File

@ -11,6 +11,7 @@
- **Additions** - **Additions**
- Added Spine Preferences `Switch Texture Workflow` functionality to quickly switch to the respective PMA or straight-alpha texture and material presets. - Added Spine Preferences `Switch Texture Workflow` functionality to quickly switch to the respective PMA or straight-alpha texture and material presets.
- Added a workflow mismatch dialog showing whenever problematic PMA vs. straight alpha settings are detected at a newly imported `.atlas.txt` file. Invalid settings include the atlas being PMA and project using Linear color space, and a mismatch of Auto-Import presets set to straight alpha compared to the atlas being PMA and vice versa. The dialog offers an option to automatically fix the problematic setting on the import side and links website documentation for export settings. This dialog can be disabled and re-enabled via Spine preferences.
- **Breaking changes** - **Breaking changes**
- Example skeletons in Spine Examples are now using straight alpha textures and materials for better compatibility with Linear colorspace. - Example skeletons in Spine Examples are now using straight alpha textures and materials for better compatibility with Linear colorspace.

View File

@ -667,6 +667,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);
} }
bool atlasHasCustomMaterials = HasCustomMaterialsAssigned(vestigialMaterials, primaryName, pageFiles); bool atlasHasCustomMaterials = HasCustomMaterialsAssigned(vestigialMaterials, primaryName, pageFiles);
@ -738,8 +739,6 @@ namespace Spine.Unity.Editor {
atlasAsset.Clear(); atlasAsset.Clear();
atlas = atlasAsset.GetAtlas(onlyMetaData: false); atlas = atlasAsset.GetAtlas(onlyMetaData: false);
if (atlas != null) { if (atlas != null) {
IssuePMAWarnings(atlas, atlasAsset);
FieldInfo field = typeof(Atlas).GetField("regions", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.NonPublic); FieldInfo field = typeof(Atlas).GetField("regions", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.NonPublic);
List<AtlasRegion> regions = (List<AtlasRegion>)field.GetValue(atlas); List<AtlasRegion> regions = (List<AtlasRegion>)field.GetValue(atlas);
string atlasAssetPath = AssetDatabase.GetAssetPath(atlasAsset); string atlasAssetPath = AssetDatabase.GetAssetPath(atlasAsset);
@ -772,30 +771,49 @@ namespace Spine.Unity.Editor {
static void IssuePMAWarnings (Atlas atlas, SpineAtlasAsset atlasAsset) { static void IssuePMAWarnings (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) {
Debug.LogWarning(string.Format("{0} :: Atlas was exported as PMA but your color space is set to Linear. " + bool wasFixed = false;
if (SpineEditorUtilities.Preferences.ShowWorkflowMismatchDialog)
wasFixed = ShowWorkflowMismatchDialog(atlasAsset, isLinearPMAMismatch: true, atlasIsPMA: isPMA);
if (!wasFixed) {
Debug.LogWarning(string.Format("{0} :: Atlas was exported as PMA but your color space is set to Linear. " +
"Please\n" "Please\n"
+ "a) re-export atlas as straight alpha texture with 'premultiply alpha' unchecked.\n" + "a) re-export atlas as straight alpha texture with 'premultiply alpha' unchecked.\n"
+ "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) { }
if (isPMA) } else if (SpineEditorUtilities.Preferences.UsesPMAWorkflow != isPMA) {
Debug.LogWarning(string.Format("{0} :: Atlas was exported as PMA but Spine Preferences are set " + bool wasFixed = false;
"to use straight-alpha import presets. Please\n" if (SpineEditorUtilities.Preferences.ShowWorkflowMismatchDialog)
+ "a) re-export atlas as straight-alpha texture with 'premultiply alpha' disabled, or\n" wasFixed = ShowWorkflowMismatchDialog(atlasAsset, isLinearPMAMismatch: false, atlasIsPMA: isPMA);
+ "b) Select 'Edit - Preferences - Spine - Switch Texture Workflow' - 'PMA'. " + if (!wasFixed) {
"Select `Reimport` on the skeleton directory afterwards.\n", if (isPMA)
atlasAsset.name), atlasAsset); Debug.LogWarning(string.Format("{0} :: Atlas was exported as PMA but Spine Preferences are set " +
else "to use straight-alpha import presets. Please\n"
Debug.LogWarning(string.Format("{0} :: Atlas was exported as straight-alpha but Spine Preferences are set " + + "a) re-export atlas as straight-alpha texture with 'premultiply alpha' disabled, or\n"
"to use PMA import presets. Please\n" + "b) Select 'Edit - Preferences - Spine - Switch Texture Workflow' - 'PMA'. " +
+ "a) re-export atlas as PMA texture with 'premultiply alpha' enabled, or\n" "Select `Reimport` on the skeleton directory afterwards.\n",
+ "b) Select 'Edit - Preferences - Spine - Switch Texture Workflow' - 'Straight Alpha'. " + atlasAsset.name), atlasAsset);
"Select `Reimport` on the skeleton directory afterwards.\n", else
atlasAsset.name), atlasAsset); Debug.LogWarning(string.Format("{0} :: Atlas was exported as straight-alpha but Spine Preferences are set " +
"to use PMA import presets. Please\n"
+ "a) re-export atlas as PMA texture with 'premultiply alpha' enabled, or\n"
+ "b) Select 'Edit - Preferences - Spine - Switch Texture Workflow' - 'Straight Alpha'. " +
"Select `Reimport` on the skeleton directory afterwards.\n",
atlasAsset.name), atlasAsset);
}
} }
} }
/// <returns>True if automatic fixing by switching to suitable settings was selected.</returns>
static bool ShowWorkflowMismatchDialog (SpineAtlasAsset atlasAsset, bool isLinearPMAMismatch, bool atlasIsPMA) {
string atlasFileName = atlasAsset.atlasFile.name;
Selection.activeObject = atlasAsset.atlasFile;
EditorGUIUtility.PingObject(atlasAsset.atlasFile);
return WorkflowMismatchDialog.ShowDialog(atlasFileName + ".txt", isLinearPMAMismatch, atlasIsPMA)
== WorkflowMismatchDialog.DialogResult.Switch;
}
static bool HasCustomMaterialsAssigned (List<Material> vestigialMaterials, string primaryName, List<string> pageFiles) { static bool HasCustomMaterialsAssigned (List<Material> vestigialMaterials, string primaryName, List<string> pageFiles) {
if (pageFiles.Count == 0 || vestigialMaterials.Count == 0) if (pageFiles.Count == 0 || vestigialMaterials.Count == 0)
return false; return false;

View File

@ -140,6 +140,15 @@ namespace Spine.Unity.Editor {
} }
} }
public static bool ShowWorkflowMismatchDialog {
get { return workflowMismatchDialog; }
set {
if (workflowMismatchDialog == value) return;
workflowMismatchDialog = value;
EditorPrefs.SetBool(WORKFLOW_MISMATCH_DIALOG_KEY, workflowMismatchDialog);
}
}
const string APPLY_ADDITIVE_MATERIAL_KEY = "SPINE_APPLY_ADDITIVE_MATERIAL"; const string APPLY_ADDITIVE_MATERIAL_KEY = "SPINE_APPLY_ADDITIVE_MATERIAL";
const string BLEND_MODE_MATERIAL_MULTIPLY_KEY = "SPINE_BLENDMODE_MATERIAL_MULTIPLY"; const string BLEND_MODE_MATERIAL_MULTIPLY_KEY = "SPINE_BLENDMODE_MATERIAL_MULTIPLY";
const string BLEND_MODE_MATERIAL_SCREEN_KEY = "SPINE_BLENDMODE_MATERIAL_SCREEN"; const string BLEND_MODE_MATERIAL_SCREEN_KEY = "SPINE_BLENDMODE_MATERIAL_SCREEN";
@ -189,6 +198,9 @@ namespace Spine.Unity.Editor {
const string SKELETONDATA_ASSET_NO_FILE_ERROR_KEY = "SPINE_SKELETONDATA_ASSET_NO_FILE_ERROR"; const string SKELETONDATA_ASSET_NO_FILE_ERROR_KEY = "SPINE_SKELETONDATA_ASSET_NO_FILE_ERROR";
public static bool skeletonDataAssetNoFileError = SpinePreferences.DEFAULT_SKELETONDATA_ASSET_NO_FILE_ERROR; public static bool skeletonDataAssetNoFileError = SpinePreferences.DEFAULT_SKELETONDATA_ASSET_NO_FILE_ERROR;
const string WORKFLOW_MISMATCH_DIALOG_KEY = "SPINE_WORKFLOW_MISMATCH_DIALOG";
public static bool workflowMismatchDialog = SpinePreferences.DEFAULT_WORKFLOW_MISMATCH_DIALOG;
public const float DEFAULT_MIPMAPBIAS = SpinePreferences.DEFAULT_MIPMAPBIAS; public const float DEFAULT_MIPMAPBIAS = SpinePreferences.DEFAULT_MIPMAPBIAS;
public const string SCENE_ICONS_SCALE_KEY = "SPINE_SCENE_ICONS_SCALE"; public const string SCENE_ICONS_SCALE_KEY = "SPINE_SCENE_ICONS_SCALE";
@ -234,6 +246,7 @@ namespace Spine.Unity.Editor {
textureImporterWarning = EditorPrefs.GetBool(TEXTUREIMPORTER_WARNING_KEY, SpinePreferences.DEFAULT_TEXTUREIMPORTER_WARNING); textureImporterWarning = EditorPrefs.GetBool(TEXTUREIMPORTER_WARNING_KEY, SpinePreferences.DEFAULT_TEXTUREIMPORTER_WARNING);
componentMaterialWarning = EditorPrefs.GetBool(COMPONENTMATERIAL_WARNING_KEY, SpinePreferences.DEFAULT_COMPONENTMATERIAL_WARNING); componentMaterialWarning = EditorPrefs.GetBool(COMPONENTMATERIAL_WARNING_KEY, SpinePreferences.DEFAULT_COMPONENTMATERIAL_WARNING);
skeletonDataAssetNoFileError = EditorPrefs.GetBool(SKELETONDATA_ASSET_NO_FILE_ERROR_KEY, SpinePreferences.DEFAULT_SKELETONDATA_ASSET_NO_FILE_ERROR); skeletonDataAssetNoFileError = EditorPrefs.GetBool(SKELETONDATA_ASSET_NO_FILE_ERROR_KEY, SpinePreferences.DEFAULT_SKELETONDATA_ASSET_NO_FILE_ERROR);
workflowMismatchDialog = EditorPrefs.GetBool(WORKFLOW_MISMATCH_DIALOG_KEY, SpinePreferences.DEFAULT_WORKFLOW_MISMATCH_DIALOG);
timelineDefaultMixDuration = EditorPrefs.GetBool(TIMELINE_DEFAULT_MIX_DURATION_KEY, SpinePreferences.DEFAULT_TIMELINE_DEFAULT_MIX_DURATION); timelineDefaultMixDuration = EditorPrefs.GetBool(TIMELINE_DEFAULT_MIX_DURATION_KEY, SpinePreferences.DEFAULT_TIMELINE_DEFAULT_MIX_DURATION);
timelineUseBlendDuration = EditorPrefs.GetBool(TIMELINE_USE_BLEND_DURATION_KEY, SpinePreferences.DEFAULT_TIMELINE_USE_BLEND_DURATION); timelineUseBlendDuration = EditorPrefs.GetBool(TIMELINE_USE_BLEND_DURATION_KEY, SpinePreferences.DEFAULT_TIMELINE_USE_BLEND_DURATION);
handleScale = EditorPrefs.GetFloat(SCENE_ICONS_SCALE_KEY, SpinePreferences.DEFAULT_SCENE_ICONS_SCALE); handleScale = EditorPrefs.GetFloat(SCENE_ICONS_SCALE_KEY, SpinePreferences.DEFAULT_SCENE_ICONS_SCALE);
@ -260,6 +273,7 @@ namespace Spine.Unity.Editor {
newPreferences.textureImporterWarning = EditorPrefs.GetBool(TEXTUREIMPORTER_WARNING_KEY, SpinePreferences.DEFAULT_TEXTUREIMPORTER_WARNING); newPreferences.textureImporterWarning = EditorPrefs.GetBool(TEXTUREIMPORTER_WARNING_KEY, SpinePreferences.DEFAULT_TEXTUREIMPORTER_WARNING);
newPreferences.componentMaterialWarning = EditorPrefs.GetBool(COMPONENTMATERIAL_WARNING_KEY, SpinePreferences.DEFAULT_COMPONENTMATERIAL_WARNING); newPreferences.componentMaterialWarning = EditorPrefs.GetBool(COMPONENTMATERIAL_WARNING_KEY, SpinePreferences.DEFAULT_COMPONENTMATERIAL_WARNING);
newPreferences.skeletonDataAssetNoFileError = EditorPrefs.GetBool(SKELETONDATA_ASSET_NO_FILE_ERROR_KEY, SpinePreferences.DEFAULT_SKELETONDATA_ASSET_NO_FILE_ERROR); newPreferences.skeletonDataAssetNoFileError = EditorPrefs.GetBool(SKELETONDATA_ASSET_NO_FILE_ERROR_KEY, SpinePreferences.DEFAULT_SKELETONDATA_ASSET_NO_FILE_ERROR);
newPreferences.workflowMismatchDialog = EditorPrefs.GetBool(WORKFLOW_MISMATCH_DIALOG_KEY, SpinePreferences.DEFAULT_WORKFLOW_MISMATCH_DIALOG);
newPreferences.timelineDefaultMixDuration = EditorPrefs.GetBool(TIMELINE_DEFAULT_MIX_DURATION_KEY, SpinePreferences.DEFAULT_TIMELINE_DEFAULT_MIX_DURATION); newPreferences.timelineDefaultMixDuration = EditorPrefs.GetBool(TIMELINE_DEFAULT_MIX_DURATION_KEY, SpinePreferences.DEFAULT_TIMELINE_DEFAULT_MIX_DURATION);
newPreferences.timelineUseBlendDuration = EditorPrefs.GetBool(TIMELINE_USE_BLEND_DURATION_KEY, SpinePreferences.DEFAULT_TIMELINE_USE_BLEND_DURATION); newPreferences.timelineUseBlendDuration = EditorPrefs.GetBool(TIMELINE_USE_BLEND_DURATION_KEY, SpinePreferences.DEFAULT_TIMELINE_USE_BLEND_DURATION);
newPreferences.handleScale = EditorPrefs.GetFloat(SCENE_ICONS_SCALE_KEY, SpinePreferences.DEFAULT_SCENE_ICONS_SCALE); newPreferences.handleScale = EditorPrefs.GetFloat(SCENE_ICONS_SCALE_KEY, SpinePreferences.DEFAULT_SCENE_ICONS_SCALE);
@ -284,6 +298,7 @@ namespace Spine.Unity.Editor {
EditorPrefs.SetBool(TEXTUREIMPORTER_WARNING_KEY, preferences.textureImporterWarning); EditorPrefs.SetBool(TEXTUREIMPORTER_WARNING_KEY, preferences.textureImporterWarning);
EditorPrefs.SetBool(COMPONENTMATERIAL_WARNING_KEY, preferences.componentMaterialWarning); EditorPrefs.SetBool(COMPONENTMATERIAL_WARNING_KEY, preferences.componentMaterialWarning);
EditorPrefs.SetBool(SKELETONDATA_ASSET_NO_FILE_ERROR_KEY, preferences.skeletonDataAssetNoFileError); EditorPrefs.SetBool(SKELETONDATA_ASSET_NO_FILE_ERROR_KEY, preferences.skeletonDataAssetNoFileError);
EditorPrefs.SetBool(WORKFLOW_MISMATCH_DIALOG_KEY, preferences.workflowMismatchDialog);
EditorPrefs.SetBool(TIMELINE_DEFAULT_MIX_DURATION_KEY, preferences.timelineDefaultMixDuration); EditorPrefs.SetBool(TIMELINE_DEFAULT_MIX_DURATION_KEY, preferences.timelineDefaultMixDuration);
EditorPrefs.SetBool(TIMELINE_USE_BLEND_DURATION_KEY, preferences.timelineUseBlendDuration); EditorPrefs.SetBool(TIMELINE_USE_BLEND_DURATION_KEY, preferences.timelineUseBlendDuration);
EditorPrefs.SetFloat(SCENE_ICONS_SCALE_KEY, preferences.handleScale); EditorPrefs.SetFloat(SCENE_ICONS_SCALE_KEY, preferences.handleScale);
@ -362,6 +377,7 @@ namespace Spine.Unity.Editor {
SpineEditorUtilities.BoolPrefsField(ref textureImporterWarning, TEXTUREIMPORTER_WARNING_KEY, new GUIContent("Texture Settings Warning", "Log a warning and recommendation whenever Texture Import Settings are detected that could lead to undesired effects, e.g. white border artifacts.")); SpineEditorUtilities.BoolPrefsField(ref textureImporterWarning, TEXTUREIMPORTER_WARNING_KEY, new GUIContent("Texture Settings Warning", "Log a warning and recommendation whenever Texture Import Settings are detected that could lead to undesired effects, e.g. white border artifacts."));
SpineEditorUtilities.BoolPrefsField(ref componentMaterialWarning, COMPONENTMATERIAL_WARNING_KEY, new GUIContent("Component & Material Warning", "Log a warning and recommendation whenever Component and Material settings are not compatible.")); SpineEditorUtilities.BoolPrefsField(ref componentMaterialWarning, COMPONENTMATERIAL_WARNING_KEY, new GUIContent("Component & Material Warning", "Log a warning and recommendation whenever Component and Material settings are not compatible."));
SpineEditorUtilities.BoolPrefsField(ref skeletonDataAssetNoFileError, SKELETONDATA_ASSET_NO_FILE_ERROR_KEY, new GUIContent("SkeletonDataAsset no file Error", "Log an error when querying SkeletonData from SkeletonDataAsset with no json or binary file assigned.")); SpineEditorUtilities.BoolPrefsField(ref skeletonDataAssetNoFileError, SKELETONDATA_ASSET_NO_FILE_ERROR_KEY, new GUIContent("SkeletonDataAsset no file Error", "Log an error when querying SkeletonData from SkeletonDataAsset with no json or binary file assigned."));
SpineEditorUtilities.BoolPrefsField(ref workflowMismatchDialog, WORKFLOW_MISMATCH_DIALOG_KEY, new GUIContent("Workflow Mismatch Dialog", "Show warning dialog when PMA atlas is detected but not supported with current project settings."));
SkeletonDataAsset.errorIfSkeletonFileNullGlobal = skeletonDataAssetNoFileError; SkeletonDataAsset.errorIfSkeletonFileNullGlobal = skeletonDataAssetNoFileError;
} }
@ -436,14 +452,14 @@ namespace Spine.Unity.Editor {
} }
} }
static void SwitchToStraightAlphaDefaults () { public static void SwitchToStraightAlphaDefaults () {
AssignEditorPrefsAssetReference(ref textureSettingsReference, TEXTURE_SETTINGS_REFERENCE_KEY, DEFAULT_TEXTURE_TEMPLATE_STRAIGHT); AssignEditorPrefsAssetReference(ref textureSettingsReference, TEXTURE_SETTINGS_REFERENCE_KEY, DEFAULT_TEXTURE_TEMPLATE_STRAIGHT);
AssignEditorPrefsAssetReference(ref blendModeMaterialAdditive, BLEND_MODE_MATERIAL_ADDITIVE_KEY, DEFAULT_BLEND_MODE_ADDITIVE_MATERIAL_STRAIGHT); AssignEditorPrefsAssetReference(ref blendModeMaterialAdditive, BLEND_MODE_MATERIAL_ADDITIVE_KEY, DEFAULT_BLEND_MODE_ADDITIVE_MATERIAL_STRAIGHT);
AssignEditorPrefsAssetReference(ref blendModeMaterialMultiply, BLEND_MODE_MATERIAL_MULTIPLY_KEY, DEFAULT_BLEND_MODE_MULTIPLY_MATERIAL_STRAIGHT); AssignEditorPrefsAssetReference(ref blendModeMaterialMultiply, BLEND_MODE_MATERIAL_MULTIPLY_KEY, DEFAULT_BLEND_MODE_MULTIPLY_MATERIAL_STRAIGHT);
AssignEditorPrefsAssetReference(ref blendModeMaterialScreen, BLEND_MODE_MATERIAL_SCREEN_KEY, DEFAULT_BLEND_MODE_SCREEN_MATERIAL_STRAIGHT); AssignEditorPrefsAssetReference(ref blendModeMaterialScreen, BLEND_MODE_MATERIAL_SCREEN_KEY, DEFAULT_BLEND_MODE_SCREEN_MATERIAL_STRAIGHT);
} }
static void SwitchToPMADefaults () { public static void SwitchToPMADefaults () {
AssignEditorPrefsAssetReference(ref textureSettingsReference, TEXTURE_SETTINGS_REFERENCE_KEY, DEFAULT_TEXTURE_TEMPLATE_PMA); AssignEditorPrefsAssetReference(ref textureSettingsReference, TEXTURE_SETTINGS_REFERENCE_KEY, DEFAULT_TEXTURE_TEMPLATE_PMA);
AssignEditorPrefsAssetReference(ref blendModeMaterialAdditive, BLEND_MODE_MATERIAL_ADDITIVE_KEY, DEFAULT_BLEND_MODE_ADDITIVE_MATERIAL_PMA); AssignEditorPrefsAssetReference(ref blendModeMaterialAdditive, BLEND_MODE_MATERIAL_ADDITIVE_KEY, DEFAULT_BLEND_MODE_ADDITIVE_MATERIAL_PMA);
AssignEditorPrefsAssetReference(ref blendModeMaterialMultiply, BLEND_MODE_MATERIAL_MULTIPLY_KEY, DEFAULT_BLEND_MODE_MULTIPLY_MATERIAL_PMA); AssignEditorPrefsAssetReference(ref blendModeMaterialMultiply, BLEND_MODE_MATERIAL_MULTIPLY_KEY, DEFAULT_BLEND_MODE_MULTIPLY_MATERIAL_PMA);

View File

@ -55,6 +55,20 @@ namespace Spine.Unity.Editor {
public class SpinePreferences : ScriptableObject { public class SpinePreferences : ScriptableObject {
protected struct TextureWorkflowProperties {
public SerializedProperty textureSettingsReference;
public SerializedProperty blendModeMaterialAdditive;
public SerializedProperty blendModeMaterialMultiply;
public SerializedProperty blendModeMaterialScreen;
public TextureWorkflowProperties (SerializedObject settings) {
textureSettingsReference = settings.FindProperty("textureSettingsReference");
blendModeMaterialAdditive = settings.FindProperty("blendModeMaterialAdditive");
blendModeMaterialMultiply = settings.FindProperty("blendModeMaterialMultiply");
blendModeMaterialScreen = settings.FindProperty("blendModeMaterialScreen");
}
}
#if NEW_PREFERENCES_SETTINGS_PROVIDER #if NEW_PREFERENCES_SETTINGS_PROVIDER
static int wasPreferencesDirCreated = 0; static int wasPreferencesDirCreated = 0;
static int wasPreferencesAssetCreated = 0; static int wasPreferencesAssetCreated = 0;
@ -125,6 +139,11 @@ namespace Spine.Unity.Editor {
return true; return true;
} }
public bool ShowWorkflowMismatchDialog {
get { return workflowMismatchDialog; }
set { workflowMismatchDialog = value; }
}
internal const bool DEFAULT_APPLY_ADDITIVE_MATERIAL = false; internal const bool DEFAULT_APPLY_ADDITIVE_MATERIAL = false;
public bool applyAdditiveMaterial = DEFAULT_APPLY_ADDITIVE_MATERIAL; public bool applyAdditiveMaterial = DEFAULT_APPLY_ADDITIVE_MATERIAL;
@ -197,6 +216,9 @@ namespace Spine.Unity.Editor {
internal const bool DEFAULT_SKELETONDATA_ASSET_NO_FILE_ERROR = true; internal const bool DEFAULT_SKELETONDATA_ASSET_NO_FILE_ERROR = true;
public bool skeletonDataAssetNoFileError = DEFAULT_SKELETONDATA_ASSET_NO_FILE_ERROR; public bool skeletonDataAssetNoFileError = DEFAULT_SKELETONDATA_ASSET_NO_FILE_ERROR;
internal const bool DEFAULT_WORKFLOW_MISMATCH_DIALOG = true;
public bool workflowMismatchDialog = DEFAULT_WORKFLOW_MISMATCH_DIALOG;
public const float DEFAULT_MIPMAPBIAS = -0.5f; public const float DEFAULT_MIPMAPBIAS = -0.5f;
public const bool DEFAULT_AUTO_RELOAD_SCENESKELETONS = true; public const bool DEFAULT_AUTO_RELOAD_SCENESKELETONS = true;
@ -306,27 +328,25 @@ namespace Spine.Unity.Editor {
SpineEditorUtilities.FloatPropertyField(settings.FindProperty("defaultScale"), new GUIContent("Default SkeletonData Scale", "The Default skeleton import scale for newly imported SkeletonDataAssets."), min: 0.0000001f); SpineEditorUtilities.FloatPropertyField(settings.FindProperty("defaultScale"), new GUIContent("Default SkeletonData Scale", "The Default skeleton import scale for newly imported SkeletonDataAssets."), min: 0.0000001f);
SpineEditorUtilities.ShaderPropertyField(settings.FindProperty("defaultShader"), new GUIContent("Default Shader"), SpinePreferences.DEFAULT_DEFAULT_SHADER); SpineEditorUtilities.ShaderPropertyField(settings.FindProperty("defaultShader"), new GUIContent("Default Shader"), SpinePreferences.DEFAULT_DEFAULT_SHADER);
SerializedProperty textureSettingsRef = settings.FindProperty("textureSettingsReference"); TextureWorkflowProperties textureProperties = new TextureWorkflowProperties(settings);
SerializedProperty blendModeMaterialAdditive = settings.FindProperty("blendModeMaterialAdditive");
SerializedProperty blendModeMaterialMultiply = settings.FindProperty("blendModeMaterialMultiply");
SerializedProperty blendModeMaterialScreen = settings.FindProperty("blendModeMaterialScreen");
EditorGUILayout.Space(); EditorGUILayout.Space();
using (new GUILayout.HorizontalScope()) { using (new GUILayout.HorizontalScope()) {
EditorGUILayout.PrefixLabel("Switch Texture Workflow"); EditorGUILayout.PrefixLabel("Switch Texture Workflow");
if (GUILayout.Button(new GUIContent("Straight Alpha", "Assign straight-alpha atlas texture workflow templates."), GUILayout.Width(96))) if (GUILayout.Button(new GUIContent("Straight Alpha", "Assign straight-alpha atlas texture workflow templates."), GUILayout.Width(96)))
SwitchToStraightAlphaDefaults(textureSettingsRef, blendModeMaterialAdditive, blendModeMaterialMultiply, blendModeMaterialScreen); SwitchToStraightAlphaDefaults(textureProperties);
bool isLinearColorSpace = QualitySettings.activeColorSpace == ColorSpace.Linear; bool isLinearColorSpace = QualitySettings.activeColorSpace == ColorSpace.Linear;
using (new EditorGUI.DisabledScope(isLinearColorSpace)) { using (new EditorGUI.DisabledScope(isLinearColorSpace)) {
if (GUILayout.Button(new GUIContent("PMA", isLinearColorSpace ? if (GUILayout.Button(new GUIContent("PMA", isLinearColorSpace ?
"[Only supported with Gamma color space]" : "Assign PMA atlas texture workflow templates."), GUILayout.Width(64))) { "[Only supported with Gamma color space]" : "Assign PMA atlas texture workflow templates."), GUILayout.Width(64))) {
SwitchToPMADefaults(textureSettingsRef, blendModeMaterialAdditive, blendModeMaterialMultiply, blendModeMaterialScreen); SwitchToPMADefaults(textureProperties);
} }
} }
} }
EditorGUILayout.PropertyField(settings.FindProperty("setTextureImporterSettings"), new GUIContent("Apply Atlas Texture Settings", "Apply reference settings for Texture Importers.")); EditorGUILayout.PropertyField(settings.FindProperty("setTextureImporterSettings"), new GUIContent("Apply Atlas Texture Settings", "Apply reference settings for Texture Importers."));
var textureSettingsRef = textureProperties.textureSettingsReference;
SpineEditorUtilities.PresetAssetPropertyField(textureSettingsRef, new GUIContent("Atlas Texture Settings", SpineEditorUtilities.PresetAssetPropertyField(textureSettingsRef, new GUIContent("Atlas Texture Settings",
string.Format("Apply the selected texture import settings at newly imported atlas textures.\n\n" + string.Format("Apply the selected texture import settings at newly imported atlas textures.\n\n" +
"When exporting atlas textures from Spine with \"Premultiply alpha\" enabled (the default), assign \"{0}\". If you have disabled \"Premultiply alpha\", leave it at \"{1}\".\n\n" + "When exporting atlas textures from Spine with \"Premultiply alpha\" enabled (the default), assign \"{0}\". If you have disabled \"Premultiply alpha\", leave it at \"{1}\".\n\n" +
@ -343,9 +363,9 @@ namespace Spine.Unity.Editor {
bool isTexturePresetPMA = IsPMAWorkflow(textureSettingsRef.stringValue); bool isTexturePresetPMA = IsPMAWorkflow(textureSettingsRef.stringValue);
EditorGUILayout.PropertyField(settings.FindProperty("applyAdditiveMaterial"), EditorGUILayout.PropertyField(settings.FindProperty("applyAdditiveMaterial"),
new GUIContent("Apply Additive Material", "The Default Apply Additive Material setting for newly imported SkeletonDataAssets.")); new GUIContent("Apply Additive Material", "The Default Apply Additive Material setting for newly imported SkeletonDataAssets."));
ShowBlendModeMaterialProperty(blendModeMaterialAdditive, "Additive", isTexturePresetPMA); ShowBlendModeMaterialProperty(textureProperties.blendModeMaterialAdditive, "Additive", isTexturePresetPMA);
ShowBlendModeMaterialProperty(blendModeMaterialMultiply, "Multiply", isTexturePresetPMA); ShowBlendModeMaterialProperty(textureProperties.blendModeMaterialMultiply, "Multiply", isTexturePresetPMA);
ShowBlendModeMaterialProperty(blendModeMaterialScreen, "Screen", isTexturePresetPMA); ShowBlendModeMaterialProperty(textureProperties.blendModeMaterialScreen, "Screen", isTexturePresetPMA);
} }
EditorGUILayout.Space(); EditorGUILayout.Space();
@ -355,6 +375,7 @@ namespace Spine.Unity.Editor {
EditorGUILayout.PropertyField(settings.FindProperty("textureImporterWarning"), new GUIContent("Texture Settings Warning", "Log a warning and recommendation whenever Texture Import Settings are detected that could lead to undesired effects, e.g. white border artifacts.")); EditorGUILayout.PropertyField(settings.FindProperty("textureImporterWarning"), new GUIContent("Texture Settings Warning", "Log a warning and recommendation whenever Texture Import Settings are detected that could lead to undesired effects, e.g. white border artifacts."));
EditorGUILayout.PropertyField(settings.FindProperty("componentMaterialWarning"), new GUIContent("Component & Material Warning", "Log a warning and recommendation whenever Component and Material settings are not compatible.")); EditorGUILayout.PropertyField(settings.FindProperty("componentMaterialWarning"), new GUIContent("Component & Material Warning", "Log a warning and recommendation whenever Component and Material settings are not compatible."));
EditorGUILayout.PropertyField(settings.FindProperty("skeletonDataAssetNoFileError"), new GUIContent("SkeletonDataAsset no file Error", "Log an error when querying SkeletonData from SkeletonDataAsset with no json or binary file assigned.")); EditorGUILayout.PropertyField(settings.FindProperty("skeletonDataAssetNoFileError"), new GUIContent("SkeletonDataAsset no file Error", "Log an error when querying SkeletonData from SkeletonDataAsset with no json or binary file assigned."));
EditorGUILayout.PropertyField(settings.FindProperty("workflowMismatchDialog"), new GUIContent("Workflow Mismatch Dialog", "Show warning dialog when PMA atlas is detected but not supported with current project settings."));
SkeletonDataAsset.errorIfSkeletonFileNullGlobal = settings.FindProperty("skeletonDataAssetNoFileError").boolValue; SkeletonDataAsset.errorIfSkeletonFileNullGlobal = settings.FindProperty("skeletonDataAssetNoFileError").boolValue;
} }
@ -463,24 +484,32 @@ namespace Spine.Unity.Editor {
} }
} }
static void SwitchToStraightAlphaDefaults (SerializedProperty textureSettingsReference, public void SwitchToStraightAlphaDefaults () {
SerializedProperty blendModeMaterialAdditive, SerializedProperty blendModeMaterialMultiply, SerializedObject serializedSettings = new SerializedObject(this);
SerializedProperty blendModeMaterialScreen) { TextureWorkflowProperties properties = new TextureWorkflowProperties(serializedSettings);
SwitchToStraightAlphaDefaults(properties);
AssignAssetString(textureSettingsReference, DEFAULT_TEXTURE_PRESET_STRAIGHT); serializedSettings.ApplyModifiedProperties();
AssignAssetReference(blendModeMaterialAdditive, DEFAULT_BLEND_MODE_ADDITIVE_MATERIAL_STRAIGHT);
AssignAssetReference(blendModeMaterialMultiply, DEFAULT_BLEND_MODE_MULTIPLY_MATERIAL_STRAIGHT);
AssignAssetReference(blendModeMaterialScreen, DEFAULT_BLEND_MODE_SCREEN_MATERIAL_STRAIGHT);
} }
static void SwitchToPMADefaults (SerializedProperty textureSettingsReference, public void SwitchToPMADefaults () {
SerializedProperty blendModeMaterialAdditive, SerializedProperty blendModeMaterialMultiply, SerializedObject serializedSettings = new SerializedObject(this);
SerializedProperty blendModeMaterialScreen) { TextureWorkflowProperties properties = new TextureWorkflowProperties(serializedSettings);
SwitchToPMADefaults(properties);
serializedSettings.ApplyModifiedProperties();
}
AssignAssetString(textureSettingsReference, DEFAULT_TEXTURE_PRESET_PMA); static void SwitchToStraightAlphaDefaults (TextureWorkflowProperties properties) {
AssignAssetReference(blendModeMaterialAdditive, DEFAULT_BLEND_MODE_ADDITIVE_MATERIAL_PMA); AssignAssetString(properties.textureSettingsReference, DEFAULT_TEXTURE_PRESET_STRAIGHT);
AssignAssetReference(blendModeMaterialMultiply, DEFAULT_BLEND_MODE_MULTIPLY_MATERIAL_PMA); AssignAssetReference(properties.blendModeMaterialAdditive, DEFAULT_BLEND_MODE_ADDITIVE_MATERIAL_STRAIGHT);
AssignAssetReference(blendModeMaterialScreen, DEFAULT_BLEND_MODE_SCREEN_MATERIAL_PMA); AssignAssetReference(properties.blendModeMaterialMultiply, DEFAULT_BLEND_MODE_MULTIPLY_MATERIAL_STRAIGHT);
AssignAssetReference(properties.blendModeMaterialScreen, DEFAULT_BLEND_MODE_SCREEN_MATERIAL_STRAIGHT);
}
static void SwitchToPMADefaults (TextureWorkflowProperties properties) {
AssignAssetString(properties.textureSettingsReference, DEFAULT_TEXTURE_PRESET_PMA);
AssignAssetReference(properties.blendModeMaterialAdditive, DEFAULT_BLEND_MODE_ADDITIVE_MATERIAL_PMA);
AssignAssetReference(properties.blendModeMaterialMultiply, DEFAULT_BLEND_MODE_MULTIPLY_MATERIAL_PMA);
AssignAssetReference(properties.blendModeMaterialScreen, DEFAULT_BLEND_MODE_SCREEN_MATERIAL_PMA);
} }
#endif // NEW_PREFERENCES_SETTINGS_PROVIDER #endif // NEW_PREFERENCES_SETTINGS_PROVIDER
} }

View File

@ -0,0 +1,312 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated April 5, 2025. Replaces all prior versions.
*
* Copyright (c) 2013-2025, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#if UNITY_2019_1_OR_NEWER
#define HAS_MODAL_UTILITY
#endif
using UnityEditor;
using UnityEngine;
namespace Spine.Unity.Editor {
#if !HAS_MODAL_UTILITY
public class WorkflowMismatchDialog {
public enum DialogResult {
None = -1,
Switch = 0,
ReexportInstructions = 1,
Cancel = 2
}
const string REEXPORT_INSTRUCTIONS_URL = "https://esotericsoftware.com/spine-unity-assets#Correct-Texture-Packer-export-and-Texture-and-Material-import-settings:";
public static DialogResult ShowDialog (string atlasName, bool isLinearPMAMismatch, bool atlasIsPMA) {
int result;
if (isLinearPMAMismatch) {
result = EditorUtility.DisplayDialogComplex("Premultiply Alpha Atlas not supported",
string.Format("Atlas '{0}':\n" +
"Atlas was exported with 'Premultiply alpha' (PMA) enabled, but " +
"the Unity project is set to Linear color space, which does not support PMA.\n\n" +
"We can switch your Unity Project to Gamma color space to fix this.\n\n" +
"Alternatively you can re-export your atlas from Spine with straight alpha instead.", atlasName),
"Switch to Gamma", "Export Instructions", "Don't show again");
if (result == 0) { // Switch to Gamma
PlayerSettings.colorSpace = ColorSpace.Gamma;
Debug.Log("Switched Unity project to Gamma color space to support PMA atlas textures. To change it back go to 'Project Settings - Player - Other Settings - Color Space'.");
} else if (result == 1) { // Export Instructions
Application.OpenURL(REEXPORT_INSTRUCTIONS_URL);
} else { // Don't show again
SpineEditorUtilities.Preferences.ShowWorkflowMismatchDialog = false;
Debug.Log("Disabled Workflow Mismatch Dialog, only logging a warning. To re-enable go to 'Edit - Preferences - Spine'.");
}
} else {
string title = "PMA vs Straight Alpha Preset Mismatch";
string text;
if (atlasIsPMA) {
text = "Atlas was exported with 'Premultiply alpha' (PMA) enabled, but " +
"the Spine Preferences Auto-Import presets are set to straight alpha.\n\n" +
"We can switch your presets to PMA to fix this.\n\n" +
"Alternatively you can re-export your atlas from Spine with straight alpha instead.";
} else {
text = "Atlas was exported with 'straight alpha' ('Premultiply alpha' disabled), but " +
"the Spine Preferences Auto-Import presets are set to PMA.\n\n" +
"We can switch your presets to straight alpha to fix this.\n\n" +
"Alternatively you can re-export your atlas from Spine with Premultiply alpha instead.";
}
result = EditorUtility.DisplayDialogComplex(title,
string.Format("Atlas '{0}':\n{1}", atlasName, text),
"Switch Presets", "Export Instructions", "Don't show again");
if (result == 0) { // Switch Presets
if (atlasIsPMA) {
SpineEditorUtilities.Preferences.SwitchToPMADefaults();
Debug.Log("Switched Auto-Import presets to PMA texture workflow. To change it back go to 'Edit - Preferences - Spine'.");
} else {
SpineEditorUtilities.Preferences.SwitchToStraightAlphaDefaults();
Debug.Log("Switched Auto-Import presets to straight alpha texture workflow. To change it back go to 'Edit - Preferences - Spine'.");
}
} else if (result == 1) { // Export Instructions
Application.OpenURL(REEXPORT_INSTRUCTIONS_URL);
} else { // Don't show again
SpineEditorUtilities.Preferences.ShowWorkflowMismatchDialog = false;
Debug.Log("Disabled Workflow Mismatch Dialog, only logging a warning. To re-enable go to 'Edit - Preferences - Spine'.");
}
}
return (DialogResult)result;
}
}
#else
using Icons = SpineEditorUtilities.Icons;
public class WorkflowMismatchDialog : EditorWindow {
public enum DialogResult {
None = -1,
Switch = 0,
ReexportInstructions = 1,
Cancel = 2
}
const string REEXPORT_INSTRUCTIONS_URL = "https://esotericsoftware.com/spine-unity-assets#Correct-Texture-Packer-export-and-Texture-and-Material-import-settings:";
private static DialogResult dialogResult = DialogResult.None;
private static WorkflowMismatchDialog currentWindow;
private bool isLinearPMAMismatch;
private bool atlasIsPMA;
private string atlasName;
private bool dontShowAgain = false;
public static DialogResult ShowDialog (string atlasName, bool isLinearPMAMismatch, bool atlasIsPMA) {
if (currentWindow != null) {
currentWindow.Close();
}
dialogResult = DialogResult.None;
currentWindow = CreateInstance<WorkflowMismatchDialog>();
currentWindow.atlasIsPMA = atlasIsPMA;
currentWindow.atlasName = atlasName;
currentWindow.isLinearPMAMismatch = isLinearPMAMismatch;
string title = isLinearPMAMismatch ?
"Premultiply Alpha Atlas not supported" : "PMA vs Straight Alpha Preset Mismatch";
currentWindow.titleContent = new GUIContent(title);
Vector2 windowSize = new Vector2(400, 240);
currentWindow.minSize = windowSize;
currentWindow.maxSize = windowSize;
float x = (Screen.currentResolution.width - windowSize.x) / 2;
float y = (Screen.currentResolution.height - windowSize.y) * 0.25f;
currentWindow.position = new Rect(x, y, windowSize.x, windowSize.y);
currentWindow.ShowModalUtility();
return dialogResult;
}
void OnGUI () {
GUIStyle dialogStyle = new GUIStyle("window");
dialogStyle.padding = new RectOffset(0, 0, 0, 0);
GUILayout.BeginArea(new Rect(15, 15, position.width - 30, position.height - 30));
GUIStyle messageStyle = new GUIStyle(EditorStyles.label) {
richText = true,
wordWrap = true,
fontSize = EditorStyles.label.fontSize,
alignment = TextAnchor.UpperLeft
};
GUILayout.BeginHorizontal();
var warningIcon = Icons.warning;
if (warningIcon != null) {
GUI.DrawTexture(new Rect(0, 0, 60, 60), warningIcon);
GUILayout.Space(70);
}
if (isLinearPMAMismatch)
DrawLinearColorSpacePMAMismatch(atlasName, messageStyle);
else
DrawStraightPMAPresetsMismatch(messageStyle, atlasIsPMA);
GUILayout.EndHorizontal();
GUILayout.EndArea();
}
void DrawLinearColorSpacePMAMismatch (string atlasName, GUIStyle messageStyle) {
GUILayout.BeginVertical();
GUILayout.Label(
string.Format("Atlas '{0}':\n" +
"Atlas was exported with '<b>Premultiply alpha</b>' (PMA) enabled, but " +
"the Unity project is set to <b>Linear color space</b>, which does not support PMA.\n\n" +
"We can <b>switch your Unity Project to Gamma</b> color space to fix this.\n\n" +
"Alternatively you can <b>re-export your atlas</b> from Spine with <b>straight alpha</b> instead.", atlasName),
messageStyle
);
GUILayout.Space(10);
dontShowAgain = !SpineEditorUtilities.Preferences.ShowWorkflowMismatchDialog;
dontShowAgain = EditorGUILayout.ToggleLeft(new GUIContent("Don't show again",
"Don't show this dialog again and only log a warning. To re-enable go to 'Edit - Preferences - Spine'."),
dontShowAgain);
if (dontShowAgain == SpineEditorUtilities.Preferences.ShowWorkflowMismatchDialog) {
SpineEditorUtilities.Preferences.ShowWorkflowMismatchDialog = !dontShowAgain;
if (dontShowAgain)
Debug.Log("Disabled Workflow Mismatch Dialog, only logging a warning. To re-enable go to 'Edit - Preferences - Spine'.");
}
GUILayout.Space(10);
GUILayout.EndVertical();
GUILayout.EndHorizontal();
GUILayout.FlexibleSpace();
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
if (GUILayout.Button("Switch to Gamma", GUILayout.Width(120), GUILayout.Height(24))) {
dialogResult = DialogResult.Switch;
PlayerSettings.colorSpace = ColorSpace.Gamma;
Debug.Log("Switched Unity project to Gamma color space to support PMA atlas textures. To change it back go to 'Project Settings - Player - Other Settings - Color Space'.");
currentWindow = null;
Close();
}
GUILayout.Space(5);
if (GUILayout.Button("Re-export Instructions", GUILayout.Width(140), GUILayout.Height(24))) {
dialogResult = DialogResult.ReexportInstructions;
Application.OpenURL(REEXPORT_INSTRUCTIONS_URL);
currentWindow = null;
Close();
}
GUILayout.Space(5);
if (GUILayout.Button("Cancel", GUILayout.Width(75), GUILayout.Height(24))) {
dialogResult = DialogResult.Cancel;
currentWindow = null;
Close();
}
}
void DrawStraightPMAPresetsMismatch (GUIStyle messageStyle, bool atlasIsPMA) {
GUILayout.BeginVertical();
if (atlasIsPMA) {
GUILayout.Label(
string.Format("Atlas '{0}':\n" +
"Atlas was exported with '<b>Premultiply alpha</b>' (PMA) enabled, but " +
"the Spine Preferences Auto-Import presets are set to <b>straight alpha</b>.\n\n" +
"We can <b>switch your presets to PMA</b> to fix this.\n\n" +
"Alternatively you can <b>re-export your atlas</b> from Spine with <b>straight alpha</b> instead.", atlasName),
messageStyle);
} else {
GUILayout.Label(
string.Format("Atlas '{0}':\n" +
"Atlas was exported with '<b>straight alpha</b>' ('Premultiply alpha' disabled), but " +
"the Spine Preferences Auto-Import presets are set to <b>PMA</b>.\n\n" +
"We can <b>switch your presets to straight alpha</b> to fix this.\n\n" +
"Alternatively you can <b>re-export your atlas</b> from Spine with <b>Premultiply alpha</b> instead.", atlasName),
messageStyle);
}
GUILayout.Space(10);
dontShowAgain = !SpineEditorUtilities.Preferences.ShowWorkflowMismatchDialog;
dontShowAgain = EditorGUILayout.ToggleLeft(new GUIContent("Don't show again",
"Don't show this dialog again and only log a warning. To re-enabled go to 'Edit - Preferences - Spine'."),
dontShowAgain);
if (dontShowAgain == SpineEditorUtilities.Preferences.ShowWorkflowMismatchDialog) {
SpineEditorUtilities.Preferences.ShowWorkflowMismatchDialog = !dontShowAgain;
if (dontShowAgain)
Debug.Log("Disabled Workflow Mismatch Dialog, only logging a warning. To re-enable go to 'Edit - Preferences - Spine'.");
}
GUILayout.Space(10);
GUILayout.EndVertical();
GUILayout.EndHorizontal();
GUILayout.FlexibleSpace();
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
if (GUILayout.Button("Switch Presets", GUILayout.Width(120), GUILayout.Height(24))) {
dialogResult = DialogResult.Switch;
if (atlasIsPMA) {
SpineEditorUtilities.Preferences.SwitchToPMADefaults();
Debug.Log("Switched Auto-Import presets to PMA texture workflow. To change it back go to 'Edit - Preferences - Spine'.");
} else {
SpineEditorUtilities.Preferences.SwitchToStraightAlphaDefaults();
Debug.Log("Switched Auto-Import presets to straight alpha texture workflow. To change it back go to 'Edit - Preferences - Spine'.");
}
currentWindow = null;
Close();
}
GUILayout.Space(5);
if (GUILayout.Button("Re-export Instructions", GUILayout.Width(140), GUILayout.Height(24))) {
dialogResult = DialogResult.ReexportInstructions;
Application.OpenURL(REEXPORT_INSTRUCTIONS_URL);
currentWindow = null;
Close();
}
GUILayout.Space(5);
if (GUILayout.Button("Cancel", GUILayout.Width(75), GUILayout.Height(24))) {
dialogResult = DialogResult.Cancel;
currentWindow = null;
Close();
}
}
void OnDestroy () {
if (currentWindow == this) {
currentWindow = null;
if (dialogResult == DialogResult.None)
dialogResult = DialogResult.Cancel;
}
}
}
#endif
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 401086b644d37bc449b865d723b28524
timeCreated: 1758656889
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

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