From e0ee7ce4f5dac864bf5556a0146681fbf673f6b5 Mon Sep 17 00:00:00 2001 From: pharan Date: Mon, 29 Aug 2016 17:17:56 +0800 Subject: [PATCH] [unity] Some cleanup and documentation. --- .../spine-unity/Editor/BoneFollowerInspector.cs | 2 +- .../Assets/spine-unity/SkeletonAnimation.cs | 14 ++++++++++++++ spine-unity/Assets/spine-unity/SkeletonAnimator.cs | 14 ++++++++++++++ .../Editor/SkeletonUtilityInspector.cs | 13 ++++--------- 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/spine-unity/Assets/spine-unity/Editor/BoneFollowerInspector.cs b/spine-unity/Assets/spine-unity/Editor/BoneFollowerInspector.cs index 534d0510f..e4e367217 100644 --- a/spine-unity/Assets/spine-unity/Editor/BoneFollowerInspector.cs +++ b/spine-unity/Assets/spine-unity/Editor/BoneFollowerInspector.cs @@ -64,8 +64,8 @@ namespace Spine.Unity.Editor { if (skeletonRenderer.objectReferenceValue == null) { SkeletonRenderer parentRenderer = BoneFollowerInspector.GetInParent(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"); } } diff --git a/spine-unity/Assets/spine-unity/SkeletonAnimation.cs b/spine-unity/Assets/spine-unity/SkeletonAnimation.cs index 7fdf243b2..623b3c106 100644 --- a/spine-unity/Assets/spine-unity/SkeletonAnimation.cs +++ b/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; } } + /// + /// Occurs after the animations are applied and before world space values are resolved. + /// Use this callback when you want to set bone local values. + /// public event UpdateBonesDelegate UpdateLocal { add { _UpdateLocal += value; } remove { _UpdateLocal -= value; } } + /// + /// 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. + /// public event UpdateBonesDelegate UpdateWorld { add { _UpdateWorld += value; } remove { _UpdateWorld -= value; } } + /// + /// 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. + /// public event UpdateBonesDelegate UpdateComplete { add { _UpdateComplete += value; } remove { _UpdateComplete -= value; } diff --git a/spine-unity/Assets/spine-unity/SkeletonAnimator.cs b/spine-unity/Assets/spine-unity/SkeletonAnimator.cs index d84482081..b1dbad6d6 100644 --- a/spine-unity/Assets/spine-unity/SkeletonAnimator.cs +++ b/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]; + /// + /// Occurs after the animations are applied and before world space values are resolved. + /// Use this callback when you want to set bone local values. + /// public event UpdateBonesDelegate UpdateLocal { add { _UpdateLocal += value; } remove { _UpdateLocal -= value; } } + /// + /// 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. + /// public event UpdateBonesDelegate UpdateWorld { add { _UpdateWorld += value; } remove { _UpdateWorld -= value; } } + /// + /// 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. + /// public event UpdateBonesDelegate UpdateComplete { add { _UpdateComplete += value; } remove { _UpdateComplete -= value; } diff --git a/spine-unity/Assets/spine-unity/SkeletonUtility/Editor/SkeletonUtilityInspector.cs b/spine-unity/Assets/spine-unity/SkeletonUtility/Editor/SkeletonUtilityInspector.cs index 3506fb2b3..385077961 100644 --- a/spine-unity/Assets/spine-unity/SkeletonUtility/Editor/SkeletonUtilityInspector.cs +++ b/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>(); - 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 attachments = new List(); 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 () {