Merge branch '4.1' into 4.2-beta

# Conflicts:
#	spine-godot/spine_godot/SpineEditorPlugin.cpp
This commit is contained in:
Mario Zechner 2022-09-03 12:28:12 +02:00
commit efda7ec38e
90 changed files with 25772 additions and 78 deletions

View File

@ -86,6 +86,8 @@
* Added `UnscaledTime` property at `SkeletonAnimation` as well, behaving like `SkeletonGraphic.UnscaledTime`. If enabled, AnimationState uses unscaled game time (`Time.unscaledDeltaTime`), running animations independent of e.g. game pause (`Time.timeScale`). * Added `UnscaledTime` property at `SkeletonAnimation` as well, behaving like `SkeletonGraphic.UnscaledTime`. If enabled, AnimationState uses unscaled game time (`Time.unscaledDeltaTime`), running animations independent of e.g. game pause (`Time.timeScale`).
* `SkeletonAnimation`, `SkeletonMecanim` and `SkeletonGraphic` now provide an additional `OnAnimationRebuild` callback delegate which is issued after both the skeleton and the animation state have been initialized. * `SkeletonAnimation`, `SkeletonMecanim` and `SkeletonGraphic` now provide an additional `OnAnimationRebuild` callback delegate which is issued after both the skeleton and the animation state have been initialized.
* Timeline `SkeletonAnimation Track` and `SkeletonGraphic Track` now provide an `Unscaled Time` property. Whenever starting a new animation clip of this track, `SkeletonAnimation.UnscaledTime` or `SkeletonGraphic.UnscaledTime` will be set to this value. This allows you to play back Timeline clips either in normal game time or unscaled game time. Note that `PlayableDirector.UpdateMethod` is ignored and replaced by this property, which allows more fine-granular control per Timeline track. * Timeline `SkeletonAnimation Track` and `SkeletonGraphic Track` now provide an `Unscaled Time` property. Whenever starting a new animation clip of this track, `SkeletonAnimation.UnscaledTime` or `SkeletonGraphic.UnscaledTime` will be set to this value. This allows you to play back Timeline clips either in normal game time or unscaled game time. Note that `PlayableDirector.UpdateMethod` is ignored and replaced by this property, which allows more fine-granular control per Timeline track.
* Added `SkeletonRootMotion` callback delegates `ProcessRootMotionOverride` and `PhysicsUpdateRootMotionOverride` to customize how root motion is applied. The new property `disableOnOverride` determines whether the callback will be issued in addition or instead of normally applying root motion. Added property `rootMotionScaleRotation` to allow scaling rotational root-motion to match e.g. a 90 degree rotation to a custom target angle.
* Added outline shader parameter `Advanced - Opaque Alpha` which can be used to exclude problematic semi-transparent areas, which may receive an undesired large outline color overlay otherwise.
* **Breaking changes** * **Breaking changes**
* Made `SkeletonGraphic.unscaledTime` parameter protected, use the new property `UnscaledTime` instead. * Made `SkeletonGraphic.unscaledTime` parameter protected, use the new property `UnscaledTime` instead.

View File

@ -78,7 +78,7 @@ Error SpineJsonResourceImportPlugin::import(const String &source_file, const Str
#if VERSION_MAJOR > 3 #if VERSION_MAJOR > 3
error = ResourceSaver::save(skeleton_file_res, file_name); error = ResourceSaver::save(skeleton_file_res, file_name);
#else #else
auto error = ResourceSaver::save(file_name, skeleton_file_res); error = ResourceSaver::save(file_name, skeleton_file_res);
#endif #endif
return error; return error;
} }
@ -96,7 +96,7 @@ Error SpineBinaryResourceImportPlugin::import(const String &source_file, const S
#if VERSION_MAJOR > 3 #if VERSION_MAJOR > 3
error = ResourceSaver::save(skeleton_file_res, file_name); error = ResourceSaver::save(skeleton_file_res, file_name);
#else #else
auto error = ResourceSaver::save(file_name, skeleton_file_res); error = ResourceSaver::save(file_name, skeleton_file_res);
#endif #endif
return error; return error;
} }

View File

