Merge branch '4.1' into 4.2-beta

This commit is contained in:
Harald Csaszar 2023-10-18 18:22:09 +02:00
commit 8dcdb4af45
19 changed files with 176 additions and 158 deletions

View File

@ -182,6 +182,7 @@
* URP Shaders: Added `Depth Write` property to shaders `Universal Render Pipeline/Spine/Skeleton` and `Universal Render Pipeline/Spine/Skeleton Lit`. Defaults to false to maintain existing behaviour.
* Added `Animation Update` mode (called `UpdateTiming` in code) `In Late Update` for `SkeletonAnimation`, `SkeletonMecanim` and `SkeletonGraphic`. This allows you to update the `SkeletonMecanim` skeleton in the same frame that the Mecanim Animator updated its state, which happens between `Update` and `LateUpdate`.
* URP Shaders: Added URP "Blend Mode" shader variants for both URP 3D and URP 2D renderers. They are listed under shader name "Universal Render Pipeline/Spine/Blend Modes/" and "Universal Render Pipeline/2D/Spine/Blend Modes/" respectively.
* URP Shaders: Added support for [Tint Black](http://en.esotericsoftware.com/spine-slots#Tint-black) functionality at "Blend Modes" Spine URP shaders (2D and 3D shaders).
* **Breaking changes**
* Made `SkeletonGraphic.unscaledTime` parameter protected, use the new property `UnscaledTime` instead.

View File

@ -1,3 +1,5 @@
> **Note**: this runtime is a work in progress. Please follow this issue to get alerted once the runtime is deemed complete. https://github.com/EsotericSoftware/spine-runtimes/issues/2249
# spine-haxe
The spine-haxe runtime provides functionality to load, manipulate and render [Spine](http://esotericsoftware.com) skeletal animation data using [Haxe](https://haxe.org/) in combination with [OpenFL](https://www.openfl.org/) and [Lime](https://lime.openfl.org/).

View File

@ -1,3 +1,5 @@
> **Note**: this runtime is a work in progress. Please follow this issue to get alerted once the runtime is deemed complete. https://github.com/EsotericSoftware/spine-runtimes/issues/2305
# spine-ts Pixi.js
Please see the top-level [README.md](../README.md) for more information.
Please see the top-level [README.md](../README.md) for more information.

View File

@ -52,16 +52,23 @@ void USpineAtlasAsset::PostInitProperties() {
Super::PostInitProperties();
}
void USpineAtlasAsset::GetAssetRegistryTags(TArray<FAssetRegistryTag> &OutTags) const {
Super::GetAssetRegistryTags(OutTags);
}
void USpineAtlasAsset::Serialize(FArchive &Ar) {
Super::Serialize(Ar);
if (Ar.IsLoading() && Ar.UE4Ver() < VER_UE4_ASSET_IMPORT_DATA_AS_JSON && !importData)
importData = NewObject<UAssetImportData>(this, TEXT("AssetImportData"));
}
void USpineAtlasAsset::PostLoadAssetRegistryTags(const FAssetData& InAssetData,
TArray<FAssetRegistryTag>& OutTagsAndValuesToUpdate) const {
// FIXME: this is a massive hack. It will set the PackageFlags of the FAssetData
// in the AssetRegistry to PKG_FilterEditorOnly so the content browser displays it.
// This is necessary in UE 5.3 due to a regression in ContentBrowserAssetDataCore::IsPrimaryAsset
// See https://github.com/EsotericSoftware/spine-runtimes/issues/2368
FAssetData& MutableAssetData = const_cast<FAssetData&>(InAssetData);
// MutableAssetData.PackageFlags = EPackageFlags::PKG_FilterEditorOnly;
UObject::PostLoadAssetRegistryTags(MutableAssetData, OutTagsAndValuesToUpdate);
}
#endif
FName USpineAtlasAsset::GetAtlasFileName() const {

View File

@ -80,6 +80,18 @@ void USpineSkeletonDataAsset::Serialize(FArchive &Ar) {
LoadInfo();
}
void USpineSkeletonDataAsset::PostLoadAssetRegistryTags(const FAssetData& InAssetData,
// FIXME: this is a massive hack. It will set the PackageFlags of the FAssetData
// in the AssetRegistry to PKG_FilterEditorOnly so the content browser displays it.
// This is necessary in UE 5.3 due to a regression in ContentBrowserAssetDataCore::IsPrimaryAsset
// See https://github.com/EsotericSoftware/spine-runtimes/issues/2368
TArray<FAssetRegistryTag>& OutTagsAndValuesToUpdate) const {
FAssetData& MutableAssetData = const_cast<FAssetData&>(InAssetData);
// MutableAssetData.PackageFlags = EPackageFlags::PKG_FilterEditorOnly;
UObject::PostLoadAssetRegistryTags(MutableAssetData, OutTagsAndValuesToUpdate);
}
#endif
void USpineSkeletonDataAsset::ClearNativeData() {

View File

@ -36,7 +36,7 @@
// clang-format on
UCLASS(BlueprintType, ClassGroup = (Spine))
class SPINEPLUGIN_API USpineAtlasAsset : public UObject {
class SPINEPLUGIN_API USpineAtlasAsset : public UPrimaryDataAsset {
GENERATED_BODY()
public:
@ -70,7 +70,7 @@ protected:
class UAssetImportData *importData;
virtual void PostInitProperties() override;
virtual void GetAssetRegistryTags(TArray<FAssetRegistryTag> &OutTags) const override;
virtual void Serialize(FArchive &Ar) override;
virtual void PostLoadAssetRegistryTags(const FAssetData& InAssetData, TArray<FAssetRegistryTag>& OutTagsAndValuesToUpdate) const override;
#endif
};

View File

@ -116,6 +116,7 @@ protected:
virtual void PostInitProperties() override;
virtual void GetAssetRegistryTags(TArray<FAssetRegistryTag> &OutTags) const override;
virtual void Serialize(FArchive &Ar) override;
virtual void PostLoadAssetRegistryTags(const FAssetData& InAssetData, TArray<FAssetRegistryTag>& OutTagsAndValuesToUpdate) const override;
#endif
void LoadInfo();

View File

@ -4,6 +4,8 @@
[NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {}
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
[MaterialToggle(_TINT_BLACK_ON)] _TintBlack("Tint Black", Float) = 0
_Black(" Dark Color", Color) = (0,0,0,0)
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
}
@ -28,9 +30,24 @@
Tags { "LightMode" = "Universal2D" }
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
// -------------------------------------
// Unity defined keywords
#pragma multi_compile_fog
//--------------------------------------
// GPU Instancing
#pragma multi_compile_instancing
//--------------------------------------
// Spine related keywords
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
#pragma shader_feature _TINT_BLACK_ON
#pragma vertex vert
#pragma fragment frag
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
#undef LIGHTMAP_ON
@ -38,10 +55,10 @@
#define fixed4 half4
#define fixed3 half3
#define fixed half
#include "../../Include/Spine-Input-BlendModes-URP.hlsl"
#include "../../Include/Spine-BlendModes-NormalPass-URP.hlsl"
#define APPLY_MATERIAL_TINT_COLOR
#include "../../Include/Spine-Input-URP.hlsl"
#include "../../Include/Spine-Skeleton-ForwardPass-URP.hlsl"
ENDHLSL
}
}
CustomEditor "SpineShaderWithOutlineGUI"
}

View File

@ -4,6 +4,8 @@
[NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {}
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
[MaterialToggle(_TINT_BLACK_ON)] _TintBlack("Tint Black", Float) = 0
_Black(" Dark Color", Color) = (0,0,0,0)
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
}
@ -28,9 +30,24 @@
Tags { "LightMode" = "Universal2D" }
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
// -------------------------------------
// Unity defined keywords
#pragma multi_compile_fog
//--------------------------------------
// GPU Instancing
#pragma multi_compile_instancing
//--------------------------------------
// Spine related keywords
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
#pragma shader_feature _TINT_BLACK_ON
#pragma vertex vert
#pragma fragment frag
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
#undef LIGHTMAP_ON
@ -38,10 +55,10 @@
#define fixed4 half4
#define fixed3 half3
#define fixed half
#include "../../Include/Spine-Input-BlendModes-URP.hlsl"
#include "../../Include/Spine-BlendModes-NormalPass-URP.hlsl"
#define APPLY_MATERIAL_TINT_COLOR
#include "../../Include/Spine-Input-URP.hlsl"
#include "../../Include/Spine-Skeleton-ForwardPass-URP.hlsl"
ENDHLSL
}
}
CustomEditor "SpineShaderWithOutlineGUI"
}

