mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[unity] Timeline extension package: Added static EditorEvent callback for editor scripts to react to animation events outside play-mode.
This commit is contained in:
parent
fdfc4642ad
commit
74615a5177
@ -111,6 +111,7 @@
|
|||||||
3) Copy the original material, add *_Outline* to its name and set the shader to your outline-only shader like `Universal Render Pipeline/Spine/Outline/Skeleton-OutlineOnly` or `Spine/Outline/OutlineOnly-ZWrite`.
|
3) Copy the original material, add *_Outline* to its name and set the shader to your outline-only shader like `Universal Render Pipeline/Spine/Outline/Skeleton-OutlineOnly` or `Spine/Outline/OutlineOnly-ZWrite`.
|
||||||
4) Assign this *_Outline* material at the new child GameObject's `MeshRenderer` component.
|
4) Assign this *_Outline* material at the new child GameObject's `MeshRenderer` component.
|
||||||
If you are using `SkeletonRenderSeparator` and need to enable and disable the `SkeletonRenderSeparator` component at runtime, you can increase the `RenderCombinedMesh` `Reference Renderers` array by one and assign the `SkeletonRenderer` itself at the last entry after the parts renderers. Disabled `MeshRenderer` components will be skipped when combining the final mesh, so the combined mesh is automatically filled from the desired active renderers.
|
If you are using `SkeletonRenderSeparator` and need to enable and disable the `SkeletonRenderSeparator` component at runtime, you can increase the `RenderCombinedMesh` `Reference Renderers` array by one and assign the `SkeletonRenderer` itself at the last entry after the parts renderers. Disabled `MeshRenderer` components will be skipped when combining the final mesh, so the combined mesh is automatically filled from the desired active renderers.
|
||||||
|
* Timeline extension package: Added static `EditorEvent` callback to allow editor scripts to react to animation events outside of play-mode. Register to the events via `Spine.Unity.Playables.SpineAnimationStateMixerBehaviour.EditorEvent += YourCallback;`.
|
||||||
|
|
||||||
* **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.
|
||||||
|
|||||||
@ -31,7 +31,9 @@
|
|||||||
#define SPEED_INCLUDED_IN_CLIP_TIME
|
#define SPEED_INCLUDED_IN_CLIP_TIME
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
#define SPINE_EDITMODEPOSE
|
#define SPINE_EDITMODEPOSE
|
||||||
|
#endif
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -250,8 +252,11 @@ namespace Spine.Unity.Playables {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if SPINE_EDITMODEPOSE
|
#if SPINE_EDITMODEPOSE
|
||||||
|
/// <summary>Animation event callback for editor scripts when outside of play-mode.</summary>
|
||||||
|
public static event AnimationState.TrackEntryEventDelegate EditorEvent;
|
||||||
|
|
||||||
AnimationState dummyAnimationState;
|
AnimationState dummyAnimationState;
|
||||||
|
ExposedList<Spine.Event> editorAnimationEvents = new ExposedList<Event>();
|
||||||
|
|
||||||
public void PreviewEditModePose (Playable playable,
|
public void PreviewEditModePose (Playable playable,
|
||||||
ISkeletonComponent skeletonComponent, IAnimationStateComponent animationStateComponent,
|
ISkeletonComponent skeletonComponent, IAnimationStateComponent animationStateComponent,
|
||||||
@ -259,6 +264,7 @@ namespace Spine.Unity.Playables {
|
|||||||
|
|
||||||
if (Application.isPlaying) return;
|
if (Application.isPlaying) return;
|
||||||
if (animationStateComponent.IsNullOrDestroyed() || skeletonComponent == null) return;
|
if (animationStateComponent.IsNullOrDestroyed() || skeletonComponent == null) return;
|
||||||
|
editorAnimationEvents.Clear(false);
|
||||||
|
|
||||||
int inputCount = playable.GetInputCount();
|
int inputCount = playable.GetInputCount();
|
||||||
float rootSpeed = GetRootPlayableSpeed(playable);
|
float rootSpeed = GetRootPlayableSpeed(playable);
|
||||||
@ -341,11 +347,19 @@ namespace Spine.Unity.Playables {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Apply Pose
|
// Apply Pose
|
||||||
|
dummyAnimationState.Event += EditorEvent;
|
||||||
dummyAnimationState.Update(0);
|
dummyAnimationState.Update(0);
|
||||||
dummyAnimationState.Apply(skeleton);
|
dummyAnimationState.Apply(skeleton);
|
||||||
|
dummyAnimationState.Event -= EditorEvent;
|
||||||
} else {
|
} else {
|
||||||
if (toAnimation != null)
|
if (toAnimation != null) {
|
||||||
toAnimation.Apply(skeleton, 0, toClipTime, clipData.loop, null, clipData.alpha, MixBlend.Setup, MixDirection.In);
|
toAnimation.Apply(skeleton, 0, toClipTime, clipData.loop, editorAnimationEvents, clipData.alpha, MixBlend.Setup, MixDirection.In);
|
||||||
|
if (EditorEvent != null) {
|
||||||
|
foreach (Spine.Event e in editorAnimationEvents) {
|
||||||
|
EditorEvent(null, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
skeleton.UpdateWorldTransform();
|
skeleton.UpdateWorldTransform();
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"name": "com.esotericsoftware.spine.timeline",
|
"name": "com.esotericsoftware.spine.timeline",
|
||||||
"displayName": "Spine Timeline Extensions",
|
"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.1.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)",
|
"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.1.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)",
|
||||||
"version": "4.1.12",
|
"version": "4.1.13",
|
||||||
"unity": "2018.3",
|
"unity": "2018.3",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Esoteric Software",
|
"name": "Esoteric Software",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user