Skip to content

Commit

Permalink
Merge branch '4.1' into 4.2-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
HaraldCsaszar committed Jun 9, 2023
2 parents bb6cf11 + 2d9bdb0 commit f87e507
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 10 deletions.
16 changes: 15 additions & 1 deletion spine-flutter/lib/spine_flutter.dart
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions spine-flutter/src/spine_flutter.cpp
Expand Up @@ -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;
Expand Down
12 changes: 12 additions & 0 deletions spine-godot/spine_godot/SpineEventData.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 4 additions & 0 deletions spine-godot/spine_godot/SpineEventData.h
Expand Up @@ -55,6 +55,10 @@ class SpineEventData : public SpineSkeletonDataResourceOwnedObject<spine::EventD

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);
Expand Down
2 changes: 1 addition & 1 deletion spine-sdl/src/spine-sdl-c.h
Expand Up @@ -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);

Expand Down
Expand Up @@ -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);
Expand Down
Empty file modified spine-ue4/setup.sh 100644 → 100755
Empty file.
Expand Up @@ -253,6 +253,10 @@ public class SkeletonAnimation : SkeletonRenderer, ISkeletonAnimation, IAnimatio
else
state.ApplyEventTimelinesOnly(skeleton, issueEvents: true);

AfterAnimationApplied();
}

public void AfterAnimationApplied () {
if (_UpdateLocal != null)
_UpdateLocal(this);

Expand Down
Expand Up @@ -387,6 +387,10 @@ public enum LayoutMode {
else
state.ApplyEventTimelinesOnly(skeleton, issueEvents: true);

AfterAnimationApplied();
}

public void AfterAnimationApplied () {
if (UpdateLocal != null)
UpdateLocal(this);

Expand Down
2 changes: 1 addition & 1 deletion spine-unity/Assets/Spine/package.json
Expand Up @@ -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",
Expand Down
Expand Up @@ -332,11 +332,12 @@ ScriptPlayable<SpineAnimationStateBehaviour>[] startingClips
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();
}
}
Expand Down
Expand Up @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit f87e507

Please sign in to comment.