diff --git a/spine-flutter/lib/spine_flutter.dart b/spine-flutter/lib/spine_flutter.dart index 469dc143e..dc39188cb 100644 --- a/spine-flutter/lib/spine_flutter.dart +++ b/spine-flutter/lib/spine_flutter.dart @@ -4071,7 +4071,21 @@ class RenderCommand { // is copied, so it doesn't matter that we free up the underlying memory on the next // render call. See the implementation of Vertices.raw() here: // https://github.com/flutter/engine/blob/5c60785b802ad2c8b8899608d949342d5c624952/lib/ui/painting/vertices.cc#L21 - vertices = Vertices.raw(VertexMode.triangles, positions, textureCoordinates: uvs, colors: colors, indices: indices); + // + // Impeller is currently using a slow path when using vertex colors. + // See https://github.com/flutter/flutter/issues/127486 + // + // We thus batch all meshes not only by atlas page and blend mode, but also vertex color. + // See spine_flutter.cpp, batch_commands(). + // + // If the vertex color equals (1, 1, 1, 1), we do not store + // colors, which will trigger the fast path in Impeller. Otherwise we have to go the slow path, which + // has to render to an offscreen surface. + if (colors.isNotEmpty && colors[0] == -1) { + vertices = Vertices.raw(VertexMode.triangles, positions, textureCoordinates: uvs, indices: indices); + } else { + vertices = Vertices.raw(VertexMode.triangles, positions, textureCoordinates: uvs, colors: colors, indices: indices); + } } else { // On the web, rendering is done through CanvasKit, which requires copies of the native data. final positionsCopy = Float32List.fromList(positions); diff --git a/spine-flutter/src/spine_flutter.cpp b/spine-flutter/src/spine_flutter.cpp index a970f6437..dfd3b8fea 100644 --- a/spine-flutter/src/spine_flutter.cpp +++ b/spine-flutter/src/spine_flutter.cpp @@ -695,6 +695,7 @@ static _spine_render_command *batch_commands(BlockAllocator &allocator, Vector<_ _spine_render_command *cmd = i < commands.size() ? commands[i] : nullptr; if (cmd != nullptr && cmd->atlasPage == first->atlasPage && cmd->blendMode == first->blendMode && + cmd->colors[0] == first->colors[0] && numIndices + cmd->numIndices < 0xffff) { numVertices += cmd->numVertices; numIndices += cmd->numIndices; diff --git a/spine-godot/spine_godot/SpineEventData.cpp b/spine-godot/spine_godot/SpineEventData.cpp index 9142809d1..55e5f9b8e 100644 --- a/spine-godot/spine_godot/SpineEventData.cpp +++ b/spine-godot/spine_godot/SpineEventData.cpp @@ -38,6 +38,8 @@ void SpineEventData::_bind_methods() { ClassDB::bind_method(D_METHOD("set_float_value", "v"), &SpineEventData::set_float_value); ClassDB::bind_method(D_METHOD("get_string_value"), &SpineEventData::get_string_value); ClassDB::bind_method(D_METHOD("set_string_value", "v"), &SpineEventData::set_string_value); + ClassDB::bind_method(D_METHOD("get_audio_path"), &SpineEventData::get_audio_path); + ClassDB::bind_method(D_METHOD("set_audio_path", "v"), &SpineEventData::set_audio_path); ClassDB::bind_method(D_METHOD("get_volume"), &SpineEventData::get_volume); ClassDB::bind_method(D_METHOD("set_volume", "v"), &SpineEventData::set_volume); ClassDB::bind_method(D_METHOD("get_balance"), &SpineEventData::get_balance); @@ -79,6 +81,16 @@ void SpineEventData::set_string_value(const String &v) { get_spine_object()->setStringValue(spine::String(v.utf8())); } +String SpineEventData::get_audio_path() { + SPINE_CHECK(get_spine_object(), "") + return get_spine_object()->getAudioPath().buffer(); +} + +void SpineEventData::set_audio_path(const String &v) { + SPINE_CHECK(get_spine_object(), ) + get_spine_object()->setAudioPath(spine::String(v.utf8())); +} + float SpineEventData::get_volume() { SPINE_CHECK(get_spine_object(), 0) return get_spine_object()->getVolume(); diff --git a/spine-godot/spine_godot/SpineEventData.h b/spine-godot/spine_godot/SpineEventData.h index b6bd18053..a515f9dde 100644 --- a/spine-godot/spine_godot/SpineEventData.h +++ b/spine-godot/spine_godot/SpineEventData.h @@ -55,6 +55,10 @@ public: void set_string_value(const String &v); + String get_audio_path(); + + void set_audio_path(const String &v); + float get_volume(); void set_volume(float v); diff --git a/spine-sdl/src/spine-sdl-c.h b/spine-sdl/src/spine-sdl-c.h index 7d48cca66..a0b058b71 100644 --- a/spine-sdl/src/spine-sdl-c.h +++ b/spine-sdl/src/spine-sdl-c.h @@ -52,7 +52,7 @@ typedef struct spSkeletonDrawable { SP_API spSkeletonDrawable *spSkeletonDrawable_create(spSkeletonData *skeletonData, spAnimationStateData *animationStateData); -SP_API void spSkeletonDrawable_destroy(spSkeletonDrawable *self); +SP_API void spSkeletonDrawable_dispose(spSkeletonDrawable *self); SP_API void spSkeletonDrawable_update(spSkeletonDrawable *self, float delta); diff --git a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonDataAsset.cpp b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonDataAsset.cpp index cb7dd2f50..7d7652d6f 100644 --- a/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonDataAsset.cpp +++ b/spine-ue4/Plugins/SpinePlugin/Source/SpinePlugin/Private/SpineSkeletonDataAsset.cpp @@ -298,9 +298,9 @@ SkeletonData *USpineSkeletonDataAsset::GetSkeletonData(Atlas *Atlas) { void USpineSkeletonDataAsset::SetMixes(AnimationStateData *animationStateData) { for (auto &data : MixData) { if (!data.From.IsEmpty() && !data.To.IsEmpty()) { - const char *fromChar = TCHAR_TO_UTF8(*data.From); - const char *toChar = TCHAR_TO_UTF8(*data.To); - animationStateData->setMix(fromChar, toChar, data.Mix); + std::string fromChar = TCHAR_TO_UTF8(*data.From); + std::string toChar = TCHAR_TO_UTF8(*data.To); + animationStateData->setMix(fromChar.c_str(), toChar.c_str(), data.Mix); } } animationStateData->setDefaultMix(DefaultMix); diff --git a/spine-ue4/setup.sh b/spine-ue4/setup.sh old mode 100644 new mode 100755 diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonAnimation.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonAnimation.cs index 144285421..62cb69696 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonAnimation.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonAnimation.cs @@ -253,6 +253,10 @@ namespace Spine.Unity { else state.ApplyEventTimelinesOnly(skeleton, issueEvents: true); + AfterAnimationApplied(); + } + + public void AfterAnimationApplied () { if (_UpdateLocal != null) _UpdateLocal(this); diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs index 9efa7e9cc..dee7bf448 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs @@ -387,6 +387,10 @@ namespace Spine.Unity { else state.ApplyEventTimelinesOnly(skeleton, issueEvents: true); + AfterAnimationApplied(); + } + + public void AfterAnimationApplied () { if (UpdateLocal != null) UpdateLocal(this); diff --git a/spine-unity/Assets/Spine/package.json b/spine-unity/Assets/Spine/package.json index c93bcf373..1eabd0e81 100644 --- a/spine-unity/Assets/Spine/package.json +++ b/spine-unity/Assets/Spine/package.json @@ -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.12", + "version": "4.2.13", "unity": "2018.3", "author": { "name": "Esoteric Software", diff --git a/spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateMixerBehaviour.cs b/spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateMixerBehaviour.cs index f77bddf8b..fbdaf8c5c 100644 --- a/spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateMixerBehaviour.cs +++ b/spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateMixerBehaviour.cs @@ -332,11 +332,12 @@ namespace Spine.Unity.Playables { toAnimation.Apply(skeleton, 0, toClipTime, clipData.loop, null, clipData.alpha, MixBlend.Setup, MixDirection.In); } + skeleton.UpdateWorldTransform(); if (skeletonAnimation) { - skeletonAnimation.Update(0); + skeletonAnimation.AfterAnimationApplied(); skeletonAnimation.LateUpdate(); } else if (skeletonGraphic) { - skeletonGraphic.Update(0); + skeletonGraphic.AfterAnimationApplied(); skeletonGraphic.LateUpdate(); } } diff --git a/spine-unity/Modules/com.esotericsoftware.spine.timeline/package.json b/spine-unity/Modules/com.esotericsoftware.spine.timeline/package.json index 8e24ed5e3..451c646d9 100644 --- a/spine-unity/Modules/com.esotericsoftware.spine.timeline/package.json +++ b/spine-unity/Modules/com.esotericsoftware.spine.timeline/package.json @@ -2,7 +2,7 @@ "name": "com.esotericsoftware.spine.timeline", "displayName": "Spine Timeline Extensions", "description": "This plugin provides integration of spine-unity for the Unity Timeline.\n\nPrerequisites:\nIt requires a working installation of the spine-unity and spine-csharp runtimes as UPM packages (not as spine-unity unitypackage), version 4.2.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)", - "version": "4.2.7", + "version": "4.2.8", "unity": "2018.3", "author": { "name": "Esoteric Software", @@ -11,7 +11,7 @@ }, "dependencies": { "com.unity.timeline": "1.2.10", - "com.esotericsoftware.spine.spine-unity": "4.2.11" + "com.esotericsoftware.spine.spine-unity": "4.2.13" }, "keywords": [ "spine",