mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Merge branch '3.7-beta' of https://github.com/esotericsoftware/spine-runtimes into 3.7-beta
This commit is contained in:
commit
8945d209c5
@ -323,7 +323,7 @@ namespace Spine.Unity.Editor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach (var a in animations) {
|
foreach (var a in animations) {
|
||||||
var animationName = a.Name;
|
string animationName = a.Name;
|
||||||
eventNames.Add(animationName);
|
eventNames.Add(animationName);
|
||||||
menuItems.Add(new GUIContent(animationName, SpineEditorUtilities.Icons.userEvent));
|
menuItems.Add(new GUIContent(animationName, SpineEditorUtilities.Icons.userEvent));
|
||||||
}
|
}
|
||||||
@ -336,9 +336,14 @@ namespace Spine.Unity.Editor {
|
|||||||
menu.AddItem(new GUIContent(NoneString), !property.hasMultipleDifferentValues && string.IsNullOrEmpty(property.stringValue), HandleSelect, new SpineDrawerValuePair(string.Empty, property));
|
menu.AddItem(new GUIContent(NoneString), !property.hasMultipleDifferentValues && string.IsNullOrEmpty(property.stringValue), HandleSelect, new SpineDrawerValuePair(string.Empty, property));
|
||||||
|
|
||||||
for (int i = 0; i < events.Count; i++) {
|
for (int i = 0; i < events.Count; i++) {
|
||||||
string name = events.Items[i].Name;
|
var eventObject = events.Items[i];
|
||||||
if (name.StartsWith(targetAttribute.startsWith, StringComparison.Ordinal))
|
string name = eventObject.Name;
|
||||||
menu.AddItem(new GUIContent(name), !property.hasMultipleDifferentValues && name == property.stringValue, HandleSelect, new SpineDrawerValuePair(name, property));
|
if (name.StartsWith(targetAttribute.startsWith, StringComparison.Ordinal)) {
|
||||||
|
if (!TargetAttribute.audioOnly || !string.IsNullOrEmpty(eventObject.AudioPath)) {
|
||||||
|
menu.AddItem(new GUIContent(name), !property.hasMultipleDifferentValues && name == property.stringValue, HandleSelect, new SpineDrawerValuePair(name, property));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -39,26 +39,14 @@ namespace Spine.Unity {
|
|||||||
[ExecuteInEditMode, RequireComponent(typeof(MeshFilter), typeof(MeshRenderer)), DisallowMultipleComponent]
|
[ExecuteInEditMode, RequireComponent(typeof(MeshFilter), typeof(MeshRenderer)), DisallowMultipleComponent]
|
||||||
[HelpURL("http://esotericsoftware.com/spine-unity-rendering")]
|
[HelpURL("http://esotericsoftware.com/spine-unity-rendering")]
|
||||||
public class SkeletonRenderer : MonoBehaviour, ISkeletonComponent, IHasSkeletonDataAsset {
|
public class SkeletonRenderer : MonoBehaviour, ISkeletonComponent, IHasSkeletonDataAsset {
|
||||||
|
[SerializeField] public SkeletonDataAsset skeletonDataAsset;
|
||||||
public bool logErrors = false;
|
|
||||||
|
|
||||||
public delegate void SkeletonRendererDelegate (SkeletonRenderer skeletonRenderer);
|
|
||||||
|
|
||||||
/// <summary>OnRebuild is raised after the Skeleton is successfully initialized.</summary>
|
|
||||||
public event SkeletonRendererDelegate OnRebuild;
|
|
||||||
|
|
||||||
/// <summary> Occurs after the vertex data is populated every frame, before the vertices are pushed into the mesh.</summary>
|
|
||||||
public event Spine.Unity.MeshGeneratorDelegate OnPostProcessVertices;
|
|
||||||
|
|
||||||
public SkeletonDataAsset skeletonDataAsset;
|
|
||||||
public SkeletonDataAsset SkeletonDataAsset { get { return skeletonDataAsset; } } // ISkeletonComponent
|
|
||||||
|
|
||||||
#region Initialization settings
|
#region Initialization settings
|
||||||
/// <summary>Skin name to use when the Skeleton is initialized.</summary>
|
/// <summary>Skin name to use when the Skeleton is initialized.</summary>
|
||||||
[SpineSkin(defaultAsEmptyString:true)] public string initialSkinName;
|
[SerializeField] [SpineSkin(defaultAsEmptyString:true)] public string initialSkinName;
|
||||||
|
|
||||||
/// <summary>Flip X and Y to use when the Skeleton is initialized.</summary>
|
/// <summary>Flip X and Y to use when the Skeleton is initialized.</summary>
|
||||||
public bool initialFlipX, initialFlipY;
|
[SerializeField] public bool initialFlipX, initialFlipY;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Advanced Render Settings
|
#region Advanced Render Settings
|
||||||
@ -121,6 +109,9 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary> Occurs after the vertex data is populated every frame, before the vertices are pushed into the mesh.</summary>
|
||||||
|
public event Spine.Unity.MeshGeneratorDelegate OnPostProcessVertices;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SPINE_OPTIONAL_MATERIALOVERRIDE
|
#if SPINE_OPTIONAL_MATERIALOVERRIDE
|
||||||
@ -156,6 +147,13 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public delegate void SkeletonRendererDelegate (SkeletonRenderer skeletonRenderer);
|
||||||
|
|
||||||
|
/// <summary>OnRebuild is raised after the Skeleton is successfully initialized.</summary>
|
||||||
|
public event SkeletonRendererDelegate OnRebuild;
|
||||||
|
|
||||||
|
public SkeletonDataAsset SkeletonDataAsset { get { return skeletonDataAsset; } } // ISkeletonComponent
|
||||||
|
|
||||||
#region Runtime Instantiation
|
#region Runtime Instantiation
|
||||||
public static T NewSpineGameObject<T> (SkeletonDataAsset skeletonDataAsset) where T : SkeletonRenderer {
|
public static T NewSpineGameObject<T> (SkeletonDataAsset skeletonDataAsset) where T : SkeletonRenderer {
|
||||||
return SkeletonRenderer.AddSpineComponent<T>(new GameObject("New Spine GameObject"), skeletonDataAsset);
|
return SkeletonRenderer.AddSpineComponent<T>(new GameObject("New Spine GameObject"), skeletonDataAsset);
|
||||||
@ -185,6 +183,7 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
public virtual void Awake () {
|
public virtual void Awake () {
|
||||||
Initialize(false);
|
Initialize(false);
|
||||||
}
|
}
|
||||||
@ -237,10 +236,8 @@ namespace Spine.Unity {
|
|||||||
valid = false;
|
valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skeletonDataAsset == null) {
|
if (skeletonDataAsset == null)
|
||||||
if (logErrors) Debug.LogError("Missing SkeletonData asset.", this);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
SkeletonData skeletonData = skeletonDataAsset.GetSkeletonData(false);
|
SkeletonData skeletonData = skeletonDataAsset.GetSkeletonData(false);
|
||||||
if (skeletonData == null) return;
|
if (skeletonData == null) return;
|
||||||
|
|||||||
@ -28,8 +28,6 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
// Contributed by: Mitch Thompson
|
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
@ -44,6 +42,34 @@ namespace Spine.Unity {
|
|||||||
public bool fallbackToTextField = false;
|
public bool fallbackToTextField = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SpineBone : SpineAttributeBase {
|
||||||
|
/// <summary>
|
||||||
|
/// Smart popup menu for Spine Bones
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="startsWith">Filters popup results to elements that begin with supplied string.</param>
|
||||||
|
/// <param name="includeNone">If true, the dropdown list will include a "none" option which stored as an empty string.</param>
|
||||||
|
/// <param name = "fallbackToTextField">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.</param>
|
||||||
|
/// <param name="dataField">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.
|
||||||
|
/// </param>
|
||||||
|
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 class SpineSlot : SpineAttributeBase {
|
||||||
public bool containsBoundingBoxes = false;
|
public bool containsBoundingBoxes = false;
|
||||||
|
|
||||||
@ -67,6 +93,25 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SpineAnimation : SpineAttributeBase {
|
||||||
|
/// <summary>
|
||||||
|
/// Smart popup menu for Spine Animations
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="startsWith">Filters popup results to elements that begin with supplied string.</param>
|
||||||
|
/// <param name = "fallbackToTextField">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.</param>
|
||||||
|
/// <param name="includeNone">If true, the dropdown list will include a "none" option which stored as an empty string.</param>
|
||||||
|
/// <param name="dataField">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.
|
||||||
|
/// </param>
|
||||||
|
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 {
|
public class SpineEvent : SpineAttributeBase {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Smart popup menu for Spine Events (Spine.EventData)
|
/// Smart popup menu for Spine Events (Spine.EventData)
|
||||||
@ -78,11 +123,15 @@ namespace Spine.Unity {
|
|||||||
/// If left empty and the script the attribute is applied to is derived from Component, GetComponent(SkeletonRenderer)() will be called as a fallback.
|
/// If left empty and the script the attribute is applied to is derived from Component, GetComponent(SkeletonRenderer)() will be called as a fallback.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="fallbackToTextField">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.</param>
|
/// <param name="fallbackToTextField">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.</param>
|
||||||
public SpineEvent (string startsWith = "", string dataField = "", bool includeNone = true, bool fallbackToTextField = false) {
|
|
||||||
|
public bool audioOnly = false;
|
||||||
|
|
||||||
|
public SpineEvent (string startsWith = "", string dataField = "", bool includeNone = true, bool fallbackToTextField = false, bool audioOnly = false) {
|
||||||
this.startsWith = startsWith;
|
this.startsWith = startsWith;
|
||||||
this.dataField = dataField;
|
this.dataField = dataField;
|
||||||
this.includeNone = includeNone;
|
this.includeNone = includeNone;
|
||||||
this.fallbackToTextField = fallbackToTextField;
|
this.fallbackToTextField = fallbackToTextField;
|
||||||
|
this.audioOnly = audioOnly;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,24 +154,6 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SpinePathConstraint : SpineAttributeBase {
|
|
||||||
/// <summary>
|
|
||||||
/// Smart popup menu for Spine Events (Spine.PathConstraint)
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="startsWith">Filters popup results to elements that begin with supplied string.</param>
|
|
||||||
/// <param name = "includeNone">If true, the dropdown list will include a "none" option which stored as an empty string.</param>
|
|
||||||
/// <param name="dataField">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.
|
|
||||||
/// </param>
|
|
||||||
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 {
|
public class SpineTransformConstraint : SpineAttributeBase {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Smart popup menu for Spine Transform Constraints (Spine.TransformConstraint)
|
/// Smart popup menu for Spine Transform Constraints (Spine.TransformConstraint)
|
||||||
@ -142,6 +173,24 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SpinePathConstraint : SpineAttributeBase {
|
||||||
|
/// <summary>
|
||||||
|
/// Smart popup menu for Spine Events (Spine.PathConstraint)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="startsWith">Filters popup results to elements that begin with supplied string.</param>
|
||||||
|
/// <param name = "includeNone">If true, the dropdown list will include a "none" option which stored as an empty string.</param>
|
||||||
|
/// <param name="dataField">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.
|
||||||
|
/// </param>
|
||||||
|
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 {
|
public class SpineSkin : SpineAttributeBase {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Smart popup menu for Spine Skins
|
/// Smart popup menu for Spine Skins
|
||||||
@ -166,25 +215,6 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SpineAnimation : SpineAttributeBase {
|
|
||||||
/// <summary>
|
|
||||||
/// Smart popup menu for Spine Animations
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="startsWith">Filters popup results to elements that begin with supplied string.</param>
|
|
||||||
/// <param name = "fallbackToTextField">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.</param>
|
|
||||||
/// <param name="includeNone">If true, the dropdown list will include a "none" option which stored as an empty string.</param>
|
|
||||||
/// <param name="dataField">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.
|
|
||||||
/// </param>
|
|
||||||
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 class SpineAttachment : SpineAttributeBase {
|
||||||
public bool returnAttachmentPath = false;
|
public bool returnAttachmentPath = false;
|
||||||
public bool currentSkinOnly = false;
|
public bool currentSkinOnly = false;
|
||||||
@ -258,34 +288,6 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SpineBone : SpineAttributeBase {
|
|
||||||
/// <summary>
|
|
||||||
/// Smart popup menu for Spine Bones
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="startsWith">Filters popup results to elements that begin with supplied string.</param>
|
|
||||||
/// <param name="includeNone">If true, the dropdown list will include a "none" option which stored as an empty string.</param>
|
|
||||||
/// <param name = "fallbackToTextField">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.</param>
|
|
||||||
/// <param name="dataField">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.
|
|
||||||
/// </param>
|
|
||||||
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 class SpineAtlasRegion : PropertyAttribute {
|
||||||
public string atlasAssetField;
|
public string atlasAssetField;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user