Browse Source

[unity] Some cleanup and documentation.

pharan 9 years ago
parent
commit
e0ee7ce4f5

+ 1 - 1
spine-unity/Assets/spine-unity/Editor/BoneFollowerInspector.cs

@@ -64,8 +64,8 @@ namespace Spine.Unity.Editor {
 			if (skeletonRenderer.objectReferenceValue == null) {
 				SkeletonRenderer parentRenderer = BoneFollowerInspector.GetInParent<SkeletonRenderer>(targetBoneFollower.transform);
 				if (parentRenderer != null && parentRenderer.gameObject != targetBoneFollower.gameObject) {
-					Debug.Log("Inspector automatically assigned BoneFollower.SkeletonRenderer");
 					skeletonRenderer.objectReferenceValue = parentRenderer;
+					Debug.Log("Inspector automatically assigned BoneFollower.SkeletonRenderer");
 				}
 			}
 

+ 14 - 0
spine-unity/Assets/spine-unity/SkeletonAnimation.cs

@@ -45,16 +45,30 @@ namespace Spine.Unity {
 		public Spine.AnimationState state;
 		public Spine.AnimationState AnimationState { get { return this.state; } }
 
+		/// <summary>
+		/// Occurs after the animations are applied and before world space values are resolved.
+		/// Use this callback when you want to set bone local values.
+		/// </summary>
 		public event UpdateBonesDelegate UpdateLocal {
 			add { _UpdateLocal += value; }
 			remove { _UpdateLocal -= value; }
 		}
 
+		/// <summary>
+		/// Occurs after the Skeleton's bone world space values are resolved (including all constraints).
+		/// Using this callback will cause the world space values to be solved an extra time.
+		/// Use this callback if want to use bone world space values, and also set bone local values.
+		/// </summary>
 		public event UpdateBonesDelegate UpdateWorld {
 			add { _UpdateWorld += value; }
 			remove { _UpdateWorld -= value; }
 		}
 
+		/// <summary>
+		/// Occurs after the Skeleton's bone world space values are resolved (including all constraints).
+		/// Use this callback if you want to use bone world space values, but don't intend to modify bone local values.
+		/// This callback can also be used when setting world position and the bone matrix.
+		/// </summary>
 		public event UpdateBonesDelegate UpdateComplete {
 			add { _UpdateComplete += value; }
 			remove { _UpdateComplete -= value; }

+ 14 - 0
spine-unity/Assets/spine-unity/SkeletonAnimator.cs

@@ -14,16 +14,30 @@ namespace Spine.Unity {
 		public enum MixMode { AlwaysMix, MixNext, SpineStyle }
 		public MixMode[] layerMixModes = new MixMode[0];
 
+		/// <summary>
+		/// Occurs after the animations are applied and before world space values are resolved.
+		/// Use this callback when you want to set bone local values.
+		/// </summary>
 		public event UpdateBonesDelegate UpdateLocal {
 			add { _UpdateLocal += value; }
 			remove { _UpdateLocal -= value; }
 		}
 
+		/// <summary>
+		/// Occurs after the Skeleton's bone world space values are resolved (including all constraints).
+		/// Using this callback will cause the world space values to be solved an extra time.
+		/// Use this callback if want to use bone world space values, and also set bone local values.
+		/// </summary>
 		public event UpdateBonesDelegate UpdateWorld {
 			add { _UpdateWorld += value; }
 			remove { _UpdateWorld -= value; }
 		}
 
+		/// <summary>
+		/// Occurs after the Skeleton's bone world space values are resolved (including all constraints).
+		/// Use this callback if you want to use bone world space values, but don't intend to modify bone local values.
+		/// This callback can also be used when setting world position and the bone matrix.
+		/// </summary>
 		public event UpdateBonesDelegate UpdateComplete {
 			add { _UpdateComplete += value; }
 			remove { _UpdateComplete -= value; }

+ 4 - 9
spine-unity/Assets/spine-unity/SkeletonUtility/Editor/SkeletonUtilityInspector.cs

@@ -12,7 +12,6 @@ using UnityEditor;
 #else
 using UnityEditor.AnimatedValues;
 #endif
-using System.Collections;
 using System.Collections.Generic;
 using Spine;
 
@@ -111,12 +110,8 @@ namespace Spine.Unity.Editor {
 
 		void UpdateAttachments () {
 			attachmentTable = new Dictionary<Slot, List<Attachment>>();
-			Skin skin = skeleton.Skin;
-
-			if (skin == null) {
-				skin = skeletonRenderer.skeletonDataAsset.GetSkeletonData(true).DefaultSkin;
-			}
 
+			Skin skin = skeleton.Skin ?? skeletonRenderer.skeletonDataAsset.GetSkeletonData(true).DefaultSkin;
 			for (int i = skeleton.Slots.Count-1; i >= 0; i--) {
 				List<Attachment> attachments = new List<Attachment>();
 				skin.FindAttachmentsForSlot(i, attachments);
@@ -229,14 +224,14 @@ namespace Spine.Unity.Editor {
 						GUI.contentColor = Color.white;
 					}
 				}
-				#if UNITY_4_3
+			#if UNITY_4_3
 
-				#else
+			#else
 			}
 			EditorGUILayout.EndFadeGroup();
 			if (showSlots.isAnimating)
 				Repaint();
-				#endif
+			#endif
 		}
 
 		void SpawnHierarchyContextMenu () {