View File

@ -4,6 +4,8 @@
[NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {}
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
[MaterialToggle(_TINT_BLACK_ON)] _TintBlack("Tint Black", Float) = 0
_Black(" Dark Color", Color) = (0,0,0,0)
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
}
@ -28,9 +30,24 @@
Tags { "LightMode" = "Universal2D" }
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
// -------------------------------------
// Unity defined keywords
#pragma multi_compile_fog
//--------------------------------------
// GPU Instancing
#pragma multi_compile_instancing
//--------------------------------------
// Spine related keywords
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
#pragma shader_feature _TINT_BLACK_ON
#pragma vertex vert
#pragma fragment frag
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
#undef LIGHTMAP_ON
@ -38,10 +55,10 @@
#define fixed4 half4
#define fixed3 half3
#define fixed half
#include "../../Include/Spine-Input-BlendModes-URP.hlsl"
#include "../../Include/Spine-BlendModes-NormalPass-URP.hlsl"
#define APPLY_MATERIAL_TINT_COLOR
#include "../../Include/Spine-Input-URP.hlsl"
#include "../../Include/Spine-Skeleton-ForwardPass-URP.hlsl"
ENDHLSL
}
}
CustomEditor "SpineShaderWithOutlineGUI"
}

View File

@ -4,6 +4,8 @@
[NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {}
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
[MaterialToggle(_TINT_BLACK_ON)] _TintBlack("Tint Black", Float) = 0
_Black(" Dark Color", Color) = (0,0,0,0)
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
}
@ -15,7 +17,6 @@
Fog { Mode Off }
Cull Off
ZWrite Off
Blend One One
Lighting Off
Stencil {
@ -27,10 +28,28 @@
Pass {
Name "Forward"
Tags{"LightMode" = "UniversalForward"}
Blend One One
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
// -------------------------------------
// Unity defined keywords
#pragma multi_compile_fog
//--------------------------------------
// GPU Instancing
#pragma multi_compile_instancing
//--------------------------------------
// Spine related keywords
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
#pragma shader_feature _TINT_BLACK_ON
#pragma vertex vert
#pragma fragment frag
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
#undef LIGHTMAP_ON
@ -38,48 +57,12 @@
#define fixed4 half4
#define fixed3 half3
#define fixed half
#include "../Include/Spine-Input-BlendModes-URP.hlsl"
#include "../Include/Spine-BlendModes-NormalPass-URP.hlsl"
#define APPLY_MATERIAL_TINT_COLOR
#include "../Include/Spine-Input-URP.hlsl"
#include "../Include/Spine-Skeleton-ForwardPass-URP.hlsl"
ENDHLSL
}
}
Pass
{
Name "ShadowCaster"
Tags{"LightMode" = "ShadowCaster"}
ZWrite On
ColorMask 0
ZTest LEqual
Cull Off
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
#pragma target 2.0
// -------------------------------------
// Material Keywords
#pragma shader_feature _ALPHATEST_ON
//--------------------------------------
// GPU Instancing
#pragma multi_compile_instancing
#pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
#pragma vertex ShadowPassVertexSkeletonLit
#pragma fragment ShadowPassFragmentSkeletonLit
#define USE_URP
#define fixed4 half4
#define fixed3 half3
#define fixed half
#include "../Include/Spine-Input-BlendModes-URP.hlsl"
#include "../Include/Spine-SkeletonLit-ShadowCasterPass-URP.hlsl"
ENDHLSL
}
UsePass "Universal Render Pipeline/Spine/Skeleton/SHADOWCASTER"
}
CustomEditor "SpineShaderWithOutlineGUI"
}

