Jelajahi Sumber

Merge branch '3.7' of https://github.com/esotericsoftware/spine-runtimes into 3.7

badlogic 6 tahun lalu
induk
melakukan
125b999cae

+ 8 - 3
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java

@@ -1232,7 +1232,8 @@ public class AnimationState {
 		start, interrupt, end, dispose, complete, event
 		start, interrupt, end, dispose, complete, event
 	}
 	}
 
 
-	/** The interface to implement for receiving TrackEntry events.
+	/** The interface to implement for receiving TrackEntry events. It is always safe to call AnimationState methods when receiving
+	 * events.
 	 * <p>
 	 * <p>
 	 * See TrackEntry {@link TrackEntry#setListener(AnimationStateListener)} and AnimationState
 	 * See TrackEntry {@link TrackEntry#setListener(AnimationStateListener)} and AnimationState
 	 * {@link AnimationState#addListener(AnimationStateListener)}. */
 	 * {@link AnimationState#addListener(AnimationStateListener)}. */
@@ -1251,10 +1252,14 @@ public class AnimationState {
 		 * References to the entry should not be kept after <code>dispose</code> is called, as it may be destroyed or reused. */
 		 * References to the entry should not be kept after <code>dispose</code> is called, as it may be destroyed or reused. */
 		public void dispose (TrackEntry entry);
 		public void dispose (TrackEntry entry);
 
 
-		/** Invoked every time this entry's animation completes a loop. */
+		/** Invoked every time this entry's animation completes a loop. Because this event is trigged in
+		 * {@link AnimationState#apply(Skeleton)}, any animations set in response to the event won't be applied until the next time
+		 * the AnimationState is applied. */
 		public void complete (TrackEntry entry);
 		public void complete (TrackEntry entry);
 
 
-		/** Invoked when this entry's animation triggers an event. */
+		/** Invoked when this entry's animation triggers an event. Because this event is trigged in
+		 * {@link AnimationState#apply(Skeleton)}, any animations set in response to the event won't be applied until the next time
+		 * the AnimationState is applied. */
 		public void event (TrackEntry entry, Event event);
 		public void event (TrackEntry entry, Event event);
 	}
 	}
 
 

+ 4 - 2
spine-unity/Assets/Spine Examples/Scripts/MixAndMatch.cs

