mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-26 03:31:24 +08:00
Merge branch '3.6' into 3.7-beta
This commit is contained in:
commit
ee7d9d27eb
@ -1,9 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: cbe5d97ed1d75964cab2e2882a52a200
|
|
||||||
folderAsset: yes
|
|
||||||
timeCreated: 1455489536
|
|
||||||
licenseType: Free
|
|
||||||
DefaultImporter:
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@ -73,7 +73,7 @@ namespace Spine.Unity {
|
|||||||
bool skeletonTransformIsParent;
|
bool skeletonTransformIsParent;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the target bone by its bone name. Returns false if no bone was found.</summary>
|
/// Sets the target bone by its bone name. Returns false if no bone was found. To set the bone by reference, use BoneFollower.bone directly.</summary>
|
||||||
public bool SetBone (string name) {
|
public bool SetBone (string name) {
|
||||||
bone = skeletonRenderer.skeleton.FindBone(name);
|
bone = skeletonRenderer.skeleton.FindBone(name);
|
||||||
if (bone == null) {
|
if (bone == null) {
|
||||||
|
|||||||
@ -126,8 +126,8 @@ namespace Spine.Unity.Editor {
|
|||||||
|
|
||||||
for (int i = 0; i < materials.arraySize; i++) {
|
for (int i = 0; i < materials.arraySize; i++) {
|
||||||
SerializedProperty prop = materials.GetArrayElementAtIndex(i);
|
SerializedProperty prop = materials.GetArrayElementAtIndex(i);
|
||||||
Material mat = (Material)prop.objectReferenceValue;
|
var material = (Material)prop.objectReferenceValue;
|
||||||
if (mat == null) {
|
if (material == null) {
|
||||||
EditorGUILayout.HelpBox("Materials cannot be null.", MessageType.Error);
|
EditorGUILayout.HelpBox("Materials cannot be null.", MessageType.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -37,10 +37,16 @@ namespace Spine.Unity {
|
|||||||
event UpdateBonesDelegate UpdateWorld;
|
event UpdateBonesDelegate UpdateWorld;
|
||||||
event UpdateBonesDelegate UpdateComplete;
|
event UpdateBonesDelegate UpdateComplete;
|
||||||
|
|
||||||
void LateUpdate ();
|
//void LateUpdate ();
|
||||||
Skeleton Skeleton { get; }
|
Skeleton Skeleton { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Holds a reference to a SkeletonDataAsset.</summary>
|
||||||
|
public interface ISkeletonDataAssetComponent {
|
||||||
|
/// <summary>Gets the SkeletonDataAsset of the Spine Component.</summary>
|
||||||
|
SkeletonDataAsset SkeletonDataAsset { get; }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>A Spine-Unity Component that manages a Spine.Skeleton instance, instantiated from a SkeletonDataAsset.</summary>
|
/// <summary>A Spine-Unity Component that manages a Spine.Skeleton instance, instantiated from a SkeletonDataAsset.</summary>
|
||||||
public interface ISkeletonComponent {
|
public interface ISkeletonComponent {
|
||||||
/// <summary>Gets the SkeletonDataAsset of the Spine Component.</summary>
|
/// <summary>Gets the SkeletonDataAsset of the Spine Component.</summary>
|
||||||
|
|||||||
@ -501,6 +501,7 @@ namespace Spine.Unity {
|
|||||||
|
|
||||||
Color c = default(Color);
|
Color c = default(Color);
|
||||||
|
|
||||||
|
// Identify and prepare values.
|
||||||
var region = attachment as RegionAttachment;
|
var region = attachment as RegionAttachment;
|
||||||
if (region != null) {
|
if (region != null) {
|
||||||
region.ComputeWorldVertices(slot.bone, workingVerts, 0);
|
region.ComputeWorldVertices(slot.bone, workingVerts, 0);
|
||||||
@ -531,6 +532,9 @@ namespace Spine.Unity {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If not any renderable attachment.
|
||||||
|
clipper.ClipEnd(slot);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -557,6 +561,7 @@ namespace Spine.Unity {
|
|||||||
uvs = clipper.clippedUVs.Items;
|
uvs = clipper.clippedUVs.Items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Actually add slot/attachment data into buffers.
|
||||||
if (attachmentVertexCount != 0 && attachmentIndexCount != 0) {
|
if (attachmentVertexCount != 0 && attachmentIndexCount != 0) {
|
||||||
if (tintBlack)
|
if (tintBlack)
|
||||||
AddAttachmentTintBlack(slot.r2, slot.g2, slot.b2, attachmentVertexCount);
|
AddAttachmentTintBlack(slot.r2, slot.g2, slot.b2, attachmentVertexCount);
|
||||||
@ -633,6 +638,7 @@ namespace Spine.Unity {
|
|||||||
submeshItems[oldTriangleCount + i] = attachmentTriangleIndices[i] + ovc;
|
submeshItems[oldTriangleCount + i] = attachmentTriangleIndices[i] + ovc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
clipper.ClipEnd(slot);
|
clipper.ClipEnd(slot);
|
||||||
}
|
}
|
||||||
clipper.ClipEnd();
|
clipper.ClipEnd();
|
||||||
@ -1155,7 +1161,7 @@ namespace Spine.Unity {
|
|||||||
doubleBufferedMesh = new DoubleBuffered<SmartMesh>();
|
doubleBufferedMesh = new DoubleBuffered<SmartMesh>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Material[] GetUpdatedShaderdMaterialsArray () {
|
public Material[] GetUpdatedSharedMaterialsArray () {
|
||||||
if (submeshMaterials.Count == sharedMaterials.Length)
|
if (submeshMaterials.Count == sharedMaterials.Length)
|
||||||
submeshMaterials.CopyTo(sharedMaterials);
|
submeshMaterials.CopyTo(sharedMaterials);
|
||||||
else
|
else
|
||||||
|
|||||||
@ -486,6 +486,7 @@ namespace Spine.Unity.Modules.AttachmentTools {
|
|||||||
/// Creates and populates a duplicate skin with cloned attachments that are backed by a new packed texture atlas comprised of all the regions from the original skin.</summary>
|
/// Creates and populates a duplicate skin with cloned attachments that are backed by a new packed texture atlas comprised of all the regions from the original skin.</summary>
|
||||||
/// <remarks>No Spine.Atlas object is created so there is no way to find AtlasRegions except through the Attachments using them.</remarks>
|
/// <remarks>No Spine.Atlas object is created so there is no way to find AtlasRegions except through the Attachments using them.</remarks>
|
||||||
public static Skin GetRepackedSkin (this Skin o, string newName, Shader shader, out Material outputMaterial, out Texture2D outputTexture, int maxAtlasSize = 1024, int padding = 2, TextureFormat textureFormat = SpineTextureFormat, bool mipmaps = UseMipMaps, Material materialPropertySource = null, bool clearCache = false) {
|
public static Skin GetRepackedSkin (this Skin o, string newName, Shader shader, out Material outputMaterial, out Texture2D outputTexture, int maxAtlasSize = 1024, int padding = 2, TextureFormat textureFormat = SpineTextureFormat, bool mipmaps = UseMipMaps, Material materialPropertySource = null, bool clearCache = false) {
|
||||||
|
if (o == null) throw new System.NullReferenceException("Skin was null");
|
||||||
var skinAttachments = o.Attachments;
|
var skinAttachments = o.Attachments;
|
||||||
var newSkin = new Skin(newName);
|
var newSkin = new Skin(newName);
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@ using Spine;
|
|||||||
namespace Spine.Unity {
|
namespace Spine.Unity {
|
||||||
[ExecuteInEditMode, RequireComponent(typeof(CanvasRenderer), typeof(RectTransform)), DisallowMultipleComponent]
|
[ExecuteInEditMode, RequireComponent(typeof(CanvasRenderer), typeof(RectTransform)), DisallowMultipleComponent]
|
||||||
[AddComponentMenu("Spine/SkeletonGraphic (Unity UI Canvas)")]
|
[AddComponentMenu("Spine/SkeletonGraphic (Unity UI Canvas)")]
|
||||||
public class SkeletonGraphic : MaskableGraphic, ISkeletonComponent, IAnimationStateComponent, ISkeletonAnimation {
|
public class SkeletonGraphic : MaskableGraphic, ISkeletonComponent, IAnimationStateComponent, ISkeletonAnimation, ISkeletonDataAssetComponent {
|
||||||
|
|
||||||
#region Inspector
|
#region Inspector
|
||||||
public SkeletonDataAsset skeletonDataAsset;
|
public SkeletonDataAsset skeletonDataAsset;
|
||||||
|
|||||||
@ -112,9 +112,9 @@ namespace Spine.Unity.Modules {
|
|||||||
meshGenerator.FillVertexData(mesh);
|
meshGenerator.FillVertexData(mesh);
|
||||||
if (updateTriangles) {
|
if (updateTriangles) {
|
||||||
meshGenerator.FillTriangles(mesh);
|
meshGenerator.FillTriangles(mesh);
|
||||||
meshRenderer.sharedMaterials = buffers.GetUpdatedShaderdMaterialsArray();
|
meshRenderer.sharedMaterials = buffers.GetUpdatedSharedMaterialsArray();
|
||||||
} else if (buffers.MaterialsChangedInLastUpdate()) {
|
} else if (buffers.MaterialsChangedInLastUpdate()) {
|
||||||
meshRenderer.sharedMaterials = buffers.GetUpdatedShaderdMaterialsArray();
|
meshRenderer.sharedMaterials = buffers.GetUpdatedSharedMaterialsArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -126,11 +126,16 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clears the previously generated mesh, resets the skeleton's pose, and clears all previously active animations.</summary>
|
||||||
public override void ClearState () {
|
public override void ClearState () {
|
||||||
base.ClearState();
|
base.ClearState();
|
||||||
if (state != null) state.ClearTracks();
|
if (state != null) state.ClearTracks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initialize this component. Attempts to load the SkeletonData and creates the internal Spine objects and buffers.</summary>
|
||||||
|
/// <param name="overwrite">If set to <c>true</c>, force overwrite an already initialized object.</param>
|
||||||
public override void Initialize (bool overwrite) {
|
public override void Initialize (bool overwrite) {
|
||||||
if (valid && !overwrite)
|
if (valid && !overwrite)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -38,7 +38,7 @@ namespace Spine.Unity {
|
|||||||
/// <summary>Renders a skeleton.</summary>
|
/// <summary>Renders a skeleton.</summary>
|
||||||
[ExecuteInEditMode, RequireComponent(typeof(MeshFilter), typeof(MeshRenderer)), DisallowMultipleComponent]
|
[ExecuteInEditMode, RequireComponent(typeof(MeshFilter), typeof(MeshRenderer)), DisallowMultipleComponent]
|
||||||
[HelpURL("http://esotericsoftware.com/spine-unity-documentation#Rendering")]
|
[HelpURL("http://esotericsoftware.com/spine-unity-documentation#Rendering")]
|
||||||
public class SkeletonRenderer : MonoBehaviour, ISkeletonComponent {
|
public class SkeletonRenderer : MonoBehaviour, ISkeletonComponent, ISkeletonDataAssetComponent {
|
||||||
|
|
||||||
public delegate void SkeletonRendererDelegate (SkeletonRenderer skeletonRenderer);
|
public delegate void SkeletonRendererDelegate (SkeletonRenderer skeletonRenderer);
|
||||||
public event SkeletonRendererDelegate OnRebuild;
|
public event SkeletonRendererDelegate OnRebuild;
|
||||||
@ -163,12 +163,17 @@ namespace Spine.Unity {
|
|||||||
valid = false;
|
valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clears the previously generated mesh and resets the skeleton's pose.</summary>
|
||||||
public virtual void ClearState () {
|
public virtual void ClearState () {
|
||||||
meshFilter.sharedMesh = null;
|
meshFilter.sharedMesh = null;
|
||||||
currentInstructions.Clear();
|
currentInstructions.Clear();
|
||||||
if (skeleton != null) skeleton.SetToSetupPose();
|
if (skeleton != null) skeleton.SetToSetupPose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initialize this component. Attempts to load the SkeletonData and creates the internal Skeleton object and buffers.</summary>
|
||||||
|
/// <param name="overwrite">If set to <c>true</c>, it will overwrite internal objects if they were already generated. Otherwise, the initialized component will ignore subsequent calls to initialize.</param>
|
||||||
public virtual void Initialize (bool overwrite) {
|
public virtual void Initialize (bool overwrite) {
|
||||||
if (valid && !overwrite)
|
if (valid && !overwrite)
|
||||||
return;
|
return;
|
||||||
@ -219,6 +224,8 @@ namespace Spine.Unity {
|
|||||||
OnRebuild(this);
|
OnRebuild(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generates a new UnityEngine.Mesh from the internal Skeleton.</summary>
|
||||||
public virtual void LateUpdate () {
|
public virtual void LateUpdate () {
|
||||||
if (!valid) return;
|
if (!valid) return;
|
||||||
|
|
||||||
@ -305,9 +312,9 @@ namespace Spine.Unity {
|
|||||||
rendererBuffers.UpdateSharedMaterials(workingSubmeshInstructions);
|
rendererBuffers.UpdateSharedMaterials(workingSubmeshInstructions);
|
||||||
if (updateTriangles) { // Check if the triangles should also be updated.
|
if (updateTriangles) { // Check if the triangles should also be updated.
|
||||||
meshGenerator.FillTriangles(currentMesh);
|
meshGenerator.FillTriangles(currentMesh);
|
||||||
meshRenderer.sharedMaterials = rendererBuffers.GetUpdatedShaderdMaterialsArray();
|
meshRenderer.sharedMaterials = rendererBuffers.GetUpdatedSharedMaterialsArray();
|
||||||
} else if (rendererBuffers.MaterialsChangedInLastUpdate()) {
|
} else if (rendererBuffers.MaterialsChangedInLastUpdate()) {
|
||||||
meshRenderer.sharedMaterials = rendererBuffers.GetUpdatedShaderdMaterialsArray();
|
meshRenderer.sharedMaterials = rendererBuffers.GetUpdatedSharedMaterialsArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user