View File

@ -4,6 +4,8 @@
[NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {}
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
[MaterialToggle(_TINT_BLACK_ON)] _TintBlack("Tint Black", Float) = 0
_Black(" Dark Color", Color) = (0,0,0,0)
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
}
@ -15,7 +17,6 @@
Fog { Mode Off }
Cull Off
ZWrite Off
Blend DstColor OneMinusSrcAlpha
Lighting Off
Stencil {
@ -27,10 +28,28 @@
Pass {
Name "Forward"
Tags{"LightMode" = "UniversalForward"}
Blend DstColor OneMinusSrcAlpha
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
// -------------------------------------
// Unity defined keywords
#pragma multi_compile_fog
//--------------------------------------
// GPU Instancing
#pragma multi_compile_instancing
//--------------------------------------
// Spine related keywords
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
#pragma shader_feature _TINT_BLACK_ON
#pragma vertex vert
#pragma fragment frag
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
#undef LIGHTMAP_ON
@ -38,12 +57,12 @@
#define fixed4 half4
#define fixed3 half3
#define fixed half
#include "../Include/Spine-Input-BlendModes-URP.hlsl"
#include "../Include/Spine-BlendModes-NormalPass-URP.hlsl"
#define APPLY_MATERIAL_TINT_COLOR
#include "../Include/Spine-Input-URP.hlsl"
#include "../Include/Spine-Skeleton-ForwardPass-URP.hlsl"
ENDHLSL
}
}
UsePass "Universal Render Pipeline/Spine/Blend Modes/Skeleton Additive/SHADOWCASTER"
UsePass "Universal Render Pipeline/Spine/Skeleton/SHADOWCASTER"
}
CustomEditor "SpineShaderWithOutlineGUI"
}