@@ -111,11 +111,13 @@ namespace Spine.Unity.Examples {
 			// To prevent fallback from happening, make sure the key is not defined in the default skin.
 			// To prevent fallback from happening, make sure the key is not defined in the default skin.
 
 
 			// STEP 3: APPLY AND CLEAN UP.
 			// STEP 3: APPLY AND CLEAN UP.
-			// Recommended: REPACK THE CUSTOM SKIN TO MINIMIZE DRAW CALLS
+			// Recommended, preferably at level-load-time: REPACK THE CUSTOM SKIN TO MINIMIZE DRAW CALLS
+			// 				IMPORTANT NOTE: the GetRepackedSkin() operation is expensive - if multiple characters
+			// 				need to call it every few seconds the overhead will outweigh the draw call benefits.
+			//
 			// 				Repacking requires that you set all source textures/sprites/atlases to be Read/Write enabled in the inspector.
 			// 				Repacking requires that you set all source textures/sprites/atlases to be Read/Write enabled in the inspector.
 			// 				Combine all the attachment sources into one skin. Usually this means the default skin and the custom skin.
 			// 				Combine all the attachment sources into one skin. Usually this means the default skin and the custom skin.
 			// 				call Skin.GetRepackedSkin to get a cloned skin with cloned attachments that all use one texture.
 			// 				call Skin.GetRepackedSkin to get a cloned skin with cloned attachments that all use one texture.
-			//				Under the hood, this relies on 
 			if (repack)	{
 			if (repack)	{
 				var repackedSkin = new Skin("repacked skin");
 				var repackedSkin = new Skin("repacked skin");
 				repackedSkin.AddAttachments(skeleton.Data.DefaultSkin); // Include the "default" skin. (everything outside of skin placeholders)
 				repackedSkin.AddAttachments(skeleton.Data.DefaultSkin); // Include the "default" skin. (everything outside of skin placeholders)

+ 2 - 2
spine-unity/Assets/Spine/Runtime/spine-unity/Modules/AttachmentTools/AttachmentTools.cs

@@ -482,14 +482,14 @@ namespace Spine.Unity.Modules.AttachmentTools {
 
 
 		/// <summary>
 		/// <summary>
 		/// Creates and populates a duplicate skin with cloned attachments that are backed by a new packed texture atlas comprised of all the regions from the original skin.</summary>
 		/// Creates and populates a duplicate skin with cloned attachments that are backed by a new packed texture atlas comprised of all the regions from the original skin.</summary>
-		/// <remarks>No Spine.Atlas object is created so there is no way to find AtlasRegions except through the Attachments using them.</remarks>
+		/// <remarks>GetRepackedSkin is an expensive operation, preferably call it at level load time. No Spine.Atlas object is created so there is no way to find AtlasRegions except through the Attachments using them.</remarks>
 		public static Skin GetRepackedSkin (this Skin o, string newName, Material materialPropertySource, out Material outputMaterial, out Texture2D outputTexture, int maxAtlasSize = 1024, int padding = 2, TextureFormat textureFormat = SpineTextureFormat, bool mipmaps = UseMipMaps, bool useOriginalNonrenderables = true) {
 		public static Skin GetRepackedSkin (this Skin o, string newName, Material materialPropertySource, out Material outputMaterial, out Texture2D outputTexture, int maxAtlasSize = 1024, int padding = 2, TextureFormat textureFormat = SpineTextureFormat, bool mipmaps = UseMipMaps, bool useOriginalNonrenderables = true) {
 			return GetRepackedSkin(o, newName, materialPropertySource.shader, out outputMaterial, out outputTexture, maxAtlasSize, padding, textureFormat, mipmaps, materialPropertySource, useOriginalNonrenderables);
 			return GetRepackedSkin(o, newName, materialPropertySource.shader, out outputMaterial, out outputTexture, maxAtlasSize, padding, textureFormat, mipmaps, materialPropertySource, useOriginalNonrenderables);
 		}
 		}
 
 
 		/// <summary>
 		/// <summary>
 		/// Creates and populates a duplicate skin with cloned attachments that are backed by a new packed texture atlas comprised of all the regions from the original skin.</summary>
 		/// Creates and populates a duplicate skin with cloned attachments that are backed by a new packed texture atlas comprised of all the regions from the original skin.</summary>
-		/// <remarks>No Spine.Atlas object is created so there is no way to find AtlasRegions except through the Attachments using them.</remarks>
+		/// <remarks>GetRepackedSkin is an expensive operation, preferably call it at level load time. No Spine.Atlas object is created so there is no way to find AtlasRegions except through the Attachments using them.</remarks>
 		public static Skin GetRepackedSkin (this Skin o, string newName, Shader shader, out Material outputMaterial, out Texture2D outputTexture, int maxAtlasSize = 1024, int padding = 2, TextureFormat textureFormat = SpineTextureFormat, bool mipmaps = UseMipMaps, Material materialPropertySource = null, bool clearCache = false, bool useOriginalNonrenderables = true) {
 		public static Skin GetRepackedSkin (this Skin o, string newName, Shader shader, out Material outputMaterial, out Texture2D outputTexture, int maxAtlasSize = 1024, int padding = 2, TextureFormat textureFormat = SpineTextureFormat, bool mipmaps = UseMipMaps, Material materialPropertySource = null, bool clearCache = false, bool useOriginalNonrenderables = true) {
 			if (o == null) throw new System.NullReferenceException("Skin was null");
 			if (o == null) throw new System.NullReferenceException("Skin was null");
 			var skinAttachments = o.Attachments;
 			var skinAttachments = o.Attachments;