mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-22 02:06:03 +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)) {
|
if (slot->getAttachment()->getRTTI().isExactly(RegionAttachment::rtti)) {
|
||||||
RegionAttachment* attachment = (RegionAttachment*)slot->getAttachment();
|
RegionAttachment* attachment = (RegionAttachment*)slot->getAttachment();
|
||||||
texture = static_cast<AttachmentVertices*>(attachment->getRendererObject())->_texture;
|
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();
|
MeshAttachment* attachment = (MeshAttachment*)slot->getAttachment();
|
||||||
texture = static_cast<AttachmentVertices*>(attachment->getRendererObject())->_texture;
|
texture = static_cast<AttachmentVertices*>(attachment->getRendererObject())->_texture;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -117,7 +117,7 @@ namespace Spine.Unity {
|
|||||||
/// <summary>Shader property ID used for the Stencil comparison function.</summary>
|
/// <summary>Shader property ID used for the Stencil comparison function.</summary>
|
||||||
public static readonly int STENCIL_COMP_PARAM_ID = Shader.PropertyToID("_StencilComp");
|
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>
|
/// <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>
|
/// <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;
|
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>
|
/// <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
|
#if BUILT_IN_SPRITE_MASK_COMPONENT
|
||||||
private void AssignSpriteMaskMaterials()
|
private void AssignSpriteMaskMaterials()
|
||||||
{
|
{
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
if (!Application.isPlaying) {
|
||||||
|
EditorFixStencilCompParameters();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (maskMaterials.materialsMaskDisabled.Length > 0 && maskMaterials.materialsMaskDisabled[0] != null &&
|
if (maskMaterials.materialsMaskDisabled.Length > 0 && maskMaterials.materialsMaskDisabled[0] != null &&
|
||||||
maskInteraction == SpriteMaskInteraction.None) {
|
maskInteraction == SpriteMaskInteraction.None) {
|
||||||
this.meshRenderer.materials = maskMaterials.materialsMaskDisabled;
|
this.meshRenderer.materials = maskMaterials.materialsMaskDisabled;
|
||||||
@ -523,6 +529,43 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
return true;
|
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
|
#endif //#if BUILT_IN_SPRITE_MASK_COMPONENT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,7 @@ Shader "Spine/Special/SkeletonGhost" {
|
|||||||
[NoScaleOffset] _MainTex ("Base (RGB) Alpha (A)", 2D) = "white" {}
|
[NoScaleOffset] _MainTex ("Base (RGB) Alpha (A)", 2D) = "white" {}
|
||||||
_TextureFade ("Texture Fade Out", Range(0,1)) = 0
|
_TextureFade ("Texture Fade Out", Range(0,1)) = 0
|
||||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 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 {
|
SubShader {
|
||||||
Tags {
|
Tags {
|
||||||
|
|||||||
@ -10,7 +10,7 @@ Shader "Spine/Skeleton Fill" {
|
|||||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 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 {
|
SubShader {
|
||||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
|
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
|
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 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 {
|
SubShader {
|
||||||
|
|||||||
@ -9,7 +9,7 @@ Shader "Spine/Special/Skeleton Grayscale" {
|
|||||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 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 {
|
SubShader {
|
||||||
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
|
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] _RenderQueue ("__queue", Float) = 0.0
|
||||||
[HideInInspector] _Cull ("__cull", Float) = 0.0
|
[HideInInspector] _Cull ("__cull", Float) = 0.0
|
||||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 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
|
SubShader
|
||||||
|
|||||||
@ -27,7 +27,7 @@ Shader "Spine/Sprite/Unlit"
|
|||||||
[HideInInspector] _RenderQueue ("__queue", Float) = 0.0
|
[HideInInspector] _RenderQueue ("__queue", Float) = 0.0
|
||||||
[HideInInspector] _Cull ("__cull", Float) = 0.0
|
[HideInInspector] _Cull ("__cull", Float) = 0.0
|
||||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 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
|
SubShader
|
||||||
|
|||||||
@ -45,7 +45,7 @@ Shader "Spine/Sprite/Vertex Lit"
|
|||||||
[HideInInspector] _RenderQueue ("__queue", Float) = 0.0
|
[HideInInspector] _RenderQueue ("__queue", Float) = 0.0
|
||||||
[HideInInspector] _Cull ("__cull", Float) = 0.0
|
[HideInInspector] _Cull ("__cull", Float) = 0.0
|
||||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 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
|
SubShader
|
||||||
|
|||||||
@ -12,7 +12,7 @@ Shader "Spine/Blend Modes/Skeleton PMA Additive" {
|
|||||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 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 {
|
SubShader {
|
||||||
|
|||||||
@ -12,7 +12,7 @@ Shader "Spine/Blend Modes/Skeleton PMA Multiply" {
|
|||||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 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 {
|
SubShader {
|
||||||
|
|||||||
@ -12,7 +12,7 @@ Shader "Spine/Blend Modes/Skeleton PMA Screen" {
|
|||||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 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 {
|
SubShader {
|
||||||
|
|||||||
@ -14,7 +14,7 @@ Shader "Spine/Skeleton Tint Black" {
|
|||||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||||
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
|
||||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 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 {
|
SubShader {
|
||||||
|
|||||||
@ -4,7 +4,7 @@ Shader "Spine/Skeleton" {
|
|||||||
[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
|
[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
|
||||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 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 {
|
SubShader {
|
||||||
|
|||||||
@ -8,7 +8,7 @@ Shader "Spine/Skeleton Lit" {
|
|||||||
[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
|
[NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
|
||||||
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
|
||||||
[HideInInspector] _StencilRef("Stencil Reference", Float) = 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 {
|
SubShader {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user