mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 07:14:55 +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
52faafc978
commit
38bc30cf54
@ -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
|
||||
@ -1550,6 +1554,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) {
|
||||
@ -1562,7 +1568,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 &&
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user