Эх сурвалжийг харах

Merge branch '4.1' into 4.2-beta

Harald Csaszar 2 жил өмнө
parent
commit
f87e507cbd

+ 15 - 1
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);

+ 1 - 0
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;

+ 12 - 0
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();

+ 4 - 0
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);

+ 1 - 1
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);
 

+ 3 - 3
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);

+ 4 - 0
spine-ue4/setup.sh

@@ -253,6 +253,10 @@ namespace Spine.Unity {
 			else
 				state.ApplyEventTimelinesOnly(skeleton, issueEvents: true);
 
+			AfterAnimationApplied();
+		}
+
+		public void AfterAnimationApplied () {
 			if (_UpdateLocal != null)
 				_UpdateLocal(this);
 

+ 4 - 0
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);
 

+ 1 - 1
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",

+ 3 - 2
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();
 				}
 			}

+ 2 - 2
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",