mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
Merge branch '3.7' into 3.8-beta
This commit is contained in:
commit
55d2a644bd
@ -120,7 +120,7 @@ namespace spine {
|
||||
if (slot->getAttachment()->getRTTI().isExactly(RegionAttachment::rtti)) {
|
||||
RegionAttachment* attachment = (RegionAttachment*)slot->getAttachment();
|
||||
texture = static_cast<AttachmentVertices*>(attachment->getRendererObject())->_texture;
|
||||
} else if (slot->getAttachment()->getRTTI().isExactly(RegionAttachment::rtti)) {
|
||||
} else if (slot->getAttachment()->getRTTI().isExactly(MeshAttachment::rtti)) {
|
||||
MeshAttachment* attachment = (MeshAttachment*)slot->getAttachment();
|
||||
texture = static_cast<AttachmentVertices*>(attachment->getRendererObject())->_texture;
|
||||
} else {
|
||||
|
||||
@ -117,7 +117,7 @@ namespace Spine.Unity {
|
||||
/// <summary>Shader property ID used for the Stencil comparison function.</summary>
|
||||
public static readonly int STENCIL_COMP_PARAM_ID = Shader.PropertyToID("_StencilComp");
|
||||
/// <summary>Shader property value used as Stencil comparison function for <see cref="SpriteMaskInteraction.None"/>.</summary>
|
||||
public const UnityEngine.Rendering.CompareFunction STENCIL_COMP_MASKINTERACTION_NONE = UnityEngine.Rendering.CompareFunction.Disabled;
|
||||
public const UnityEngine.Rendering.CompareFunction STENCIL_COMP_MASKINTERACTION_NONE = UnityEngine.Rendering.CompareFunction.Always;
|
||||
/// <summary>Shader property value used as Stencil comparison function for <see cref="SpriteMaskInteraction.VisibleInsideMask"/>.</summary>
|
||||
public const UnityEngine.Rendering.CompareFunction STENCIL_COMP_MASKINTERACTION_VISIBLE_INSIDE = UnityEngine.Rendering.CompareFunction.LessEqual;
|
||||
/// <summary>Shader property value used as Stencil comparison function for <see cref="SpriteMaskInteraction.VisibleOutsideMask"/>.</summary>
|
||||
@ -476,6 +476,12 @@ namespace Spine.Unity {
|
||||
#if BUILT_IN_SPRITE_MASK_COMPONENT
|
||||
private void AssignSpriteMaskMaterials()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (!Application.isPlaying) {
|
||||
EditorFixStencilCompParameters();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (maskMaterials.materialsMaskDisabled.Length > 0 && maskMaterials.materialsMaskDisabled[0] != null &&
|
||||
maskInteraction == SpriteMaskInteraction.None) {
|
||||
this.meshRenderer.materials = maskMaterials.materialsMaskDisabled;
|
||||
@ -523,6 +529,43 @@ namespace Spine.Unity {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
private void EditorFixStencilCompParameters() {
|
||||
if (HasAnyStencilComp0Material())
|
||||
FixAllProjectMaterialsStencilCompParameters();
|
||||
}
|
||||
|
||||
private void FixAllProjectMaterialsStencilCompParameters() {
|
||||
string[] materialGUIDS = UnityEditor.AssetDatabase.FindAssets("t:material");
|
||||
foreach (var guid in materialGUIDS) {
|
||||
string path = UnityEditor.AssetDatabase.GUIDToAssetPath(guid);
|
||||
if (!string.IsNullOrEmpty(path)) {
|
||||
var mat = UnityEditor.AssetDatabase.LoadAssetAtPath<Material>(path);
|
||||
if (mat.HasProperty(STENCIL_COMP_PARAM_ID) && mat.GetFloat(STENCIL_COMP_PARAM_ID) == 0) {
|
||||
mat.SetFloat(STENCIL_COMP_PARAM_ID, (int)STENCIL_COMP_MASKINTERACTION_NONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
UnityEditor.AssetDatabase.Refresh();
|
||||
UnityEditor.AssetDatabase.SaveAssets();
|
||||
}
|
||||
|
||||
private bool HasAnyStencilComp0Material() {
|
||||
if (meshRenderer == null)
|
||||
return false;
|
||||
|
||||
foreach (var mat in meshRenderer.sharedMaterials) {
|
||||
if (mat != null && mat.HasProperty(STENCIL_COMP_PARAM_ID)) {
|
||||
float currentCompValue = mat.GetFloat(STENCIL_COMP_PARAM_ID);
|
||||
if (currentCompValue == 0)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif // UNITY_EDITOR
|
||||
|
||||
#endif //#if BUILT_IN_SPRITE_MASK_COMPONENT
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ Shader "Spine/Special/SkeletonGhost" {
|
||||
[NoScaleOffset] _MainTex ("Base (RGB) Alpha (A)", 2D) = "white" {}
|
||||
_TextureFade ("Texture Fade Out", Range(0,1)) = 0
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Compare", Float) = 0.0 // Disabled stencil test by default
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
}
|
||||
SubShader {
|
||||
Tags {
|
||||
|
||||
@ -10,7 +10,7 @@ Shader "Spine/Skeleton Fill" {
|
||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Compare", Float) = 0.0 // Disabled stencil test by default
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
}
|
||||
SubShader {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
|
||||
|
||||
@ -12,7 +12,7 @@ Shader "Spine/Skeleton Tint" {
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Compare", Float) = 0.0 // Disabled stencil test by default
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
}
|
||||
|
||||
SubShader {
|
||||
|
||||
@ -9,7 +9,7 @@ Shader "Spine/Special/Skeleton Grayscale" {
|
||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Compare", Float) = 0.0 // Disabled stencil test by default
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
}
|
||||
SubShader {
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
|
||||
|
||||
@ -45,7 +45,7 @@ Shader "Spine/Sprite/Pixel Lit"
|
||||
[HideInInspector] _RenderQueue ("__queue", Float) = 0.0
|
||||
[HideInInspector] _Cull ("__cull", Float) = 0.0
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Compare", Float) = 0.0 // Disabled stencil test by default
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
}
|
||||
|
||||
SubShader
|
||||
|
||||
@ -27,7 +27,7 @@ Shader "Spine/Sprite/Unlit"
|
||||
[HideInInspector] _RenderQueue ("__queue", Float) = 0.0
|
||||
[HideInInspector] _Cull ("__cull", Float) = 0.0
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Compare", Float) = 0.0 // Disabled stencil test by default
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
}
|
||||
|
||||
SubShader
|
||||
|
||||
@ -45,7 +45,7 @@ Shader "Spine/Sprite/Vertex Lit"
|
||||
[HideInInspector] _RenderQueue ("__queue", Float) = 0.0
|
||||
[HideInInspector] _Cull ("__cull", Float) = 0.0
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Compare", Float) = 0.0 // Disabled stencil test by default
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
}
|
||||
|
||||
SubShader
|
||||
|
||||
@ -12,7 +12,7 @@ Shader "Spine/Blend Modes/Skeleton PMA Additive" {
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Compare", Float) = 0.0 // Disabled stencil test by default
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
}
|
||||
|
||||
SubShader {
|
||||
|
||||
@ -12,7 +12,7 @@ Shader "Spine/Blend Modes/Skeleton PMA Multiply" {
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Compare", Float) = 0.0 // Disabled stencil test by default
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
}
|
||||
|
||||
SubShader {
|
||||
|
||||
@ -12,7 +12,7 @@ Shader "Spine/Blend Modes/Skeleton PMA Screen" {
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Compare", Float) = 0.0 // Disabled stencil test by default
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
}
|
||||
|
||||
SubShader {
|
||||
|
||||
@ -14,7 +14,7 @@ Shader "Spine/Skeleton Tint Black" {
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Compare", Float) = 0.0 // Disabled stencil test by default
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
}
|
||||
|
||||
SubShader {
|
||||
|
||||
@ -4,7 +4,7 @@ Shader "Spine/Skeleton" {
|
||||
[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Compare", Float) = 0.0 // Disabled stencil test by default
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
}
|
||||
|
||||
SubShader {
|
||||
|
||||
@ -8,7 +8,7 @@ Shader "Spine/Skeleton Lit" {
|
||||
[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
|
||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Compare", Float) = 0.0 // Disabled stencil test by default
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
|
||||
}
|
||||
|
||||
SubShader {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user