mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 09:16:01 +08:00
[unity] Keep manually placed AnimationClip Events when updating skeleton assets (Mecanim) even when string param used. See #1838.
This commit is contained in:
parent
1297228f91
commit
e103d4494f
@ -69,6 +69,10 @@ namespace Spine.Unity.Editor {
|
||||
public static class SkeletonBaker {
|
||||
|
||||
const string SpineEventStringId = "SpineEvent";
|
||||
public static UnityEngine.Object SpineEventObjectPlaceholder {
|
||||
get { return SpineEditorUtilities.Icons.skeletonDataAssetIcon; }
|
||||
}
|
||||
|
||||
const float EventTimeEqualityEpsilon = 0.01f;
|
||||
|
||||
#region SkeletonMecanim's Mecanim Clips
|
||||
@ -1531,6 +1535,8 @@ namespace Spine.Unity.Editor {
|
||||
|
||||
if (!string.IsNullOrEmpty(spineEvent.String)) {
|
||||
unityAnimationEvent.stringParameter = spineEvent.String;
|
||||
// if string (separate from name) is set in event, fallback to objectReferenceParameter.
|
||||
unityAnimationEvent.objectReferenceParameter = SpineEventObjectPlaceholder;
|
||||
} else if (spineEvent.Int != 0) {
|
||||
unityAnimationEvent.intParameter = spineEvent.Int;
|
||||
} else if (spineEvent.Float != 0) {
|
||||
@ -1543,7 +1549,8 @@ namespace Spine.Unity.Editor {
|
||||
|
||||
static void AddPreviousUserEvents (ref List<AnimationEvent> allEvents, AnimationEvent[] previousEvents) {
|
||||
foreach (AnimationEvent previousEvent in previousEvents) {
|
||||
if (previousEvent.stringParameter == SpineEventStringId)
|
||||
if (previousEvent.stringParameter == SpineEventStringId ||
|
||||
previousEvent.objectReferenceParameter == SpineEventObjectPlaceholder)
|
||||
continue;
|
||||
AnimationEvent identicalEvent = allEvents.Find(newEvent => {
|
||||
return newEvent.functionName == previousEvent.functionName &&
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"name": "com.esotericsoftware.spine.spine-unity",
|
||||
"displayName": "spine-unity Runtime",
|
||||
"description": "This plugin provides the spine-unity runtime core.",
|
||||
"version": "4.2.107",
|
||||
"version": "4.2.108",
|
||||
"unity": "2018.3",
|
||||
"author": {
|
||||
"name": "Esoteric Software",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user