diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/SpineAttributes.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/SpineAttributes.cs index acb5b5ec0..c6bf39d8e 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/SpineAttributes.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/SpineAttributes.cs @@ -28,8 +28,6 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -// Contributed by: Mitch Thompson - using UnityEngine; using System; using System.Collections; @@ -44,6 +42,34 @@ namespace Spine.Unity { public bool fallbackToTextField = false; } + public class SpineBone : SpineAttributeBase { + /// + /// Smart popup menu for Spine Bones + /// + /// Filters popup results to elements that begin with supplied string. + /// If true, the dropdown list will include a "none" option which stored as an empty string. + /// If true, and an animation list source can't be found, the field will fall back to a normal text field. If false, it will show an error. + /// If specified, a locally scoped field with the name supplied by in dataField will be used to fill the popup results. + /// Valid types are SkeletonDataAsset and SkeletonRenderer (and derivatives) + /// If left empty and the script the attribute is applied to is derived from Component, GetComponent() will be called as a fallback. + /// + public SpineBone (string startsWith = "", string dataField = "", bool includeNone = true, bool fallbackToTextField = false) { + this.startsWith = startsWith; + this.dataField = dataField; + this.includeNone = includeNone; + this.fallbackToTextField = fallbackToTextField; + } + + public static Spine.Bone GetBone (string boneName, SkeletonRenderer renderer) { + return renderer.skeleton == null ? null : renderer.skeleton.FindBone(boneName); + } + + public static Spine.BoneData GetBoneData (string boneName, SkeletonDataAsset skeletonDataAsset) { + var data = skeletonDataAsset.GetSkeletonData(true); + return data.FindBone(boneName); + } + } + public class SpineSlot : SpineAttributeBase { public bool containsBoundingBoxes = false; @@ -67,6 +93,25 @@ namespace Spine.Unity { } } + public class SpineAnimation : SpineAttributeBase { + /// + /// Smart popup menu for Spine Animations + /// + /// Filters popup results to elements that begin with supplied string. + /// If true, and an animation list source can't be found, the field will fall back to a normal text field. If false, it will show an error. + /// If true, the dropdown list will include a "none" option which stored as an empty string. + /// If specified, a locally scoped field with the name supplied by in dataField will be used to fill the popup results. + /// Valid types are SkeletonDataAsset and SkeletonRenderer (and derivatives) + /// If left empty and the script the attribute is applied to is derived from Component, GetComponent() will be called as a fallback. + /// + public SpineAnimation (string startsWith = "", string dataField = "", bool includeNone = true, bool fallbackToTextField = false) { + this.startsWith = startsWith; + this.dataField = dataField; + this.includeNone = includeNone; + this.fallbackToTextField = fallbackToTextField; + } + } + public class SpineEvent : SpineAttributeBase { /// /// Smart popup menu for Spine Events (Spine.EventData) @@ -105,24 +150,6 @@ namespace Spine.Unity { } } - public class SpinePathConstraint : SpineAttributeBase { - /// - /// Smart popup menu for Spine Events (Spine.PathConstraint) - /// - /// Filters popup results to elements that begin with supplied string. - /// If true, the dropdown list will include a "none" option which stored as an empty string. - /// If specified, a locally scoped field with the name supplied by in dataField will be used to fill the popup results. - /// Valid types are SkeletonDataAsset and SkeletonRenderer (and derivatives). - /// If left empty and the script the attribute is applied to is derived from Component, GetComponent(SkeletonRenderer)() will be called as a fallback. - /// - public SpinePathConstraint (string startsWith = "", string dataField = "", bool includeNone = true, bool fallbackToTextField = false) { - this.startsWith = startsWith; - this.dataField = dataField; - this.includeNone = includeNone; - this.fallbackToTextField = fallbackToTextField; - } - } - public class SpineTransformConstraint : SpineAttributeBase { /// /// Smart popup menu for Spine Transform Constraints (Spine.TransformConstraint) @@ -142,6 +169,24 @@ namespace Spine.Unity { } } + public class SpinePathConstraint : SpineAttributeBase { + /// + /// Smart popup menu for Spine Events (Spine.PathConstraint) + /// + /// Filters popup results to elements that begin with supplied string. + /// If true, the dropdown list will include a "none" option which stored as an empty string. + /// If specified, a locally scoped field with the name supplied by in dataField will be used to fill the popup results. + /// Valid types are SkeletonDataAsset and SkeletonRenderer (and derivatives). + /// If left empty and the script the attribute is applied to is derived from Component, GetComponent(SkeletonRenderer)() will be called as a fallback. + /// + public SpinePathConstraint (string startsWith = "", string dataField = "", bool includeNone = true, bool fallbackToTextField = false) { + this.startsWith = startsWith; + this.dataField = dataField; + this.includeNone = includeNone; + this.fallbackToTextField = fallbackToTextField; + } + } + public class SpineSkin : SpineAttributeBase { /// /// Smart popup menu for Spine Skins @@ -166,25 +211,6 @@ namespace Spine.Unity { } } - public class SpineAnimation : SpineAttributeBase { - /// - /// Smart popup menu for Spine Animations - /// - /// Filters popup results to elements that begin with supplied string. - /// If true, and an animation list source can't be found, the field will fall back to a normal text field. If false, it will show an error. - /// If true, the dropdown list will include a "none" option which stored as an empty string. - /// If specified, a locally scoped field with the name supplied by in dataField will be used to fill the popup results. - /// Valid types are SkeletonDataAsset and SkeletonRenderer (and derivatives) - /// If left empty and the script the attribute is applied to is derived from Component, GetComponent() will be called as a fallback. - /// - public SpineAnimation (string startsWith = "", string dataField = "", bool includeNone = true, bool fallbackToTextField = false) { - this.startsWith = startsWith; - this.dataField = dataField; - this.includeNone = includeNone; - this.fallbackToTextField = fallbackToTextField; - } - } - public class SpineAttachment : SpineAttributeBase { public bool returnAttachmentPath = false; public bool currentSkinOnly = false; @@ -258,34 +284,6 @@ namespace Spine.Unity { } } - public class SpineBone : SpineAttributeBase { - /// - /// Smart popup menu for Spine Bones - /// - /// Filters popup results to elements that begin with supplied string. - /// If true, the dropdown list will include a "none" option which stored as an empty string. - /// If true, and an animation list source can't be found, the field will fall back to a normal text field. If false, it will show an error. - /// If specified, a locally scoped field with the name supplied by in dataField will be used to fill the popup results. - /// Valid types are SkeletonDataAsset and SkeletonRenderer (and derivatives) - /// If left empty and the script the attribute is applied to is derived from Component, GetComponent() will be called as a fallback. - /// - public SpineBone (string startsWith = "", string dataField = "", bool includeNone = true, bool fallbackToTextField = false) { - this.startsWith = startsWith; - this.dataField = dataField; - this.includeNone = includeNone; - this.fallbackToTextField = fallbackToTextField; - } - - public static Spine.Bone GetBone(string boneName, SkeletonRenderer renderer) { - return renderer.skeleton == null ? null : renderer.skeleton.FindBone(boneName); - } - - public static Spine.BoneData GetBoneData(string boneName, SkeletonDataAsset skeletonDataAsset) { - var data = skeletonDataAsset.GetSkeletonData(true); - return data.FindBone(boneName); - } - } - public class SpineAtlasRegion : PropertyAttribute { public string atlasAssetField;