Browse Source

Minor SkeletonExtensions update.

pharan 9 years ago
parent
commit
ec268a50e0
1 changed files with 10 additions and 3 deletions
  1. 10 3
      spine-unity/Assets/spine-unity/SkeletonExtensions.cs

+ 10 - 3
spine-unity/Assets/spine-unity/SkeletonExtensions.cs

@@ -1,5 +1,3 @@
-
-
 /*****************************************************************************
  * Spine Extensions by Mitch Thompson and John Dy
  * Full irrevocable rights and permissions granted to Esoteric Software
@@ -7,7 +5,6 @@
 
 using UnityEngine;
 using Spine;
-using Spine.Unity;
 
 namespace Spine.Unity {
 	public static class SkeletonExtensions {
@@ -125,6 +122,16 @@ namespace Spine.Unity {
 			if (animation == null) return;
 			animation.Apply(skeleton, 0, time, loop, null);
 		}
+
+		/// <summary>Resets the DrawOrder to the Setup Pose's draw order</summary>
+		public static void SetDrawOrderToSetupPose (this Skeleton skeleton) {
+			var slotsItems = skeleton.slots.Items;
+			var drawOrder = skeleton.drawOrder;
+
+			drawOrder.Clear(false);
+			for (int i = 0, n = skeleton.slots.Count; i < n; i++)
+				drawOrder.Add(slotsItems[i]);
+		}
 		#endregion
 	}
 }