mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-28 12:41:25 +08:00
Merge branch '4.1' into 4.2-beta
This commit is contained in:
commit
f87e507cbd
@ -4071,7 +4071,21 @@ class RenderCommand {
|
|||||||
// is copied, so it doesn't matter that we free up the underlying memory on the next
|
// 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:
|
// render call. See the implementation of Vertices.raw() here:
|
||||||
// https://github.com/flutter/engine/blob/5c60785b802ad2c8b8899608d949342d5c624952/lib/ui/painting/vertices.cc#L21
|
// 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 {
|
} else {
|
||||||
// On the web, rendering is done through CanvasKit, which requires copies of the native data.
|
// On the web, rendering is done through CanvasKit, which requires copies of the native data.
|
||||||
final positionsCopy = Float32List.fromList(positions);
|
final positionsCopy = Float32List.fromList(positions);
|
||||||
|
|||||||
@ -695,6 +695,7 @@ static _spine_render_command *batch_commands(BlockAllocator &allocator, Vector<_
|
|||||||
_spine_render_command *cmd = i < commands.size() ? commands[i] : nullptr;
|
_spine_render_command *cmd = i < commands.size() ? commands[i] : nullptr;
|
||||||
if (cmd != nullptr && cmd->atlasPage == first->atlasPage &&
|
if (cmd != nullptr && cmd->atlasPage == first->atlasPage &&
|
||||||
cmd->blendMode == first->blendMode &&
|
cmd->blendMode == first->blendMode &&
|
||||||
|
cmd->colors[0] == first->colors[0] &&
|
||||||
numIndices + cmd->numIndices < 0xffff) {
|
numIndices + cmd->numIndices < 0xffff) {
|
||||||
numVertices += cmd->numVertices;
|
numVertices += cmd->numVertices;
|
||||||
numIndices += cmd->numIndices;
|
numIndices += cmd->numIndices;
|
||||||
|
|||||||
@ -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("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("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("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("get_volume"), &SpineEventData::get_volume);
|
||||||
ClassDB::bind_method(D_METHOD("set_volume", "v"), &SpineEventData::set_volume);
|
ClassDB::bind_method(D_METHOD("set_volume", "v"), &SpineEventData::set_volume);
|
||||||
ClassDB::bind_method(D_METHOD("get_balance"), &SpineEventData::get_balance);
|
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()));
|
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() {
|
float SpineEventData::get_volume() {
|
||||||
SPINE_CHECK(get_spine_object(), 0)
|
SPINE_CHECK(get_spine_object(), 0)
|
||||||
return get_spine_object()->getVolume();
|
return get_spine_object()->getVolume();
|
||||||
|
|||||||
@ -55,6 +55,10 @@ public:
|
|||||||
|
|
||||||
void set_string_value(const String &v);
|
void set_string_value(const String &v);
|
||||||
|
|
||||||
|
String get_audio_path();
|
||||||
|
|
||||||
|
void set_audio_path(const String &v);
|
||||||
|
|
||||||
float get_volume();
|
float get_volume();
|
||||||
|
|
||||||
void set_volume(float v);
|
void set_volume(float v);
|
||||||
|
|||||||
@ -52,7 +52,7 @@ typedef struct spSkeletonDrawable {
|
|||||||
|
|
||||||
SP_API spSkeletonDrawable *spSkeletonDrawable_create(spSkeletonData *skeletonData, spAnimationStateData *animationStateData);
|
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);
|
SP_API void spSkeletonDrawable_update(spSkeletonDrawable *self, float delta);
|
||||||
|
|
||||||
|
|||||||
@ -298,9 +298,9 @@ SkeletonData *USpineSkeletonDataAsset::GetSkeletonData(Atlas *Atlas) {
|
|||||||
void USpineSkeletonDataAsset::SetMixes(AnimationStateData *animationStateData) {
|
void USpineSkeletonDataAsset::SetMixes(AnimationStateData *animationStateData) {
|
||||||
for (auto &data : MixData) {
|
for (auto &data : MixData) {
|
||||||
if (!data.From.IsEmpty() && !data.To.IsEmpty()) {
|
if (!data.From.IsEmpty() && !data.To.IsEmpty()) {
|
||||||
const char *fromChar = TCHAR_TO_UTF8(*data.From);
|
std::string fromChar = TCHAR_TO_UTF8(*data.From);
|
||||||
const char *toChar = TCHAR_TO_UTF8(*data.To);
|
std::string toChar = TCHAR_TO_UTF8(*data.To);
|
||||||
animationStateData->setMix(fromChar, toChar, data.Mix);
|
animationStateData->setMix(fromChar.c_str(), toChar.c_str(), data.Mix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
animationStateData->setDefaultMix(DefaultMix);
|
animationStateData->setDefaultMix(DefaultMix);
|
||||||
|
|||||||
0
spine-ue4/setup.sh
Normal file → Executable file
0
spine-ue4/setup.sh
Normal file → Executable file
@ -253,6 +253,10 @@ namespace Spine.Unity {
|
|||||||
else
|
else
|
||||||
state.ApplyEventTimelinesOnly(skeleton, issueEvents: true);
|
state.ApplyEventTimelinesOnly(skeleton, issueEvents: true);
|
||||||
|
|
||||||
|
AfterAnimationApplied();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AfterAnimationApplied () {
|
||||||
if (_UpdateLocal != null)
|
if (_UpdateLocal != null)
|
||||||
_UpdateLocal(this);
|
_UpdateLocal(this);
|
||||||
|
|
||||||
|
|||||||
@ -387,6 +387,10 @@ namespace Spine.Unity {
|
|||||||
else
|
else
|
||||||
state.ApplyEventTimelinesOnly(skeleton, issueEvents: true);
|
state.ApplyEventTimelinesOnly(skeleton, issueEvents: true);
|
||||||
|
|
||||||
|
AfterAnimationApplied();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AfterAnimationApplied () {
|
||||||
if (UpdateLocal != null)
|
if (UpdateLocal != null)
|
||||||
UpdateLocal(this);
|
UpdateLocal(this);
|
||||||
|
|
||||||
|
|||||||
@ -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.12",
|
"version": "4.2.13",
|
||||||
"unity": "2018.3",
|
"unity": "2018.3",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Esoteric Software",
|
"name": "Esoteric Software",
|
||||||
|
|||||||
@ -332,11 +332,12 @@ namespace Spine.Unity.Playables {
|
|||||||
toAnimation.Apply(skeleton, 0, toClipTime, clipData.loop, null, clipData.alpha, MixBlend.Setup, MixDirection.In);
|
toAnimation.Apply(skeleton, 0, toClipTime, clipData.loop, null, clipData.alpha, MixBlend.Setup, MixDirection.In);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
skeleton.UpdateWorldTransform();
|
||||||
if (skeletonAnimation) {
|
if (skeletonAnimation) {
|
||||||
skeletonAnimation.Update(0);
|
skeletonAnimation.AfterAnimationApplied();
|
||||||
skeletonAnimation.LateUpdate();
|
skeletonAnimation.LateUpdate();
|
||||||
} else if (skeletonGraphic) {
|
} else if (skeletonGraphic) {
|
||||||
skeletonGraphic.Update(0);
|
skeletonGraphic.AfterAnimationApplied();
|
||||||
skeletonGraphic.LateUpdate();
|
skeletonGraphic.LateUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"name": "com.esotericsoftware.spine.timeline",
|
"name": "com.esotericsoftware.spine.timeline",
|
||||||
"displayName": "Spine Timeline Extensions",
|
"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)",
|
"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",
|
"unity": "2018.3",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Esoteric Software",
|
"name": "Esoteric Software",
|
||||||
@ -11,7 +11,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.unity.timeline": "1.2.10",
|
"com.unity.timeline": "1.2.10",
|
||||||
"com.esotericsoftware.spine.spine-unity": "4.2.11"
|
"com.esotericsoftware.spine.spine-unity": "4.2.13"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"spine",
|
"spine",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user