mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[unity] Improved warnings for incorrect material settings, now not triggering at non-Spine shaders. See #1305.
This commit is contained in:
parent
f004e74965
commit
75d16a4fc9
@ -266,6 +266,13 @@ namespace Spine.Unity.Editor {
|
|||||||
if (texImporter == null) {
|
if (texImporter == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int extensionPos = texturePath.LastIndexOf('.');
|
||||||
|
string materialPath = texturePath.Substring(0, extensionPos) + "_Material.mat";
|
||||||
|
Material material = AssetDatabase.LoadAssetAtPath<Material>(materialPath);
|
||||||
|
if (material == null || !material.HasProperty(STRAIGHT_ALPHA_PARAM_ID)) {
|
||||||
|
return true; // non-Spine shader used on material
|
||||||
|
}
|
||||||
|
|
||||||
// 'sRGBTexture = true' generates incorrectly weighted mipmaps at PMA textures,
|
// 'sRGBTexture = true' generates incorrectly weighted mipmaps at PMA textures,
|
||||||
// causing white borders due to undesired custom weighting.
|
// causing white borders due to undesired custom weighting.
|
||||||
@ -273,17 +280,10 @@ namespace Spine.Unity.Editor {
|
|||||||
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);
|
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) {
|
if (texImporter.alphaIsTransparency) {
|
||||||
int extensionPos = texturePath.LastIndexOf('.');
|
int straightAlphaValue = material.GetInt(STRAIGHT_ALPHA_PARAM_ID);
|
||||||
string materialPath = texturePath.Substring(0, extensionPos) + "_Material.mat";
|
if (straightAlphaValue == 0) {
|
||||||
Material material = AssetDatabase.LoadAssetAtPath<Material>(materialPath);
|
string materialName = System.IO.Path.GetFileName(materialPath);
|
||||||
if (material != null) {
|
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);
|
||||||
if (material.HasProperty(STRAIGHT_ALPHA_PARAM_ID)) {
|
|
||||||
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;
|
return true;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user