[unity] Added missing added changes of previous commit 6a3fb6a.

This commit is contained in:
Harald Csaszar 2022-03-01 11:32:41 +01:00
parent 6a3fb6a42a
commit b7f4bbc5e3

View File

@ -123,8 +123,7 @@ namespace Spine.Unity {
return isProblematic; return isProblematic;
} }
public static bool IsMaterialSetupProblematic(SkeletonGraphic skeletonGraphic, ref string errorMessage) public static bool IsMaterialSetupProblematic (SkeletonGraphic skeletonGraphic, ref string errorMessage) {
{
var material = skeletonGraphic.material; var material = skeletonGraphic.material;
bool isProblematic = false; bool isProblematic = false;
if (material) { if (material) {
@ -157,11 +156,11 @@ namespace Spine.Unity {
return isProblematic; return isProblematic;
} }
public static bool IsMaterialSetupProblematic(Material material, ref string errorMessage) { public static bool IsMaterialSetupProblematic (Material material, ref string errorMessage) {
return !IsColorSpaceSupported(material, ref errorMessage); return !IsColorSpaceSupported(material, ref errorMessage);
} }
public static bool IsZSpacingRequired(Material material, ref string errorMessage) { public static bool IsZSpacingRequired (Material material, ref string errorMessage) {
bool hasForwardAddPass = material.FindPass("FORWARD_DELTA") >= 0; bool hasForwardAddPass = material.FindPass("FORWARD_DELTA") >= 0;
if (hasForwardAddPass) { if (hasForwardAddPass) {
errorMessage += kZSpacingRequiredMessage; errorMessage += kZSpacingRequiredMessage;
@ -222,8 +221,7 @@ namespace Spine.Unity {
"(You can disable this warning in `Edit - Preferences - Spine`)\n", texturePath, materialName); "(You can disable this warning in `Edit - Preferences - Spine`)\n", texturePath, materialName);
isProblematic = true; isProblematic = true;
} }
} } else { // straight alpha texture
else { // straight alpha texture
if (!alphaIsTransparency) { if (!alphaIsTransparency) {
string materialName = System.IO.Path.GetFileName(materialPath); string materialName = System.IO.Path.GetFileName(materialPath);
errorMessage += string.Format("`{0}` and material `{1}` : Incorrect" + errorMessage += string.Format("`{0}` and material `{1}` : Incorrect" +
@ -245,14 +243,12 @@ namespace Spine.Unity {
material.DisableKeyword(STRAIGHT_ALPHA_KEYWORD); material.DisableKeyword(STRAIGHT_ALPHA_KEYWORD);
else else
material.EnableKeyword(STRAIGHT_ALPHA_KEYWORD); material.EnableKeyword(STRAIGHT_ALPHA_KEYWORD);
} } else {
else {
if (enablePMATexture) { if (enablePMATexture) {
material.DisableKeyword(ALPHAPREMULTIPLY_ON_KEYWORD); material.DisableKeyword(ALPHAPREMULTIPLY_ON_KEYWORD);
material.DisableKeyword(ALPHABLEND_ON_KEYWORD); material.DisableKeyword(ALPHABLEND_ON_KEYWORD);
material.EnableKeyword(ALPHAPREMULTIPLY_VERTEX_ONLY_ON_KEYWORD); material.EnableKeyword(ALPHAPREMULTIPLY_VERTEX_ONLY_ON_KEYWORD);
} } else {
else {
material.DisableKeyword(ALPHAPREMULTIPLY_ON_KEYWORD); material.DisableKeyword(ALPHAPREMULTIPLY_ON_KEYWORD);
material.DisableKeyword(ALPHAPREMULTIPLY_VERTEX_ONLY_ON_KEYWORD); material.DisableKeyword(ALPHAPREMULTIPLY_VERTEX_ONLY_ON_KEYWORD);
material.EnableKeyword(ALPHABLEND_ON_KEYWORD); material.EnableKeyword(ALPHABLEND_ON_KEYWORD);
@ -260,7 +256,7 @@ namespace Spine.Unity {
} }
} }
static bool IsPMATextureMaterial (Material material) { public static bool IsPMATextureMaterial (Material material) {
bool usesAlphaPremultiplyKeyword = IsSpriteShader(material); bool usesAlphaPremultiplyKeyword = IsSpriteShader(material);
if (usesAlphaPremultiplyKeyword) if (usesAlphaPremultiplyKeyword)
return material.IsKeywordEnabled(ALPHAPREMULTIPLY_ON_KEYWORD); return material.IsKeywordEnabled(ALPHAPREMULTIPLY_ON_KEYWORD);