From 0d6dbc15c8af9118be5d17616ddd635f0b73ea06 Mon Sep 17 00:00:00 2001 From: John Date: Fri, 1 Jun 2018 19:01:21 +0800 Subject: [PATCH 1/5] [csharp] Fix events firing during mix out. --- spine-csharp/src/AnimationState.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spine-csharp/src/AnimationState.cs b/spine-csharp/src/AnimationState.cs index b27658113..5ae88149d 100644 --- a/spine-csharp/src/AnimationState.cs +++ b/spine-csharp/src/AnimationState.cs @@ -138,6 +138,9 @@ namespace Spine { bool finished = UpdateMixingFrom(from, delta); + from.animationLast = from.nextAnimationLast; + from.trackLast = from.nextTrackLast; + // Require mixTime > 0 to ensure the mixing from entry was applied at least once. if (to.mixTime > 0 && (to.mixTime >= to.mixDuration || to.timeScale == 0)) { // Require totalAlpha == 0 to ensure mixing is complete, unless mixDuration == 0 (the transition is a single frame). @@ -149,8 +152,6 @@ namespace Spine { return finished; } - from.animationLast = from.nextAnimationLast; - from.trackLast = from.nextTrackLast; from.trackTime += delta * from.timeScale; to.mixTime += delta * to.timeScale; return false; From 395e71c09800b2ad137c3bfafeae5262637b84a9 Mon Sep 17 00:00:00 2001 From: Nathan Sweet Date: Tue, 5 Jun 2018 14:03:21 +0200 Subject: [PATCH 2/5] Update LICENSE --- spine-libgdx/LICENSE | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spine-libgdx/LICENSE b/spine-libgdx/LICENSE index daceab94a..1f6d3bc57 100644 --- a/spine-libgdx/LICENSE +++ b/spine-libgdx/LICENSE @@ -1,6 +1,6 @@ Spine Runtimes Software License v2.5 -Copyright (c) 2013-2016, Esoteric Software +Copyright (c) 2013-2018, Esoteric Software All rights reserved. You are granted a perpetual, non-exclusive, non-sublicensable, and @@ -24,4 +24,4 @@ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file +POSSIBILITY OF SUCH DAMAGE. From 0d829a7ba2483bfbaea6ffcddad9416e498c7f81 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 7 Jun 2018 20:07:27 +0800 Subject: [PATCH 3/5] [unity] Handle MeshRendererBuffers reinitialize. --- .../Assets/spine-unity/Mesh Generation/SpineMesh.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/spine-unity/Assets/spine-unity/Mesh Generation/SpineMesh.cs b/spine-unity/Assets/spine-unity/Mesh Generation/SpineMesh.cs index c85cdde3a..5a43436f4 100644 --- a/spine-unity/Assets/spine-unity/Mesh Generation/SpineMesh.cs +++ b/spine-unity/Assets/spine-unity/Mesh Generation/SpineMesh.cs @@ -1284,7 +1284,13 @@ namespace Spine.Unity { internal Material[] sharedMaterials = new Material[0]; public void Initialize () { - doubleBufferedMesh = new DoubleBuffered(); + if (doubleBufferedMesh != null) { + doubleBufferedMesh.GetNext().Clear(); + doubleBufferedMesh.GetNext().Clear(); + submeshMaterials.Clear(); + } else { + doubleBufferedMesh = new DoubleBuffered(); + } } public Material[] GetUpdatedSharedMaterialsArray () { @@ -1343,6 +1349,11 @@ namespace Spine.Unity { public Mesh mesh = SpineMesh.NewSkeletonMesh(); public SkeletonRendererInstruction instructionUsed = new SkeletonRendererInstruction(); + public void Clear () { + mesh.Clear(); + instructionUsed.Clear(); + } + public void Dispose () { if (mesh != null) { #if UNITY_EDITOR From 35703dbce97647681219cb80ad5c3122db0295dc Mon Sep 17 00:00:00 2001 From: KITAGAWA Yasutaka Date: Thu, 7 Jun 2018 23:42:33 +0900 Subject: [PATCH 4/5] fix loading multi page atlas (#1124) --- spine-ts/widget/src/Widget.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spine-ts/widget/src/Widget.ts b/spine-ts/widget/src/Widget.ts index 6a1dd172d..d5a477bbb 100644 --- a/spine-ts/widget/src/Widget.ts +++ b/spine-ts/widget/src/Widget.ts @@ -102,7 +102,7 @@ module spine { } else { for (let i = 0; i < config.atlasPages.length; i++) { if (config.atlasPagesContent && config.atlasPagesContent[i]) { - assets.loadTextureData(config.atlasPages[i], config.atlasPagesContent[0]); + assets.loadTextureData(config.atlasPages[i], config.atlasPagesContent[i]); } else { assets.loadTexture(config.atlasPages[i]); } From cab81276263890b65d07fa2329ace16db1e365ff Mon Sep 17 00:00:00 2001 From: Ievgen Mukhin Date: Thu, 7 Jun 2018 17:43:41 +0300 Subject: [PATCH 5/5] [c] Optimized attachment lookup in skin. See #1117. (#1118) * [c] Optimized attachment lookup in skin. See #1117. * [c] Optimized attachment lookup in skin. See #1117. Changes according to suggestions in PR #1118. --- spine-c/spine-c/include/spine/Skin.h | 12 +++++++- spine-c/spine-c/src/spine/Skin.c | 42 +++++++++++++++++++++++++--- 2 files changed, 49 insertions(+), 5 deletions(-) diff --git a/spine-c/spine-c/include/spine/Skin.h b/spine-c/spine-c/include/spine/Skin.h index 806cde877..3b3f8b249 100644 --- a/spine-c/spine-c/include/spine/Skin.h +++ b/spine-c/spine-c/include/spine/Skin.h @@ -38,6 +38,9 @@ extern "C" { #endif +/* Size of hashtable used in skin structure for fast attachment lookup. */ +#define SKIN_ENTRIES_HASH_TABLE_SIZE 100 + struct spSkeleton; typedef struct spSkin { @@ -59,9 +62,16 @@ struct _Entry { _Entry* next; }; +typedef struct _SkinHashTableEntry _SkinHashTableEntry; +struct _SkinHashTableEntry { + _Entry* entry; + _SkinHashTableEntry* next; /* list for elements with same hashes */ +}; + typedef struct { spSkin super; - _Entry* entries; + _Entry* entries; /* entries list stored for getting attachment name by attachment index */ + _SkinHashTableEntry* entriesHashTable[SKIN_ENTRIES_HASH_TABLE_SIZE]; /* hashtable for fast attachment lookup */ } _spSkin; SP_API spSkin* spSkin_create (const char* name); diff --git a/spine-c/spine-c/src/spine/Skin.c b/spine-c/spine-c/src/spine/Skin.c index 91f2d21fe..e222babbc 100644 --- a/spine-c/spine-c/src/spine/Skin.c +++ b/spine-c/spine-c/src/spine/Skin.c @@ -45,6 +45,16 @@ void _Entry_dispose (_Entry* self) { FREE(self); } +static _SkinHashTableEntry* _SkinHashTableEntry_create (_Entry* entry) { + _SkinHashTableEntry* self = NEW(_SkinHashTableEntry); + self->entry = entry; + return self; +} + +static void _SkinHashTableEntry_dispose (_SkinHashTableEntry* self) { + FREE(self); +} + /**/ spSkin* spSkin_create (const char* name) { @@ -55,12 +65,28 @@ spSkin* spSkin_create (const char* name) { void spSkin_dispose (spSkin* self) { _Entry* entry = SUB_CAST(_spSkin, self)->entries; + while (entry) { _Entry* nextEntry = entry->next; _Entry_dispose(entry); entry = nextEntry; } + { + _SkinHashTableEntry** currentHashtableEntry = SUB_CAST(_spSkin, self)->entriesHashTable; + int i; + + for (i = 0; i < SKIN_ENTRIES_HASH_TABLE_SIZE; ++i, ++currentHashtableEntry) { + _SkinHashTableEntry* hashtableEntry = *currentHashtableEntry; + + while (hashtableEntry) { + _SkinHashTableEntry* nextEntry = hashtableEntry->next; + _SkinHashTableEntry_dispose(hashtableEntry); + hashtableEntry = nextEntry; + } + } + } + FREE(self->name); FREE(self); } @@ -69,13 +95,21 @@ void spSkin_addAttachment (spSkin* self, int slotIndex, const char* name, spAtta _Entry* newEntry = _Entry_create(slotIndex, name, attachment); newEntry->next = SUB_CAST(_spSkin, self)->entries; SUB_CAST(_spSkin, self)->entries = newEntry; + + { + unsigned int hashTableIndex = (unsigned int)slotIndex % SKIN_ENTRIES_HASH_TABLE_SIZE; + + _SkinHashTableEntry* newHashEntry = _SkinHashTableEntry_create(newEntry); + newHashEntry->next = SUB_CAST(_spSkin, self)->entriesHashTable[hashTableIndex]; + SUB_CAST(_spSkin, self)->entriesHashTable[hashTableIndex] = newHashEntry; + } } spAttachment* spSkin_getAttachment (const spSkin* self, int slotIndex, const char* name) { - const _Entry* entry = SUB_CAST(_spSkin, self)->entries; - while (entry) { - if (entry->slotIndex == slotIndex && strcmp(entry->name, name) == 0) return entry->attachment; - entry = entry->next; + const _SkinHashTableEntry* hashEntry = SUB_CAST(_spSkin, self)->entriesHashTable[(unsigned int)slotIndex % SKIN_ENTRIES_HASH_TABLE_SIZE]; + while (hashEntry) { + if (hashEntry->entry->slotIndex == slotIndex && strcmp(hashEntry->entry->name, name) == 0) return hashEntry->entry->attachment; + hashEntry = hashEntry->next; } return 0; }