mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-22 02:06:03 +08:00
[unity] Added an additional warning when Alpha Is Transparency is enabled at PMA textures, which causes incorrect light ghosting in transparent areas. See #1266.
This commit is contained in:
parent
ba57dc857a
commit
29ac3d9d67
@ -167,6 +167,8 @@ namespace Spine.Unity.Editor {
|
||||
public static string editorGUIPath = "";
|
||||
public static bool initialized;
|
||||
|
||||
static int STRAIGHT_ALPHA_PARAM_ID = Shader.PropertyToID("_StraightAlphaInput");
|
||||
|
||||
// Preferences entry point
|
||||
[PreferenceItem("Spine")]
|
||||
static void PreferencesGUI () {
|
||||
@ -270,6 +272,18 @@ namespace Spine.Unity.Editor {
|
||||
if (texImporter.sRGBTexture && texImporter.mipmapEnabled) {
|
||||
Debug.LogWarningFormat("`{0}` : Incorrect Texture Settings found: When enabling `Generate Mip Maps`, it is strongly recommended to disable `sRGB (Color Texture)`. Otherwise you will receive white border artifacts on an atlas exported with default `Premultiply alpha` settings.\n(You can disable this warning in `Edit - Preferences - Spine`)", texturePath);
|
||||
}
|
||||
if (texImporter.alphaIsTransparency) {
|
||||
int extensionPos = texturePath.LastIndexOf('.');
|
||||
string materialPath = texturePath.Substring(0, extensionPos) + "_Material.mat";
|
||||
Material material = AssetDatabase.LoadAssetAtPath<Material>(materialPath);
|
||||
if (material != null) {
|
||||
int straightAlphaValue = material.GetInt(STRAIGHT_ALPHA_PARAM_ID);
|
||||
if (straightAlphaValue == 0) {
|
||||
string materialName = System.IO.Path.GetFileName(materialPath);
|
||||
Debug.LogWarningFormat("`{0}` and material `{1}` : Incorrect Texture / Material Settings found: It is strongly recommended to disable `Alpha Is Transparency` on `Premultiply alpha` textures.\nAssuming `Premultiply alpha` texture because `Straight Alpha Texture` is disabled at material). (You can disable this warning in `Edit - Preferences - Spine`)", texturePath, materialName);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user