mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +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 {
|
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
|
||||||
@ -1531,6 +1535,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) {
|
||||||
@ -1543,7 +1549,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 &&
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"name": "com.esotericsoftware.spine.spine-unity",
|
"name": "com.esotericsoftware.spine.spine-unity",
|
||||||
"displayName": "spine-unity Runtime",
|
"displayName": "spine-unity Runtime",
|
||||||
"description": "This plugin provides the spine-unity runtime core.",
|
"description": "This plugin provides the spine-unity runtime core.",
|
||||||
"version": "4.2.107",
|
"version": "4.2.108",
|
||||||
"unity": "2018.3",
|
"unity": "2018.3",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Esoteric Software",
|
"name": "Esoteric Software",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user