mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49: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
52faafc978
commit
38bc30cf54
@ -69,6 +69,10 @@ namespace Spine.Unity.Editor {
|
|||||||
public static class SkeletonBaker {
|
public static class SkeletonBaker {
|
||||||
|
|
||||||
const string SpineEventStringId = "SpineEvent";
|
const string SpineEventStringId = "SpineEvent";
|
||||||
|
public static UnityEngine.Object SpineEventObjectPlaceholder {
|
||||||
|
get { return SpineEditorUtilities.Icons.skeletonDataAssetIcon; }
|
||||||
|
}
|
||||||
|
|
||||||
const float EventTimeEqualityEpsilon = 0.01f;
|
const float EventTimeEqualityEpsilon = 0.01f;
|
||||||
|
|
||||||
#region SkeletonMecanim's Mecanim Clips
|
#region SkeletonMecanim's Mecanim Clips
|
||||||
@ -1550,6 +1554,8 @@ namespace Spine.Unity.Editor {
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(spineEvent.String)) {
|
if (!string.IsNullOrEmpty(spineEvent.String)) {
|
||||||
unityAnimationEvent.stringParameter = 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) {
|
} else if (spineEvent.Int != 0) {
|
||||||
unityAnimationEvent.intParameter = spineEvent.Int;
|
unityAnimationEvent.intParameter = spineEvent.Int;
|
||||||
} else if (spineEvent.Float != 0) {
|
} else if (spineEvent.Float != 0) {
|
||||||
@ -1562,7 +1568,8 @@ namespace Spine.Unity.Editor {
|
|||||||
|
|
||||||
static void AddPreviousUserEvents (ref List<AnimationEvent> allEvents, AnimationEvent[] previousEvents) {
|
static void AddPreviousUserEvents (ref List<AnimationEvent> allEvents, AnimationEvent[] previousEvents) {
|
||||||
foreach (AnimationEvent previousEvent in previousEvents) {
|
foreach (AnimationEvent previousEvent in previousEvents) {
|
||||||
if (previousEvent.stringParameter == SpineEventStringId)
|
if (previousEvent.stringParameter == SpineEventStringId ||
|
||||||
|
previousEvent.objectReferenceParameter == SpineEventObjectPlaceholder)
|
||||||
continue;
|
continue;
|
||||||
AnimationEvent identicalEvent = allEvents.Find(newEvent => {
|
AnimationEvent identicalEvent = allEvents.Find(newEvent => {
|
||||||
return newEvent.functionName == previousEvent.functionName &&
|
return newEvent.functionName == previousEvent.functionName &&
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user