@ -40,6 +40,7 @@ namespace Spine.Unity.Editor {
protected SerializedProperty transformRotation; protected SerializedProperty transformRotation;
protected SerializedProperty rootMotionScaleX; protected SerializedProperty rootMotionScaleX;
protected SerializedProperty rootMotionScaleY; protected SerializedProperty rootMotionScaleY;
protected SerializedProperty rootMotionScaleRotation;
protected SerializedProperty rootMotionTranslateXPerY; protected SerializedProperty rootMotionTranslateXPerY;
protected SerializedProperty rootMotionTranslateYPerX; protected SerializedProperty rootMotionTranslateYPerX;
protected SerializedProperty rigidBody2D; protected SerializedProperty rigidBody2D;
@ -52,6 +53,7 @@ namespace Spine.Unity.Editor {
protected GUIContent transformRotationLabel; protected GUIContent transformRotationLabel;
protected GUIContent rootMotionScaleXLabel; protected GUIContent rootMotionScaleXLabel;
protected GUIContent rootMotionScaleYLabel; protected GUIContent rootMotionScaleYLabel;
protected GUIContent rootMotionScaleRotationLabel;
protected GUIContent rootMotionTranslateXPerYLabel; protected GUIContent rootMotionTranslateXPerYLabel;
protected GUIContent rootMotionTranslateYPerXLabel; protected GUIContent rootMotionTranslateYPerXLabel;
protected GUIContent rigidBody2DLabel; protected GUIContent rigidBody2DLabel;
@ -66,6 +68,7 @@ namespace Spine.Unity.Editor {
transformRotation = serializedObject.FindProperty("transformRotation"); transformRotation = serializedObject.FindProperty("transformRotation");
rootMotionScaleX = serializedObject.FindProperty("rootMotionScaleX"); rootMotionScaleX = serializedObject.FindProperty("rootMotionScaleX");
rootMotionScaleY = serializedObject.FindProperty("rootMotionScaleY"); rootMotionScaleY = serializedObject.FindProperty("rootMotionScaleY");
rootMotionScaleRotation = serializedObject.FindProperty("rootMotionScaleRotation");
rootMotionTranslateXPerY = serializedObject.FindProperty("rootMotionTranslateXPerY"); rootMotionTranslateXPerY = serializedObject.FindProperty("rootMotionTranslateXPerY");
rootMotionTranslateYPerX = serializedObject.FindProperty("rootMotionTranslateYPerX"); rootMotionTranslateYPerX = serializedObject.FindProperty("rootMotionTranslateYPerX");
rigidBody2D = serializedObject.FindProperty("rigidBody2D"); rigidBody2D = serializedObject.FindProperty("rigidBody2D");
@ -78,6 +81,7 @@ namespace Spine.Unity.Editor {
transformRotationLabel = new UnityEngine.GUIContent("Rotation", "Use the rotation of the bone."); transformRotationLabel = new UnityEngine.GUIContent("Rotation", "Use the rotation of the bone.");
rootMotionScaleXLabel = new UnityEngine.GUIContent("Root Motion Scale (X)", "Scale applied to the horizontal root motion delta. Can be used for delta compensation to e.g. stretch a jump to the desired distance."); rootMotionScaleXLabel = new UnityEngine.GUIContent("Root Motion Scale (X)", "Scale applied to the horizontal root motion delta. Can be used for delta compensation to e.g. stretch a jump to the desired distance.");
rootMotionScaleYLabel = new UnityEngine.GUIContent("Root Motion Scale (Y)", "Scale applied to the vertical root motion delta. Can be used for delta compensation to e.g. stretch a jump to the desired distance."); rootMotionScaleYLabel = new UnityEngine.GUIContent("Root Motion Scale (Y)", "Scale applied to the vertical root motion delta. Can be used for delta compensation to e.g. stretch a jump to the desired distance.");
rootMotionScaleRotationLabel = new UnityEngine.GUIContent("Root Motion Scale (Rotation)", "Scale applied to the rotational root motion delta. Can be used for delta compensation to e.g. adjust an angled jump landing to the desired platform angle.");
rootMotionTranslateXPerYLabel = new UnityEngine.GUIContent("Root Motion Translate (X)", "Added X translation per root motion Y delta. Can be used for delta compensation when scaling is not enough, to e.g. offset a horizontal jump to a vertically different goal."); rootMotionTranslateXPerYLabel = new UnityEngine.GUIContent("Root Motion Translate (X)", "Added X translation per root motion Y delta. Can be used for delta compensation when scaling is not enough, to e.g. offset a horizontal jump to a vertically different goal.");
rootMotionTranslateYPerXLabel = new UnityEngine.GUIContent("Root Motion Translate (Y)", "Added Y translation per root motion X delta. Can be used for delta compensation when scaling is not enough, to e.g. offset a horizontal jump to a vertically different goal."); rootMotionTranslateYPerXLabel = new UnityEngine.GUIContent("Root Motion Translate (Y)", "Added Y translation per root motion X delta. Can be used for delta compensation when scaling is not enough, to e.g. offset a horizontal jump to a vertically different goal.");
rigidBody2DLabel = new UnityEngine.GUIContent("Rigidbody2D", rigidBody2DLabel = new UnityEngine.GUIContent("Rigidbody2D",
@ -110,6 +114,7 @@ namespace Spine.Unity.Editor {
EditorGUILayout.PropertyField(rootMotionScaleX, rootMotionScaleXLabel); EditorGUILayout.PropertyField(rootMotionScaleX, rootMotionScaleXLabel);
EditorGUILayout.PropertyField(rootMotionScaleY, rootMotionScaleYLabel); EditorGUILayout.PropertyField(rootMotionScaleY, rootMotionScaleYLabel);
EditorGUILayout.PropertyField(rootMotionScaleRotation, rootMotionScaleRotationLabel);
EditorGUILayout.PropertyField(rootMotionTranslateXPerY, rootMotionTranslateXPerYLabel); EditorGUILayout.PropertyField(rootMotionTranslateXPerY, rootMotionTranslateXPerYLabel);
EditorGUILayout.PropertyField(rootMotionTranslateYPerX, rootMotionTranslateYPerXLabel); EditorGUILayout.PropertyField(rootMotionTranslateYPerX, rootMotionTranslateYPerXLabel);

View File

@ -31,6 +31,10 @@
#define NEW_PREFAB_SYSTEM #define NEW_PREFAB_SYSTEM
#endif #endif
#if UNITY_2021_2_OR_NEWER
#define PUBLIC_SET_ICON_FOR_OBJECT
#endif
using System.Reflection; using System.Reflection;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
@ -145,11 +149,14 @@ namespace Spine.Unity.Editor {
icon = Icons.constraintNib; icon = Icons.constraintNib;
break; break;
} }
#if PUBLIC_SET_ICON_FOR_OBJECT
EditorGUIUtility.SetIconForObject(boneComponent.gameObject, icon);
#else
typeof(EditorGUIUtility).InvokeMember("SetIconForObject", BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.NonPublic, null, null, new object[2] { typeof(EditorGUIUtility).InvokeMember("SetIconForObject", BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.NonPublic, null, null, new object[2] {
boneComponent.gameObject, boneComponent.gameObject,
icon icon
}); });
#endif
} }
static void AttachIconsToChildren (Transform root) { static void AttachIconsToChildren (Transform root) {

View File

@ -44,6 +44,7 @@ public class SpineShaderWithOutlineGUI : ShaderGUI {
MaterialProperty _ThresholdEnd = null; MaterialProperty _ThresholdEnd = null;
MaterialProperty _OutlineSmoothness = null; MaterialProperty _OutlineSmoothness = null;
MaterialProperty _Use8Neighbourhood = null; MaterialProperty _Use8Neighbourhood = null;
MaterialProperty _OutlineOpaqueAlpha = null;
MaterialProperty _OutlineMipLevel = null; MaterialProperty _OutlineMipLevel = null;
MaterialProperty _StencilComp = null; MaterialProperty _StencilComp = null;
MaterialProperty _StencilRef = null; MaterialProperty _StencilRef = null;
@ -55,6 +56,7 @@ public class SpineShaderWithOutlineGUI : ShaderGUI {
static GUIContent _ThresholdEndText = new GUIContent("Outline Threshold", ""); static GUIContent _ThresholdEndText = new GUIContent("Outline Threshold", "");
static GUIContent _OutlineSmoothnessText = new GUIContent("Outline Smoothness", ""); static GUIContent _OutlineSmoothnessText = new GUIContent("Outline Smoothness", "");
static GUIContent _Use8NeighbourhoodText = new GUIContent("Sample 8 Neighbours", ""); static GUIContent _Use8NeighbourhoodText = new GUIContent("Sample 8 Neighbours", "");
static GUIContent _OutlineOpaqueAlphaText = new GUIContent("Opaque Alpha", "If a pixel's alpha value is above this threshold it will not receive any outline color overlay. Use to exclude problematic semi-transparent areas.");
static GUIContent _OutlineMipLevelText = new GUIContent("Outline Mip Level", ""); static GUIContent _OutlineMipLevelText = new GUIContent("Outline Mip Level", "");
static GUIContent _StencilCompText = new GUIContent("Stencil Comparison", ""); static GUIContent _StencilCompText = new GUIContent("Stencil Comparison", "");
static GUIContent _StencilRefText = new GUIContent("Stencil Reference", ""); static GUIContent _StencilRefText = new GUIContent("Stencil Reference", "");
@ -91,6 +93,7 @@ public class SpineShaderWithOutlineGUI : ShaderGUI {
_ThresholdEnd = FindProperty("_ThresholdEnd", props, false); _ThresholdEnd = FindProperty("_ThresholdEnd", props, false);
_OutlineSmoothness = FindProperty("_OutlineSmoothness", props, false); _OutlineSmoothness = FindProperty("_OutlineSmoothness", props, false);
_Use8Neighbourhood = FindProperty("_Use8Neighbourhood", props, false); _Use8Neighbourhood = FindProperty("_Use8Neighbourhood", props, false);
_OutlineOpaqueAlpha = FindProperty("_OutlineOpaqueAlpha", props, false);
_OutlineMipLevel = FindProperty("_OutlineMipLevel", props, false); _OutlineMipLevel = FindProperty("_OutlineMipLevel", props, false);
_StencilComp = FindProperty("_StencilComp", props, false); _StencilComp = FindProperty("_StencilComp", props, false);
@ -158,6 +161,7 @@ public class SpineShaderWithOutlineGUI : ShaderGUI {
_materialEditor.ShaderProperty(_ThresholdEnd, _ThresholdEndText); _materialEditor.ShaderProperty(_ThresholdEnd, _ThresholdEndText);
_materialEditor.ShaderProperty(_OutlineSmoothness, _OutlineSmoothnessText); _materialEditor.ShaderProperty(_OutlineSmoothness, _OutlineSmoothnessText);
_materialEditor.ShaderProperty(_Use8Neighbourhood, _Use8NeighbourhoodText); _materialEditor.ShaderProperty(_Use8Neighbourhood, _Use8NeighbourhoodText);
_materialEditor.ShaderProperty(_OutlineOpaqueAlpha, _OutlineOpaqueAlphaText);
_materialEditor.ShaderProperty(_OutlineMipLevel, _OutlineMipLevelText); _materialEditor.ShaderProperty(_OutlineMipLevel, _OutlineMipLevelText);
} }
} }

View File

@ -338,6 +338,11 @@ namespace Spine.Unity.Editor {
Debug.LogWarningFormat("`{0}` : If this file is a Spine atlas, please change its extension to `.atlas.txt`. This is to allow Unity to recognize it and avoid filename collisions. You can also set this file extension when exporting from the Spine editor.", str); Debug.LogWarningFormat("`{0}` : If this file is a Spine atlas, please change its extension to `.atlas.txt`. This is to allow Unity to recognize it and avoid filename collisions. You can also set this file extension when exporting from the Spine editor.", str);
} }
break; break;
case ".skel":
if (SpineEditorUtilities.Preferences.atlasTxtImportWarning) {
Debug.LogWarningFormat("`{0}` : If this file is a Spine skeleton, please change its extension to `.skel.bytes`. This is to allow Unity to recognize it and avoid filename collisions. You can also set this file extension when exporting from the Spine editor.", str);
}
break;
case ".txt": case ".txt":
if (str.EndsWith(".atlas.txt", System.StringComparison.Ordinal)) if (str.EndsWith(".atlas.txt", System.StringComparison.Ordinal))
atlasPaths.Add(str); atlasPaths.Add(str);

View File

@ -288,7 +288,7 @@ namespace Spine.Unity.Editor {
EditorGUILayout.Space(); EditorGUILayout.Space();
EditorGUILayout.LabelField("Warnings", EditorStyles.boldLabel); EditorGUILayout.LabelField("Warnings", EditorStyles.boldLabel);
{ {
EditorGUILayout.PropertyField(settings.FindProperty("atlasTxtImportWarning"), new GUIContent("Atlas Extension Warning", "Log a warning and recommendation whenever a `.atlas` file is found.")); EditorGUILayout.PropertyField(settings.FindProperty("atlasTxtImportWarning"), new GUIContent("Atlas & Skel Extension Warning", "Log a warning and recommendation whenever a `.atlas` or `.skel` file is found."));
EditorGUILayout.PropertyField(settings.FindProperty("textureImporterWarning"), new GUIContent("Texture Settings Warning", "Log a warning and recommendation whenever Texture Import Settings are detected that could lead to undesired effects, e.g. white border artifacts.")); EditorGUILayout.PropertyField(settings.FindProperty("textureImporterWarning"), new GUIContent("Texture Settings Warning", "Log a warning and recommendation whenever Texture Import Settings are detected that could lead to undesired effects, e.g. white border artifacts."));
EditorGUILayout.PropertyField(settings.FindProperty("componentMaterialWarning"), new GUIContent("Component & Material Warning", "Log a warning and recommendation whenever Component and Material settings are not compatible.")); EditorGUILayout.PropertyField(settings.FindProperty("componentMaterialWarning"), new GUIContent("Component & Material Warning", "Log a warning and recommendation whenever Component and Material settings are not compatible."));
} }

View File

@ -50,6 +50,7 @@ namespace Spine.Unity {
public float rootMotionScaleX = 1; public float rootMotionScaleX = 1;
public float rootMotionScaleY = 1; public float rootMotionScaleY = 1;
public float rootMotionScaleRotation = 1;
/// <summary>Skeleton space X translation per skeleton space Y translation root motion.</summary> /// <summary>Skeleton space X translation per skeleton space Y translation root motion.</summary>
public float rootMotionTranslateXPerY = 0; public float rootMotionTranslateXPerY = 0;
/// <summary>Skeleton space Y translation per skeleton space X translation root motion.</summary> /// <summary>Skeleton space Y translation per skeleton space X translation root motion.</summary>
@ -60,6 +61,36 @@ namespace Spine.Unity {
public bool applyRigidbody2DGravity = false; public bool applyRigidbody2DGravity = false;
public Rigidbody rigidBody; public Rigidbody rigidBody;
/// <summary>Delegate type for customizing application of rootmotion.
public delegate void RootMotionDelegate (SkeletonRootMotionBase component, Vector2 translation, float rotation);
/// <summary>This callback can be used to apply root-motion in a custom way. It is raised after evaluating
/// this animation frame's root-motion, before it is potentially applied (see <see cref="disableOnOverride"/>)
/// to either Transform or Rigidbody.
/// When <see cref="SkeletonAnimation.UpdateTiming"/> is set to <see cref="UpdateTiming.InUpdate"/>, multiple
/// animation frames might take place before <c>FixedUpdate</c> is called once.
/// The callback parameters <c>translation</c> and <c>rotation</c> are filled out with
/// this animation frame's skeleton-space root-motion (not cumulated). You can use
/// e.g. <c>transform.TransformVector()</c> to transform skeleton-space root-motion to world space.
/// </summary>
/// <seealso cref="PhysicsUpdateRootMotionOverride"/>
public event RootMotionDelegate ProcessRootMotionOverride;
/// <summary>This callback can be used to apply root-motion in a custom way. It is raised in FixedUpdate
/// after (when <see cref="disableOnOverride"/> is set to false) or instead of when root-motion
/// would be applied at the Rigidbody.
/// When <see cref="SkeletonAnimation.UpdateTiming"/> is set to <see cref="UpdateTiming.InUpdate"/>, multiple
/// animation frames might take place before before <c>FixedUpdate</c> is called once.
/// The callback parameters <c>translation</c> and <c>rotation</c> are filled out with the
/// (cumulated) skeleton-space root-motion since the the last <c>FixedUpdate</c> call. You can use
/// e.g. <c>transform.TransformVector()</c> to transform skeleton-space root-motion to world space.
/// </summary>
/// <seealso cref="ProcessRootMotionOverride"/>
public event RootMotionDelegate PhysicsUpdateRootMotionOverride;
/// <summary>When true, root-motion is not applied to the Transform or Rigidbody.
/// Otherwise the delegate callbacks are issued additionally.</summary>
public bool disableOnOverride = true;
public Bone RootMotionBone { get { return rootMotionBone; } }
public bool UsesRigidbody { public bool UsesRigidbody {
get { return rigidBody != null || rigidBody2D != null; } get { return rigidBody != null || rigidBody2D != null; }
} }
@ -108,12 +139,13 @@ namespace Spine.Unity {
protected List<float> transformConstraintLastRotation = new List<float>(); protected List<float> transformConstraintLastRotation = new List<float>();
protected List<Bone> topLevelBones = new List<Bone>(); protected List<Bone> topLevelBones = new List<Bone>();
protected Vector2 initialOffset = Vector2.zero; protected Vector2 initialOffset = Vector2.zero;
protected bool accumulatedUntilFixedUpdate = false;
protected Vector2 tempSkeletonDisplacement; protected Vector2 tempSkeletonDisplacement;
protected Vector3 rigidbodyDisplacement; protected Vector3 rigidbodyDisplacement;
protected Vector3 previousRigidbodyRootMotion = Vector2.zero; protected Vector3 previousRigidbodyRootMotion = Vector2.zero;
protected Vector2 additionalRigidbody2DMovement = Vector2.zero; protected Vector2 additionalRigidbody2DMovement = Vector2.zero;
protected Quaternion rigidbodyRotation = Quaternion.identity; protected Quaternion rigidbodyLocalRotation = Quaternion.identity;
protected float rigidbody2DRotation; protected float rigidbody2DRotation;
protected float initialOffsetRotation; protected float initialOffsetRotation;
protected float tempSkeletonRotation; protected float tempSkeletonRotation;
@ -149,35 +181,44 @@ namespace Spine.Unity {
} }
protected virtual void PhysicsUpdate (bool skeletonAnimationUsesFixedUpdate) { protected virtual void PhysicsUpdate (bool skeletonAnimationUsesFixedUpdate) {
if (rigidBody2D != null) { Vector2 callbackDisplacement = tempSkeletonDisplacement;
Vector2 gravityAndVelocityMovement = Vector2.zero; float callbackRotation = tempSkeletonRotation;
if (applyRigidbody2DGravity) {
float deltaTime = Time.fixedDeltaTime;
float deltaTimeSquared = (deltaTime * deltaTime);
rigidBody2D.velocity += rigidBody2D.gravityScale * Physics2D.gravity * deltaTime; bool isApplyAtRigidbodyAllowed = PhysicsUpdateRootMotionOverride == null || !disableOnOverride;
gravityAndVelocityMovement = 0.5f * rigidBody2D.gravityScale * Physics2D.gravity * deltaTimeSquared + if (isApplyAtRigidbodyAllowed) {
rigidBody2D.velocity * deltaTime; if (rigidBody2D != null) {
Vector2 gravityAndVelocityMovement = Vector2.zero;
if (applyRigidbody2DGravity) {
float deltaTime = Time.fixedDeltaTime;
float deltaTimeSquared = (deltaTime * deltaTime);
rigidBody2D.velocity += rigidBody2D.gravityScale * Physics2D.gravity * deltaTime;
gravityAndVelocityMovement = 0.5f * rigidBody2D.gravityScale * Physics2D.gravity * deltaTimeSquared +
rigidBody2D.velocity * deltaTime;
}
Vector2 rigidbodyDisplacement2D = new Vector2(rigidbodyDisplacement.x, rigidbodyDisplacement.y);
rigidBody2D.MovePosition(gravityAndVelocityMovement + new Vector2(transform.position.x, transform.position.y)
+ rigidbodyDisplacement2D + additionalRigidbody2DMovement);
rigidBody2D.MoveRotation(rigidbody2DRotation + rigidBody2D.rotation);
} else if (rigidBody != null) {
rigidBody.MovePosition(transform.position
+ new Vector3(rigidbodyDisplacement.x, rigidbodyDisplacement.y, rigidbodyDisplacement.z));
rigidBody.MoveRotation(rigidBody.rotation * rigidbodyLocalRotation);
} }
}
Vector2 rigidbodyDisplacement2D = new Vector2(rigidbodyDisplacement.x, rigidbodyDisplacement.y); previousRigidbodyRootMotion = rigidbodyDisplacement;
rigidBody2D.MovePosition(gravityAndVelocityMovement + new Vector2(transform.position.x, transform.position.y) if (accumulatedUntilFixedUpdate) {
+ rigidbodyDisplacement2D + additionalRigidbody2DMovement); Vector2 parentBoneScale;
rigidBody2D.MoveRotation(rigidbody2DRotation + rigidBody2D.rotation); GetScaleAffectingRootMotion(out parentBoneScale);
} else if (rigidBody != null) {
rigidBody.MovePosition(transform.position
+ new Vector3(rigidbodyDisplacement.x, rigidbodyDisplacement.y, 0));
rigidBody.MoveRotation(rigidBody.rotation * rigidbodyRotation);
} else return;
Vector2 parentBoneScale;
GetScaleAffectingRootMotion(out parentBoneScale);
if (!skeletonAnimationUsesFixedUpdate) {
ClearEffectiveBoneOffsets(parentBoneScale); ClearEffectiveBoneOffsets(parentBoneScale);
skeletonComponent.Skeleton.UpdateWorldTransform(); skeletonComponent.Skeleton.UpdateWorldTransform();
} }
previousRigidbodyRootMotion = rigidbodyDisplacement;
ClearRigidbodyTempMovement(); ClearRigidbodyTempMovement();
if (PhysicsUpdateRootMotionOverride != null)
PhysicsUpdateRootMotionOverride(this, callbackDisplacement, callbackRotation);
} }
protected virtual void OnDisable () { protected virtual void OnDisable () {
@ -499,6 +540,7 @@ namespace Spine.Unity {
float skeletonRotationDelta = 0; float skeletonRotationDelta = 0;
if (transformRotation) { if (transformRotation) {
float boneLocalDeltaRotation = CalculateAnimationsRotationDelta(); float boneLocalDeltaRotation = CalculateAnimationsRotationDelta();
boneLocalDeltaRotation *= rootMotionScaleRotation;
skeletonRotationDelta = GetSkeletonSpaceRotationDelta(boneLocalDeltaRotation, totalScale); skeletonRotationDelta = GetSkeletonSpaceRotationDelta(boneLocalDeltaRotation, totalScale);
} }
@ -511,40 +553,45 @@ namespace Spine.Unity {
void ApplyRootMotion (Vector2 skeletonTranslationDelta, float skeletonRotationDelta, Vector2 parentBoneScale, void ApplyRootMotion (Vector2 skeletonTranslationDelta, float skeletonRotationDelta, Vector2 parentBoneScale,
bool skeletonAnimationUsesFixedUpdate) { bool skeletonAnimationUsesFixedUpdate) {
// Apply root motion to Transform or RigidBody;
if (UsesRigidbody) { // Accumulated displacement is applied on the next Physics update in FixedUpdate.
// Until the next Physics update, tempSkeletonDisplacement and tempSkeletonRotation
// are offsetting bone locations to prevent stutter which would otherwise occur if
// we don't move every Update.
bool usesRigidbody = this.UsesRigidbody;
bool applyToTransform = !usesRigidbody && (ProcessRootMotionOverride == null || !disableOnOverride);
accumulatedUntilFixedUpdate = !applyToTransform && !skeletonAnimationUsesFixedUpdate;
if (ProcessRootMotionOverride != null)
ProcessRootMotionOverride(this, skeletonTranslationDelta, skeletonRotationDelta);
// Apply root motion to Transform or update values applied to RigidBody later (must happen in FixedUpdate).
if (usesRigidbody) {
rigidbodyDisplacement += transform.TransformVector(skeletonTranslationDelta); rigidbodyDisplacement += transform.TransformVector(skeletonTranslationDelta);
// Accumulated displacement is applied on the next Physics update in FixedUpdate.
// Until the next Physics update, tempBoneDisplacement is offsetting bone locations
// to prevent stutter which would otherwise occur if we don't move every Update.
if (!skeletonAnimationUsesFixedUpdate)
tempSkeletonDisplacement += skeletonTranslationDelta;
if (skeletonRotationDelta != 0.0f) { if (skeletonRotationDelta != 0.0f) {
if (rigidBody != null) { if (rigidBody != null) {
Quaternion addedWorldRotation = Quaternion.AngleAxis(skeletonRotationDelta, transform.forward); Quaternion addedWorldRotation = Quaternion.Euler(0, 0, skeletonRotationDelta);
rigidbodyRotation = rigidbodyRotation * addedWorldRotation; rigidbodyLocalRotation = rigidbodyLocalRotation * addedWorldRotation;
} else if (rigidBody2D != null) { } else if (rigidBody2D != null) {
Vector3 lossyScale = transform.lossyScale; Vector3 lossyScale = transform.lossyScale;
float rotationSign = lossyScale.x * lossyScale.y > 0 ? 1 : -1; float rotationSign = lossyScale.x * lossyScale.y > 0 ? 1 : -1;
rigidbody2DRotation += rotationSign * skeletonRotationDelta; rigidbody2DRotation += rotationSign * skeletonRotationDelta;
} }
if (!skeletonAnimationUsesFixedUpdate)
tempSkeletonRotation += skeletonRotationDelta;
} }
} else if (applyToTransform) {
if (skeletonAnimationUsesFixedUpdate)
ClearEffectiveBoneOffsets(parentBoneScale);
else
SetEffectiveBoneOffsetsTo(tempSkeletonDisplacement, tempSkeletonRotation, parentBoneScale);
} else {
transform.position += transform.TransformVector(skeletonTranslationDelta); transform.position += transform.TransformVector(skeletonTranslationDelta);
if (skeletonRotationDelta != 0.0f) { if (skeletonRotationDelta != 0.0f) {
Vector3 lossyScale = transform.lossyScale; Vector3 lossyScale = transform.lossyScale;
float rotationSign = lossyScale.x * lossyScale.y > 0 ? 1 : -1; float rotationSign = lossyScale.x * lossyScale.y > 0 ? 1 : -1;
transform.Rotate(0, 0, rotationSign * skeletonRotationDelta); transform.Rotate(0, 0, rotationSign * skeletonRotationDelta);
} }
}
tempSkeletonDisplacement += skeletonTranslationDelta;
tempSkeletonRotation += skeletonRotationDelta;
if (accumulatedUntilFixedUpdate) {
SetEffectiveBoneOffsetsTo(tempSkeletonDisplacement, tempSkeletonRotation, parentBoneScale);
} else {
ClearEffectiveBoneOffsets(parentBoneScale); ClearEffectiveBoneOffsets(parentBoneScale);
} }
} }
@ -654,7 +701,7 @@ namespace Spine.Unity {
void ClearRigidbodyTempMovement () { void ClearRigidbodyTempMovement () {
rigidbodyDisplacement = Vector2.zero; rigidbodyDisplacement = Vector2.zero;
tempSkeletonDisplacement = Vector2.zero; tempSkeletonDisplacement = Vector2.zero;
rigidbodyRotation = Quaternion.identity; rigidbodyLocalRotation = Quaternion.identity;
rigidbody2DRotation = 0; rigidbody2DRotation = 0;
tempSkeletonRotation = 0; tempSkeletonRotation = 0;
} }

View File

@ -114,6 +114,11 @@ namespace Spine.Unity {
} else { } else {
if (freeze) return; if (freeze) return;
if (!Application.isPlaying) {
Initialize(true);
return;
}
if (!string.IsNullOrEmpty(initialSkinName)) { if (!string.IsNullOrEmpty(initialSkinName)) {
var skin = skeleton.Data.FindSkin(initialSkinName); var skin = skeleton.Data.FindSkin(initialSkinName);
if (skin != null) { if (skin != null) {
@ -124,19 +129,6 @@ namespace Spine.Unity {
} }
} }
// Only provide visual feedback to inspector changes in Unity Editor Edit mode.
if (!Application.isPlaying) {
skeleton.ScaleX = this.initialFlipX ? -1 : 1;
skeleton.ScaleY = this.initialFlipY ? -1 : 1;
state.ClearTrack(0);
skeleton.SetToSetupPose();
if (!string.IsNullOrEmpty(startingAnimation)) {
state.SetAnimation(0, startingAnimation, startingLoop);
Update(0f);
}
}
} }
} else { } else {
// Under some circumstances (e.g. sometimes on the first import) OnValidate is called // Under some circumstances (e.g. sometimes on the first import) OnValidate is called
@ -727,12 +719,6 @@ namespace Spine.Unity {
meshGenerator.Begin(); meshGenerator.Begin();
bool useAddSubmesh = currentInstructions.hasActiveClipping && currentInstructions.submeshInstructions.Count > 0; bool useAddSubmesh = currentInstructions.hasActiveClipping && currentInstructions.submeshInstructions.Count > 0;
#if UNITY_EDITOR
// Editor triggers Graphic.Rebuild without prior LateUpdate call, which
// can lead to filling unprepared vertex buffer and out-of-bounds write access.
if (!Application.isPlaying)
useAddSubmesh = true;
#endif
if (useAddSubmesh) { if (useAddSubmesh) {
meshGenerator.AddSubmesh(currentInstructions.submeshInstructions.Items[0], updateTriangles); meshGenerator.AddSubmesh(currentInstructions.submeshInstructions.Items[0], updateTriangles);
} else { } else {

View File

@ -21,6 +21,7 @@ Shader "Spine/Blend Modes/Skeleton PMA Additive" {
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -21,6 +21,7 @@ Shader "Spine/Blend Modes/Skeleton PMA Multiply" {
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -21,6 +21,7 @@ Shader "Spine/Blend Modes/Skeleton PMA Screen" {
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -4,7 +4,7 @@
float4 computeOutlinePixel(sampler2D mainTexture, float2 mainTextureTexelSize, float4 computeOutlinePixel(sampler2D mainTexture, float2 mainTextureTexelSize,
float2 uv, float vertexColorAlpha, float2 uv, float vertexColorAlpha,
float OutlineWidth, float OutlineReferenceTexWidth, float OutlineMipLevel, float OutlineWidth, float OutlineReferenceTexWidth, float OutlineMipLevel,
float OutlineSmoothness, float ThresholdEnd, float4 OutlineColor) { float OutlineSmoothness, float ThresholdEnd, float OutlineOpaqueAlpha, float4 OutlineColor) {
float4 texColor = fixed4(0, 0, 0, 0); float4 texColor = fixed4(0, 0, 0, 0);
@ -36,7 +36,18 @@ float4 computeOutlinePixel(sampler2D mainTexture, float2 mainTextureTexelSize,
#endif #endif
float thresholdStart = ThresholdEnd * (1.0 - OutlineSmoothness); float thresholdStart = ThresholdEnd * (1.0 - OutlineSmoothness);
float outlineAlpha = saturate(saturate((average - thresholdStart) / (ThresholdEnd - thresholdStart)) - pixelCenter); float outlineAlpha = saturate(saturate((average - thresholdStart) / (ThresholdEnd - thresholdStart)) - pixelCenter);
outlineAlpha = pixelCenter > OutlineOpaqueAlpha ? 0 : outlineAlpha;
return lerp(texColor, OutlineColor, outlineAlpha); return lerp(texColor, OutlineColor, outlineAlpha);
} }
float4 computeOutlinePixel(sampler2D mainTexture, float2 mainTextureTexelSize,
float2 uv, float vertexColorAlpha,
float OutlineWidth, float OutlineReferenceTexWidth, float OutlineMipLevel,
float OutlineSmoothness, float ThresholdEnd, float4 OutlineColor) {
return computeOutlinePixel(mainTexture, mainTextureTexelSize,
uv, vertexColorAlpha, OutlineWidth, OutlineReferenceTexWidth, OutlineMipLevel,
OutlineSmoothness, ThresholdEnd, 1.0, OutlineColor);
}
#endif #endif

View File

@ -16,6 +16,7 @@ Shader "Spine/Outline/Blend Modes/Skeleton PMA Additive" {
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -16,6 +16,7 @@ Shader "Spine/Outline/Blend Modes/Skeleton PMA Multiply" {
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -16,6 +16,7 @@ Shader "Spine/Outline/Blend Modes/Skeleton PMA Screen" {
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -16,6 +16,7 @@ float4 _OutlineColor;
float4 _MainTex_TexelSize; float4 _MainTex_TexelSize;
float _ThresholdEnd; float _ThresholdEnd;
float _OutlineSmoothness; float _OutlineSmoothness;
float _OutlineOpaqueAlpha;
float _OutlineMipLevel; float _OutlineMipLevel;
int _OutlineReferenceTexWidth; int _OutlineReferenceTexWidth;
@ -80,7 +81,7 @@ float4 fragOutline(VertexOutput i) : SV_Target {
float4 texColor = computeOutlinePixel(_MainTex, _MainTex_TexelSize.xy, i.uv, i.vertexColorAlpha, float4 texColor = computeOutlinePixel(_MainTex, _MainTex_TexelSize.xy, i.uv, i.vertexColorAlpha,
_OutlineWidth, _OutlineReferenceTexWidth, _OutlineMipLevel, _OutlineWidth, _OutlineReferenceTexWidth, _OutlineMipLevel,
_OutlineSmoothness, _ThresholdEnd, _OutlineColor); _OutlineSmoothness, _ThresholdEnd, _OutlineOpaqueAlpha, _OutlineColor);
#ifdef SKELETON_GRAPHIC #ifdef SKELETON_GRAPHIC
texColor *= UnityGet2DClipping(i.worldPosition.xy, _ClipRect); texColor *= UnityGet2DClipping(i.worldPosition.xy, _ClipRect);

View File

@ -26,6 +26,7 @@ Shader "Spine/Outline/SkeletonGraphic"
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -28,6 +28,7 @@ Shader "Spine/Outline/SkeletonGraphic Tint Black"
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -17,6 +17,7 @@ Shader "Spine/Outline/Skeleton Fill" {
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }
SubShader { SubShader {

View File

@ -16,6 +16,7 @@ Shader "Spine/Outline/Skeleton Lit" {
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -17,6 +17,7 @@ Shader "Spine/Outline/Skeleton Lit ZWrite" {
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -15,6 +15,7 @@ Shader "Spine/Outline/Skeleton" {
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -14,6 +14,7 @@ Shader "Spine/Outline/OutlineOnly-ZWrite" {
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -17,6 +17,7 @@ Shader "Spine/Outline/Skeleton Tint" {
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -17,6 +17,7 @@ Shader "Spine/Outline/Skeleton Tint Black" {
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -16,6 +16,7 @@ Shader "Spine/Outline/Special/Skeleton Grayscale" {
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -53,6 +53,7 @@ Shader "Spine/Outline/Sprite/Pixel Lit"
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -36,6 +36,7 @@ Shader "Spine/Outline/Sprite/Unlit"
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -54,6 +54,7 @@ Shader "Spine/Outline/Sprite/Vertex Lit"
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -26,6 +26,7 @@ Shader "Spine/SkeletonGraphic Additive"
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -26,6 +26,7 @@ Shader "Spine/SkeletonGraphic Multiply"
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -26,6 +26,7 @@ Shader "Spine/SkeletonGraphic Screen"
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -29,6 +29,7 @@ Shader "Spine/SkeletonGraphic Tint Black"
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -26,6 +26,7 @@ Shader "Spine/SkeletonGraphic"
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -19,6 +19,7 @@ Shader "Spine/Skeleton Fill" {
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }
SubShader { SubShader {

View File

@ -20,6 +20,7 @@ Shader "Spine/Skeleton Lit ZWrite" {
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -19,6 +19,7 @@ Shader "Spine/Skeleton Lit" {
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -22,6 +22,7 @@ Shader "Spine/Skeleton Tint" {
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -24,6 +24,7 @@ Shader "Spine/Skeleton Tint Black" {
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -13,6 +13,7 @@ Shader "Spine/Skeleton" {
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -18,6 +18,7 @@ Shader "Spine/Special/Skeleton Grayscale" {
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -53,6 +53,7 @@ Shader "Spine/Sprite/Pixel Lit"
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -34,6 +34,7 @@ Shader "Spine/Sprite/Unlit"
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -54,6 +54,7 @@ Shader "Spine/Sprite/Vertex Lit"
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5ff63f0361511c0408216680a91a6f89
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 654fad9276956484a835f2480266668a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f9f6386621ae5c643b5672377952e923
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bf1dab9e8d912844495414992b413a8c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,11 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!62 &6200000
PhysicsMaterial2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: TestCharacterMaterial
friction: 0
bounciness: 0

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ee2622cfe329cfa4e9d00d26166bd9a3
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 6200000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 921d5da5c9a6f77429fcd828d5facaab
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,98 @@
raptor-pro.png
size:2017,918
filter:Linear,Linear
pma:true
back-arm
bounds:1772,17,91,48
offsets:0,0,91,49
back-bracer
bounds:1481,34,77,55
back-hand
bounds:1407,21,72,68
back-knee
bounds:1902,69,97,134
back-thigh
bounds:1018,125,78,47
eyes-open
bounds:719,17,93,89
front-arm
bounds:402,14,96,51
front-bracer
bounds:1347,15,81,58
rotate:90
front-hand
bounds:1018,41,82,75
rotate:90
front-open-hand
bounds:1258,10,86,87
rotate:90
front-thigh
bounds:96,7,114,58
gun
bounds:1577,240,212,206
offsets:0,0,213,206
gun-nohand
bounds:1561,35,209,203
offsets:0,0,210,203
head
bounds:1608,618,271,298
lower-leg
bounds:1413,91,146,189
offsets:0,6,146,195
mouth-grind
bounds:212,6,93,59
mouth-smile
bounds:307,6,93,59
neck
bounds:1865,24,35,41
offsets:0,0,36,41
raptor-back-arm
bounds:844,9,163,172
rotate:90
raptor-body
bounds:2,451,1264,465
raptor-front-arm
bounds:1413,282,162,203
raptor-front-leg
bounds:2,67,382,514
rotate:90
raptor-hindleg-back
bounds:1268,487,338,429
raptor-horn
bounds:1098,86,363,158
offsets:0,0,363,159
rotate:90
raptor-horn-back
bounds:1258,98,351,153
rotate:90
raptor-jaw
bounds:844,174,252,275
raptor-jaw-tooth
bounds:2,2,63,92
offsets:7,4,73,96
rotate:90
raptor-mouth-inside
bounds:1095,2,71,82
raptor-saddle-strap-back
bounds:1907,205,108,148
raptor-saddle-strap-front
bounds:1791,257,114,189
raptor-saddle-w-shadow
bounds:518,108,324,341
raptor-tail-shadow
bounds:1881,539,377,126
rotate:90
raptor-tongue
bounds:1772,67,171,128
rotate:90
stirrup-back
bounds:1168,15,87,69
stirrup-front
bounds:518,17,89,100
rotate:90
stirrup-strap
bounds:620,15,97,91
torso
bounds:1907,355,108,182
visor
bounds:1608,448,261,168

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d2fce08733a866d408a5b9ca41fe41af
timeCreated: 1591122087
licenseType: Pro
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ab6d7df3cf5201f40a3d3b39bac9ac33
timeCreated: 1591122087
licenseType: Pro
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 11b70d61196bc214391853c42a46cb93
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,74 @@
fileFormatVersion: 2
guid: bd3dd8d509158df4b8cdb69891123217
timeCreated: 1591122088
licenseType: Pro
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -1
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,17 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a6b194f808b1af6499c93410e504af42, type: 3}
m_Name: raptor-pro_Atlas
m_EditorClassIdentifier:
atlasFile: {fileID: 4900000, guid: d2fce08733a866d408a5b9ca41fe41af, type: 3}
materials:
- {fileID: 2100000, guid: bda53dc0ad1672f4cadf3b25031d290d, type: 2}

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 988cd03286a74004d841674b6b372c3c
timeCreated: 1591122088
licenseType: Pro
NativeFormatImporter:
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: b00f648dcb4a6eb418684825750c7f44
timeCreated: 1591122106
licenseType: Pro
NativeFormatImporter:
mainObjectFileID: 9100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,39 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: raptor-pro_Material
m_Shader: {fileID: 4800000, guid: 1e8a610c9e01c3648bac42585e5fc676, type: 3}
m_ShaderKeywords: _USE8NEIGHBOURHOOD_ON
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 2800000, guid: bd3dd8d509158df4b8cdb69891123217, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _Cutoff: 0.1
- _OutlineMipLevel: 0
- _OutlineReferenceTexWidth: 1024
- _OutlineSmoothness: 1
- _OutlineWidth: 3
- _StencilComp: 8
- _StencilRef: 1
- _StraightAlphaInput: 0
- _ThresholdEnd: 0.25
- _Use8Neighbourhood: 1
m_Colors:
- _OutlineColor: {r: 1, g: 1, b: 0, a: 1}
m_BuildTextureStacks: []

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: bda53dc0ad1672f4cadf3b25031d290d
timeCreated: 1591122088
licenseType: Pro
NativeFormatImporter:
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,31 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f1b3b4b945939a54ea0b23d3396115fb, type: 3}
m_Name: raptor-pro_SkeletonData
m_EditorClassIdentifier:
atlasAssets:
- {fileID: 11400000, guid: 988cd03286a74004d841674b6b372c3c, type: 2}
scale: 0.01
skeletonJSON: {fileID: 4900000, guid: ab6d7df3cf5201f40a3d3b39bac9ac33, type: 3}
isUpgradingBlendModeMaterials: 0
blendModeMaterials:
requiresBlendModeMaterials: 0
applyAdditiveMaterial: 0
additiveMaterials: []
multiplyMaterials: []
screenMaterials: []
skeletonDataModifiers: []
fromAnimation: []
toAnimation: []
duration: []
defaultMix: 0.2
controller: {fileID: 9100000, guid: b00f648dcb4a6eb418684825750c7f44, type: 2}

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 39efd43571aba134b96d3b2c805b2bbb
timeCreated: 1591122088
licenseType: Pro
NativeFormatImporter:
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bac23cb727039c74b8d8840fec841a93
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 21a5c6a2a2f1c73488d397f286be91ab
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a98b88dcb4ecf594296948468096c8b5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 895865989758844479fae85f9528a895
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,642 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 256
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 1
m_PVRDenoiserTypeDirect: 1
m_PVRDenoiserTypeIndirect: 1
m_PVRDenoiserTypeAO: 1
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_LightingSettings: {fileID: 0}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &122890449
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 122890452}
- component: {fileID: 122890451}
- component: {fileID: 122890450}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &122890450
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 122890449}
m_Enabled: 1
--- !u!20 &122890451
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 122890449}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 2
m_BackGroundColor: {r: 0.8207547, g: 0.8207547, b: 0.8207547, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &122890452
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 122890449}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 5.4, z: -41.8}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &273154726
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 273154729}
- component: {fileID: 273154728}
- component: {fileID: 273154727}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &273154727
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 273154726}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!114 &273154728
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 273154726}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 10
--- !u!4 &273154729
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 273154726}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &654073080
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 654073082}
- component: {fileID: 654073081}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &654073081
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 654073080}
m_Enabled: 1
serializedVersion: 10
m_Type: 1
m_Shape: 0
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_UseViewFrustumForShadowCasterCull: 1
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &654073082
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 654073080}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &863851824
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 863851828}
- component: {fileID: 863851827}
- component: {fileID: 863851826}
- component: {fileID: 863851825}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &863851825
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 863851824}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &863851826
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 863851824}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 0
--- !u!223 &863851827
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 863851824}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &863851828
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 863851824}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 1363438027}
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!1 &1363438026
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1363438027}
- component: {fileID: 1363438029}
- component: {fileID: 1363438028}
m_Layer: 5
m_Name: Note
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1363438027
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1363438026}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 863851828}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -35, y: -73.37669}
m_SizeDelta: {x: -110.712, y: -161.2665}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1363438028
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1363438026}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: 'This scene is just for easier preview and applying the contained prefab.
The
prefab is instantiated by the unit test, started via Window - General - Test
Runner.'
--- !u!222 &1363438029
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1363438026}
m_CullTransparentMesh: 1
--- !u!1001 &6724551901292798453
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 992224771, guid: 895865989758844479fae85f9528a895, type: 3}
propertyPath: m_Mesh
value:
objectReference: {fileID: 0}
- target: {fileID: 1746262824, guid: 895865989758844479fae85f9528a895, type: 3}
propertyPath: m_Mesh
value:
objectReference: {fileID: 0}
- target: {fileID: 708850485344201424, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_Mesh
value:
objectReference: {fileID: 0}
- target: {fileID: 6724551900104020878, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_Mesh
value:
objectReference: {fileID: 0}
- target: {fileID: 6724551900186929288, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_Name
value: apply this RootMotionTestPrefabRoot
objectReference: {fileID: 0}
- target: {fileID: 6724551900186929291, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 6724551900186929291, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_LocalPosition.x
value: 0.6382912
objectReference: {fileID: 0}
- target: {fileID: 6724551900186929291, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_LocalPosition.y
value: 3.5455108
objectReference: {fileID: 0}
- target: {fileID: 6724551900186929291, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_LocalPosition.z
value: -0.21497345
objectReference: {fileID: 0}
- target: {fileID: 6724551900186929291, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6724551900186929291, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6724551900186929291, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6724551900186929291, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6724551900186929291, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6724551900186929291, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6724551900186929291, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7637581583264517358, guid: 895865989758844479fae85f9528a895,
type: 3}
propertyPath: m_Mesh
value:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 895865989758844479fae85f9528a895, type: 3}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 11279de73ef10084aaee4e9029d8bfa7
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,23 @@
{
"name": "spine-unity-playmode-tests",
"rootNamespace": "",
"references": [
"UnityEngine.TestRunner",
"UnityEditor.TestRunner",
"spine-csharp",
"spine-unity"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [
"nunit.framework.dll"
],
"autoReferenced": false,
"defineConstraints": [
"UNITY_INCLUDE_TESTS"
],
"versionDefines": [],
"noEngineReferences": false
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 307db75ef1c531743a6835c00cf8b9ab
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b08ca6e1b9219d34e9ee4abeb9560986
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,364 @@
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated September 24, 2021. Replaces all prior versions.
*
* Copyright (c) 2013-2022, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
using NUnit.Framework;
using Spine;
using Spine.Unity;
using System.Collections;
using UnityEngine;
using UnityEngine.TestTools;
public class RootMotionTests {
const float WalkRootMotionVelocity = 9.656f; // value specific to this test animation
const float PositionEpsilon = 0.01f;
GameObject rootGameObject;
SkeletonRootMotion skeletonRootMotion;
SkeletonAnimation skeletonAnimation;
Transform skeletonTransform;
float savedFixedTimeStep;
Vector2 translationDeltaSum = Vector2.zero;
float rotationDeltaSum = 0f;
int loopsComplete = 0;
[UnityTest]
public IEnumerator Test01BasicFunctionality () {
SetupLoadingPrefab("RootMotionTestPrefabRoot", "straight-walk");
float lastPositionX = skeletonTransform.position.x;
// root motion shall lead to increasing transform position
for (int i = 0; i < 30; ++i) {
yield return null;
lastPositionX = ExpectIncreasingPositionX(lastPositionX, Time.deltaTime * WalkRootMotionVelocity);
}
// disabling the root motion component shall no longer change the transform
skeletonRootMotion.enabled = false;
for (int i = 0; i < 3; ++i) {
yield return null;
lastPositionX = ExpectUnchangedPositionX(lastPositionX);
}
}
[UnityTest]
public IEnumerator Test02BoneOffsetNoRigidbody () {
SetupLoadingPrefab("RootMotionTestPrefabRoot", "straight-walk");
yield return null;
Bone topLevelBone = skeletonAnimation.skeleton.Bones.Items[0];
Bone rootMotionBone = skeletonRootMotion.RootMotionBone;
bool rootMotionIsTopLevelBone = rootMotionBone == topLevelBone;
float lastPositionX = topLevelBone.GetLocalPosition().x;
float lastRootMotionBoneX = rootMotionBone.GetLocalPosition().x;
// with enabled root motion component the top level bone shall no longer change position.
for (int i = 0; i < 15; ++i) {
yield return null;
if (rootMotionIsTopLevelBone)
lastPositionX = ExpectUnchangedLocalBonePositionX(topLevelBone, lastPositionX);
else {
lastPositionX = ExpectDecreasingLocalBonePositionX(topLevelBone, lastPositionX);
lastRootMotionBoneX = ExpectUnchangedLocalBonePositionX(rootMotionBone, lastRootMotionBoneX);
}
}
// disabling the root motion component shall no longer reset the root motion bone
skeletonRootMotion.enabled = false;
for (int i = 0; i < 3; ++i) {
yield return null;
lastPositionX = ExpectIncreasingLocalBonePositionX(rootMotionBone, lastPositionX);
}
}
[UnityTest]
public IEnumerator Test03UpdateCallbacks () {
SetupLoadingPrefab("RootMotionTestPrefabRoot", "straight-walk");
float lastPositionX = skeletonTransform.position.x;
skeletonRootMotion.ProcessRootMotionOverride -= ProcessRootMotionNoOp;
skeletonRootMotion.ProcessRootMotionOverride += ProcessRootMotionNoOp;
skeletonRootMotion.disableOnOverride = true;
// with disableOnOverride it shall no longer change the transform
for (int i = 0; i < 3; ++i) {
yield return null;
lastPositionX = ExpectUnchangedPositionX(lastPositionX);
}
skeletonRootMotion.disableOnOverride = false;
// with disableOnOverride = false it shall again apply root motion to the transform
for (int i = 0; i < 3; ++i) {
yield return null;
lastPositionX = ExpectIncreasingPositionX(lastPositionX, Time.deltaTime * WalkRootMotionVelocity);
}
}
[UnityTest]
public IEnumerator Test04PhysicsUpdateCallbacks2D () {
return TestPhysicsUpdateCallbacks("straight-walk-rigidbody2d");
}
[UnityTest]
public IEnumerator Test05PhysicsUpdateCallbacks3D () {
return TestPhysicsUpdateCallbacks("straight-walk-rigidbody3d");
}
public IEnumerator TestPhysicsUpdateCallbacks (string gameObjectName) {
SetupLoadingPrefab("RootMotionTestPrefabRoot", gameObjectName);
float lastPositionX = skeletonTransform.position.x;
skeletonRootMotion.ProcessRootMotionOverride -= ProcessRootMotionNoOp;
skeletonRootMotion.ProcessRootMotionOverride += ProcessRootMotionNoOp;
skeletonRootMotion.PhysicsUpdateRootMotionOverride -= ProcessRootMotionNoOp;
skeletonRootMotion.PhysicsUpdateRootMotionOverride += ProcessRootMotionNoOp;
skeletonRootMotion.disableOnOverride = true;
Debug.Log("Testing physics update with animation timing InUpdate.");
skeletonAnimation.UpdateTiming = UpdateTiming.InUpdate;
yield return new WaitForFixedUpdate();
yield return null;
lastPositionX = skeletonTransform.position.x;
// a rigidbody is assigned, disableOnOverride shall disable applying root motion when PhysicsUpdateRootMotionOverride is set
for (int i = 0; i < 3; ++i) {
yield return new WaitForFixedUpdate();
yield return null;
lastPositionX = ExpectUnchangedPositionX(lastPositionX);
}
// same when using InFixedUpdate
Debug.Log("Testing physics update with animation timing InFixedUpdate.");
skeletonAnimation.UpdateTiming = UpdateTiming.InFixedUpdate;
yield return new WaitForFixedUpdate();
lastPositionX = skeletonTransform.position.x;
for (int i = 0; i < 3; ++i) {
yield return new WaitForFixedUpdate();
lastPositionX = ExpectUnchangedPositionX(lastPositionX);
}
Debug.Log("Testing physics update InFixedUpdate with disableOnOverride = false.");
Time.fixedDeltaTime = 0.5f;
skeletonRootMotion.disableOnOverride = false;
skeletonAnimation.UpdateTiming = UpdateTiming.InFixedUpdate;
yield return new WaitForFixedUpdate();
lastPositionX = skeletonTransform.position.x;
for (int i = 0; i < 3; ++i) {
yield return null;
lastPositionX = ExpectUnchangedPositionX(lastPositionX);
yield return new WaitForFixedUpdate();
lastPositionX = ExpectIncreasingPositionX(lastPositionX, Time.deltaTime * WalkRootMotionVelocity);
}
}
[UnityTest]
public IEnumerator Test06CallbackDistancesInUpdate2D () {
return TestCallbackDistancesInUpdate("straight-walk-rigidbody2d");
}
[UnityTest]
public IEnumerator Test07CallbackDistancesInUpdate3D () {
return TestCallbackDistancesInUpdate("straight-walk-rigidbody3d");
}
public IEnumerator TestCallbackDistancesInUpdate (string gameObjectName) {
SetupLoadingPrefab("RootMotionTestPrefabRoot", gameObjectName);
float lastPositionX = skeletonTransform.position.x;
Debug.Log("Testing physics update with animation timing InUpdate.");
skeletonAnimation.UpdateTiming = UpdateTiming.InUpdate;
skeletonRootMotion.disableOnOverride = true;
skeletonRootMotion.ProcessRootMotionOverride -= CumulateDelta;
skeletonRootMotion.ProcessRootMotionOverride += CumulateDelta;
skeletonRootMotion.PhysicsUpdateRootMotionOverride -= EndAndCompareCumulatedDelta;
skeletonRootMotion.PhysicsUpdateRootMotionOverride += EndAndCompareCumulatedDelta;
for (int i = 0; i < 30; ++i) {
yield return new WaitForFixedUpdate();
yield return null;
}
Debug.Log("Testing physics update animating InUpdate with very long fixedDeltaTime (physics timestep).");
Time.fixedDeltaTime = 0.5f;
skeletonRootMotion.disableOnOverride = false;
lastPositionX = skeletonTransform.position.x;
for (int i = 0; i < 6; ++i) { // only few iterations since WaitForFixedUpdate takes 0.5 seconds now!
yield return new WaitForFixedUpdate();
yield return null;
}
}
[UnityTest]
public IEnumerator Test08CallbackDistancesInFixedUpdate2D () {
return TestCallbackDistancesInFixedUpdate("straight-walk-rigidbody2d");
}
[UnityTest]
public IEnumerator Test09CallbackDistancesInFixedUpdate3D () {
return TestCallbackDistancesInFixedUpdate("straight-walk-rigidbody3d");
}
public IEnumerator TestCallbackDistancesInFixedUpdate (string gameObjectName) {
SetupLoadingPrefab("RootMotionTestPrefabRoot", gameObjectName);
float lastPositionX = skeletonTransform.position.x;
Debug.Log("Testing physics update with animation timing InFixedUpdate.");
skeletonAnimation.UpdateTiming = UpdateTiming.InFixedUpdate;
skeletonRootMotion.disableOnOverride = true;
skeletonRootMotion.ProcessRootMotionOverride -= CumulateDelta;
skeletonRootMotion.ProcessRootMotionOverride += CumulateDelta;
skeletonRootMotion.PhysicsUpdateRootMotionOverride -= EndAndCompareCumulatedDelta;
skeletonRootMotion.PhysicsUpdateRootMotionOverride += EndAndCompareCumulatedDelta;
// a rigidbody is assigned, disableOnOverride shall disable applying root motion when PhysicsUpdateRootMotionOverride is set
for (int i = 0; i < 30; ++i) {
yield return new WaitForFixedUpdate();
yield return null;
}
Debug.Log("Testing physics update animating InFixedUpdate with very long fixedDeltaTime (physics timestep).");
Time.fixedDeltaTime = 0.5f;
skeletonRootMotion.disableOnOverride = false;
lastPositionX = skeletonTransform.position.x;
for (int i = 0; i < 6; ++i) { // only few iterations since WaitForFixedUpdate takes 0.5 seconds now!
yield return new WaitForFixedUpdate();
yield return null;
}
}
[UnityTest]
public IEnumerator Test10DeltaCompensation () {
SetupLoadingPrefab("RootMotionTestPrefabRoot", "jump-rootmotion");
Transform jumpTarget = GameObject.Find("jump-target").transform;
Time.timeScale = 3;
skeletonAnimation.AnimationState.Complete += OnLoopComplete;
yield return null;
for (int i = 0; i < 600 && loopsComplete == 0; ++i) {
// note: done via existing example component now.
// Vector3 toTarget = jumpTarget.position - skeletonTransform.position;
// skeletonRootMotion.AdjustRootMotionToDistance(toTarget);
yield return null;
}
Assert.AreEqual(1, loopsComplete);
Assert.AreEqual(jumpTarget.transform.position.x, skeletonTransform.position.x, PositionEpsilon);
}
public void OnLoopComplete (TrackEntry trackEntry) {
++loopsComplete;
}
GameObject SetupLoadingPrefab (string prefabAssetName, string skeletonObjectName) {
GameObject prefab = Resources.Load<GameObject>(prefabAssetName);
rootGameObject = MonoBehaviour.Instantiate(prefab);
Assert.IsNotNull(rootGameObject);
GameObject straightWalkObject = GameObject.Find(skeletonObjectName);
Assert.IsNotNull(straightWalkObject);
skeletonTransform = straightWalkObject.transform;
skeletonAnimation = straightWalkObject.GetComponent<SkeletonAnimation>();
skeletonRootMotion = skeletonAnimation.GetComponent<SkeletonRootMotion>();
Assert.IsNotNull(skeletonAnimation);
Assert.IsNotNull(skeletonRootMotion);
return rootGameObject;
}
[UnitySetUp]
public IEnumerator SetUp () {
savedFixedTimeStep = Time.fixedDeltaTime;
translationDeltaSum = Vector2.zero;
rotationDeltaSum = 0f;
yield return null;
}
[UnityTearDown]
public IEnumerator TearDown () {
Time.timeScale = 1;
Time.fixedDeltaTime = savedFixedTimeStep;
GameObject.Destroy(rootGameObject);
yield return null;
}
void ProcessRootMotionNoOp (SkeletonRootMotionBase component, Vector2 translation, float rotation) {
}
void CumulateDelta (SkeletonRootMotionBase component, Vector2 translationDelta, float rotationDelta) {
translationDeltaSum += translationDelta;
rotationDeltaSum += rotationDelta;
Debug.Log(" Accumulating movement delta for later comparison. Single delta: " + translationDelta);
}
void EndAndCompareCumulatedDelta (SkeletonRootMotionBase component, Vector2 cumulatedTranslation, float cumulatedRotation) {
Debug.Log(" Cumulated movement delta from callback: " + cumulatedTranslation);
Assert.AreEqual(translationDeltaSum.x, cumulatedTranslation.x);
Assert.AreEqual(translationDeltaSum.y, cumulatedTranslation.y);
Assert.AreEqual(rotationDeltaSum, cumulatedRotation);
translationDeltaSum = Vector2.zero;
rotationDeltaSum = 0f;
Debug.Log(" Successfully compared cumulated delta.");
}
float ExpectUnchangedPositionX (float lastPositionX) {
float positionX = skeletonTransform.position.x;
Assert.AreEqual(positionX, lastPositionX);
return positionX;
}
float ExpectIncreasingPositionX (float lastPositionX, float difference) {
float positionX = skeletonTransform.position.x;
Assert.Greater(positionX, lastPositionX);
//Debug.Log(string.Format("positionX {0}, lastPositionX {1}, deltatime {2}.", positionX, lastPositionX, Time.deltaTime));
Assert.AreEqual(lastPositionX + difference, positionX, PositionEpsilon);
return positionX;
}
float ExpectUnchangedLocalBonePositionX (Bone bone, float lastPositionX) {
float positionX = bone.GetLocalPosition().x;
Assert.AreEqual(positionX, lastPositionX);
return positionX;
}
float ExpectIncreasingLocalBonePositionX (Bone bone, float lastPositionX) {
float positionX = bone.GetLocalPosition().x;
Assert.Greater(positionX, lastPositionX);
return positionX;
}
float ExpectDecreasingLocalBonePositionX (Bone bone, float lastPositionX) {
float positionX = bone.GetLocalPosition().x;
Assert.Less(positionX, lastPositionX);
return positionX;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e047bb9d2c2a66b4392a0589cb3a7aa8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -51,6 +51,7 @@ namespace Spine.Unity.Playables {
bool isPaused = false; bool isPaused = false;
TrackEntry pausedTrackEntry; TrackEntry pausedTrackEntry;
float previousTimeScale = 1; float previousTimeScale = 1;
float rootPlayableSpeed = 1;
TrackEntry timelineStartedTrackEntry; TrackEntry timelineStartedTrackEntry;
@ -109,6 +110,18 @@ namespace Spine.Unity.Playables {
} }
} }
private void AdjustTrackEntryTimeScale (Playable playable, int input, TrackEntry currentTrackEntry) {
if (currentTrackEntry == null)
return;
ScriptPlayable<SpineAnimationStateBehaviour> clipPlayable = (ScriptPlayable<SpineAnimationStateBehaviour>)playable.GetInput(input);
float clipSpeed = (float)clipPlayable.GetSpeed();
SpineAnimationStateBehaviour clipData = clipPlayable.GetBehaviour();
if (clipData != null && clipData.animationReference != null
&& currentTrackEntry.Animation == clipData.animationReference.Animation) {
currentTrackEntry.TimeScale = clipSpeed * rootPlayableSpeed;
}
}
// NOTE: This function is called at runtime and edit time. Keep that in mind when setting the values of properties. // NOTE: This function is called at runtime and edit time. Keep that in mind when setting the values of properties.
public override void ProcessFrame (Playable playable, FrameData info, object playerData) { public override void ProcessFrame (Playable playable, FrameData info, object playerData) {
var skeletonAnimation = playerData as SkeletonAnimation; var skeletonAnimation = playerData as SkeletonAnimation;
@ -129,7 +142,9 @@ namespace Spine.Unity.Playables {
} }
int inputCount = playable.GetInputCount(); int inputCount = playable.GetInputCount();
float rootSpeed = GetRootPlayableSpeed(playable); float previousRootSpeed = rootPlayableSpeed;
rootPlayableSpeed = GetRootPlayableSpeed(playable);
bool rootSpeedChanged = previousRootSpeed != rootPlayableSpeed;
// Ensure correct buffer size. // Ensure correct buffer size.
if (this.lastInputWeights == null || this.lastInputWeights.Length < inputCount) { if (this.lastInputWeights == null || this.lastInputWeights.Length < inputCount) {
@ -151,9 +166,14 @@ namespace Spine.Unity.Playables {
anyClipPlaying = true; anyClipPlaying = true;
lastInputWeights[i] = inputWeight; lastInputWeights[i] = inputWeight;
if (clipStarted && numStartingClips < 2) { if (clipStarted) {
ScriptPlayable<SpineAnimationStateBehaviour> clipPlayable = (ScriptPlayable<SpineAnimationStateBehaviour>)playable.GetInput(i); if (numStartingClips < 2) {
startingClips[numStartingClips++] = clipPlayable; ScriptPlayable<SpineAnimationStateBehaviour> clipPlayable = (ScriptPlayable<SpineAnimationStateBehaviour>)playable.GetInput(i);
startingClips[numStartingClips++] = clipPlayable;
}
} else if (rootSpeedChanged) {
TrackEntry currentEntry = state.GetCurrent(trackIndex);
AdjustTrackEntryTimeScale(playable, i, currentEntry);
} }
} }
// unfortunately order of clips can be wrong when two start at the same time, we have to sort clips // unfortunately order of clips can be wrong when two start at the same time, we have to sort clips
@ -192,14 +212,14 @@ namespace Spine.Unity.Playables {
float clipSpeed = (float)clipPlayable.GetSpeed(); float clipSpeed = (float)clipPlayable.GetSpeed();
trackEntry.EventThreshold = clipData.eventThreshold; trackEntry.EventThreshold = clipData.eventThreshold;
trackEntry.DrawOrderThreshold = clipData.drawOrderThreshold; trackEntry.DrawOrderThreshold = clipData.drawOrderThreshold;
trackEntry.TrackTime = (float)clipPlayable.GetTime() * clipSpeed * rootSpeed; trackEntry.TrackTime = (float)clipPlayable.GetTime() * clipSpeed * rootPlayableSpeed;
trackEntry.TimeScale = clipSpeed * rootSpeed; trackEntry.TimeScale = clipSpeed * rootPlayableSpeed;
trackEntry.AttachmentThreshold = clipData.attachmentThreshold; trackEntry.AttachmentThreshold = clipData.attachmentThreshold;
trackEntry.HoldPrevious = clipData.holdPrevious; trackEntry.HoldPrevious = clipData.holdPrevious;
trackEntry.Alpha = clipData.alpha; trackEntry.Alpha = clipData.alpha;
if (clipData.customDuration) if (clipData.customDuration)
trackEntry.MixDuration = customMixDuration / rootSpeed; trackEntry.MixDuration = customMixDuration / rootPlayableSpeed;
timelineStartedTrackEntry = trackEntry; timelineStartedTrackEntry = trackEntry;
} }

View File

@ -17,6 +17,7 @@ float4 _OutlineColor;
float4 _MainTex_TexelSize; float4 _MainTex_TexelSize;
float _ThresholdEnd; float _ThresholdEnd;
float _OutlineSmoothness; float _OutlineSmoothness;
float _OutlineOpaqueAlpha;
float _OutlineMipLevel; float _OutlineMipLevel;
int _OutlineReferenceTexWidth; int _OutlineReferenceTexWidth;
CBUFFER_END CBUFFER_END

View File

@ -32,11 +32,11 @@ VertexOutput vertOutline(VertexInput v) {
return o; return o;
} }
float4 fragOutline(VertexOutput i) : SV_Target{ float4 fragOutline(VertexOutput i) : SV_Target {
float4 texColor = computeOutlinePixel(_MainTex, _MainTex_TexelSize.xy, i.uv, i.vertexColorAlpha, float4 texColor = computeOutlinePixel(_MainTex, _MainTex_TexelSize.xy, i.uv, i.vertexColorAlpha,
_OutlineWidth, _OutlineReferenceTexWidth, _OutlineMipLevel, _OutlineWidth, _OutlineReferenceTexWidth, _OutlineMipLevel,
_OutlineSmoothness, _ThresholdEnd, _OutlineColor); _OutlineSmoothness, _ThresholdEnd, _OutlineOpaqueAlpha, _OutlineColor);
return texColor; return texColor;
} }

View File

@ -11,6 +11,7 @@ Shader "Universal Render Pipeline/Spine/Outline/Skeleton-OutlineOnly" {
[HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25 [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
[HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0 [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
[HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1 [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
[HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
[HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0 [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
} }

View File

@ -2,7 +2,7 @@
"name": "com.esotericsoftware.spine.urp-shaders", "name": "com.esotericsoftware.spine.urp-shaders",
"displayName": "Spine Universal RP 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.1.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)", "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.1.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)",
"version": "4.1.3", "version": "4.1.4",
"unity": "2019.3", "unity": "2019.3",
"author": { "author": {
"name": "Esoteric Software", "name": "Esoteric Software",