[unity] Timeline clips now offer an additional Alpha parameter for setting a custom constant mix alpha (as TrackEntry.Alpha).

This commit is contained in:
Harald Csaszar 2022-03-24 11:58:29 +01:00
parent 559af1159b
commit 5bde0730d3
6 changed files with 14 additions and 4 deletions

View File

@ -165,6 +165,7 @@
* Timeline track appearance and Inspector: Tracks now show icons and track colors to make them easier to distinguish. When a Track is selected, the Inspector now shows an editable track name which was previously only editable at the Timeline asset.
* Added example component `SkeletonRenderTexture` to render a `SkeletonRenderer` to a `RenderTexture`, mainly for proper transparency. Added an example scene named `RenderTexture FadeOut Transparency` that demonstrates usage for a fadeout transparency effect.
* Added another fadeout example component named `SkeletonRenderTextureFadeout` which takes over transparency fadeout when enabled. You can use this component as-is, attach it in disabled state and enable it to start a fadeout effect.
* Timeline clips now offer an additional `Alpha` parameter for setting a custom constant mix alpha value other than 1.0, just as `TrackEntry.Alpha`. Defaults to 1.0.
* **Changes of default values**

View File

@ -36,7 +36,7 @@ using UnityEngine;
public class SpineAnimationStateDrawer : PropertyDrawer {
public override float GetPropertyHeight (SerializedProperty property, GUIContent label) {
const int fieldCount = 15;
const int fieldCount = 16;
return fieldCount * EditorGUIUtility.singleLineHeight;
}
@ -48,6 +48,7 @@ public class SpineAnimationStateDrawer : PropertyDrawer {
SerializedProperty useBlendDurationProp = property.FindPropertyRelative("useBlendDuration");
SerializedProperty mixDurationProp = property.FindPropertyRelative("mixDuration");
SerializedProperty holdPreviousProp = property.FindPropertyRelative("holdPrevious");
SerializedProperty alphaProp = property.FindPropertyRelative("alpha");
SerializedProperty dontPauseWithDirectorProp = property.FindPropertyRelative("dontPauseWithDirector");
SerializedProperty dontEndWithClip = property.FindPropertyRelative("dontEndWithClip");
SerializedProperty endMixOutDuration = property.FindPropertyRelative("endMixOutDuration");
@ -129,5 +130,8 @@ public class SpineAnimationStateDrawer : PropertyDrawer {
singleFieldRect.y += lineHeightWithSpacing;
EditorGUI.PropertyField(singleFieldRect, drawOrderProp);
singleFieldRect.y += lineHeightWithSpacing;
EditorGUI.PropertyField(singleFieldRect, alphaProp);
}
}

View File

@ -69,6 +69,9 @@ namespace Spine.Unity.Playables {
[Range(0, 1f)]
public float drawOrderThreshold = 0.5f;
[Range(0, 1f)]
public float alpha = 1.0f;
}
}

View File

@ -191,6 +191,7 @@ namespace Spine.Unity.Playables {
trackEntry.TimeScale = (float)clipPlayable.GetSpeed();
trackEntry.AttachmentThreshold = clipData.attachmentThreshold;
trackEntry.HoldPrevious = clipData.holdPrevious;
trackEntry.Alpha = clipData.alpha;
if (clipData.customDuration)
trackEntry.MixDuration = customMixDuration;
@ -286,6 +287,7 @@ namespace Spine.Unity.Playables {
if (toAnimation != null) {
toEntry = dummyAnimationState.SetAnimation(0, toAnimation, clipData.loop);
toEntry.HoldPrevious = clipData.holdPrevious;
toEntry.Alpha = clipData.alpha;
}
}
@ -301,7 +303,7 @@ namespace Spine.Unity.Playables {
dummyAnimationState.Apply(skeleton);
} else {
if (toAnimation != null)
toAnimation.Apply(skeleton, 0, toClipTime, clipData.loop, null, 1f, MixBlend.Setup, MixDirection.In);
toAnimation.Apply(skeleton, 0, toClipTime, clipData.loop, null, clipData.alpha, MixBlend.Setup, MixDirection.In);
}
if (skeletonAnimation) {

View File

@ -2,7 +2,7 @@
"name": "com.esotericsoftware.spine.timeline",
"displayName": "Spine Timeline Extensions",
"description": "This plugin provides integration of spine-unity for the Unity Timeline.\n\nPrerequisites:\nIt requires a working installation of the spine-unity runtime (via the spine-unity unitypackage), version 4.0.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)",
"version": "4.0.9",
"version": "4.0.10",
"unity": "2018.3",
"author": {
"name": "Esoteric Software",

View File

@ -2,7 +2,7 @@
"name": "com.esotericsoftware.spine.timeline",
"displayName": "Spine Timeline Extensions",
"description": "This plugin provides integration of spine-unity for the Unity Timeline.\n\nPrerequisites:\nIt requires a working installation of the spine-unity and spine-csharp runtimes as UPM packages (not as spine-unity unitypackage), version 4.0.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)",
"version": "4.0.9",
"version": "4.0.10",
"unity": "2018.3",
"author": {
"name": "Esoteric Software",