View File

@ -4,6 +4,8 @@
[NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {}
[Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
[MaterialToggle(_TINT_BLACK_ON)] _TintBlack("Tint Black", Float) = 0
_Black(" Dark Color", Color) = (0,0,0,0)
[HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
[HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
}
@ -15,7 +17,6 @@
Fog { Mode Off }
Cull Off
ZWrite Off
Blend One OneMinusSrcColor
Lighting Off
Stencil {
@ -27,10 +28,28 @@
Pass {
Name "Forward"
Tags{"LightMode" = "UniversalForward"}
Blend One OneMinusSrcColor
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
// -------------------------------------
// Unity defined keywords
#pragma multi_compile_fog
//--------------------------------------
// GPU Instancing
#pragma multi_compile_instancing
//--------------------------------------
// Spine related keywords
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
#pragma shader_feature _TINT_BLACK_ON
#pragma vertex vert
#pragma fragment frag
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
#undef LIGHTMAP_ON
@ -38,12 +57,12 @@
#define fixed4 half4
#define fixed3 half3
#define fixed half
#include "../Include/Spine-Input-BlendModes-URP.hlsl"
#include "../Include/Spine-BlendModes-NormalPass-URP.hlsl"
#define APPLY_MATERIAL_TINT_COLOR
#include "../Include/Spine-Input-URP.hlsl"
#include "../Include/Spine-Skeleton-ForwardPass-URP.hlsl"
ENDHLSL
}
}
UsePass "Universal Render Pipeline/Spine/Blend Modes/Skeleton Additive/SHADOWCASTER"
UsePass "Universal Render Pipeline/Spine/Skeleton/SHADOWCASTER"
}
CustomEditor "SpineShaderWithOutlineGUI"
}

View File

@ -1,40 +0,0 @@
#ifndef BLENDMODES_NORMAL_PASS_URP_INCLUDED
#define BLENDMODES_NORMAL_PASS_URP_INCLUDED
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
#include "SpineCoreShaders/Spine-Common.cginc"
#include "SpineCoreShaders/Spine-Skeleton-Tint-Common.cginc"
struct VertexInput {
float3 pos : POSITION;
float2 uv : TEXCOORD0;
float4 vertexColor : COLOR;
};
struct VertexOutput {
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
float4 vertexColor : COLOR;
};
VertexOutput vert(VertexInput v) {
VertexOutput o;
float3 positionWS = TransformObjectToWorld(v.pos);
o.pos = TransformWorldToHClip(positionWS);
o.uv = v.uv;
o.vertexColor = PMAGammaToTargetSpace(v.vertexColor) * float4(_Color.rgb * _Color.a, _Color.a); // Combine a PMA version of _Color with vertexColor.
return o;
}
float4 frag(VertexOutput i) : SV_Target{
float4 texColor = tex2D(_MainTex, i.uv);
#if defined(_STRAIGHT_ALPHA_INPUT)
texColor.rgb *= texColor.a;
#endif
return (texColor * i.vertexColor);
}
#endif

View File

@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 444419be824cb1d4482a06b558b0892a
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,21 +0,0 @@
#ifndef URP_INPUT_BLEND_MODES_INCLUDED
#define URP_INPUT_BLEND_MODES_INCLUDED
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
////////////////////////////////////////
// Defines
//
#undef LIGHTMAP_ON
CBUFFER_START(UnityPerMaterial)
float4 _MainTex_ST;
half _Cutoff;
half4 _Color;
CBUFFER_END
sampler2D _MainTex;
#endif

View File

@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 7fbcfe81149b96e458243062a65e31b4
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -41,6 +41,8 @@ VertexOutput vert(appdata v) {
o.color *= _Color;
o.darkColor = GammaToTargetSpace(
half3(v.tintBlackRG.r, v.tintBlackRG.g, v.tintBlackB.r)) + _Black.rgb;
#elif defined (APPLY_MATERIAL_TINT_COLOR)
o.color *= _Color;
#endif
return o;
}

View File

@ -2,7 +2,7 @@
"name": "com.esotericsoftware.spine.urp-shaders",
"displayName": "Spine Universal RP Shaders",
"description": "This plugin provides universal render pipeline (URP) shaders for the spine-unity runtime.\n\nPrerequisites:\nIt requires a working installation of the spine-unity runtime, version 4.2.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)",
"version": "4.2.25",
"version": "4.2.26",
"unity": "2019.3",
"author": {
"name": "Esoteric Software",