mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Merge remote-tracking branch 'EsotericSoftware/3.6' into 3.6
This commit is contained in:
commit
d4fb19186b
@ -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;
|
||||
|
||||
/// <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) {
|
||||
bone = skeletonRenderer.skeleton.FindBone(name);
|
||||
if (bone == null) {
|
||||
|
||||
@ -126,8 +126,8 @@ namespace Spine.Unity.Editor {
|
||||
|
||||
for (int i = 0; i < materials.arraySize; i++) {
|
||||
SerializedProperty prop = materials.GetArrayElementAtIndex(i);
|
||||
Material mat = (Material)prop.objectReferenceValue;
|
||||
if (mat == null) {
|
||||
var material = (Material)prop.objectReferenceValue;
|
||||
if (material == null) {
|
||||
EditorGUILayout.HelpBox("Materials cannot be null.", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
@ -37,10 +37,16 @@ namespace Spine.Unity {
|
||||
event UpdateBonesDelegate UpdateWorld;
|
||||
event UpdateBonesDelegate UpdateComplete;
|
||||
|
||||
void LateUpdate ();
|
||||
//void LateUpdate ();
|
||||
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>
|
||||
public interface ISkeletonComponent {
|
||||
/// <summary>Gets the SkeletonDataAsset of the Spine Component.</summary>
|
||||
|
||||
@ -501,6 +501,7 @@ namespace Spine.Unity {
|
||||
|
||||
Color c = default(Color);
|
||||
|
||||
// Identify and prepare values.
|
||||
var region = attachment as RegionAttachment;
|
||||
if (region != null) {
|
||||
region.ComputeWorldVertices(slot.bone, workingVerts, 0);
|
||||
@ -531,6 +532,9 @@ namespace Spine.Unity {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// If not any renderable attachment.
|
||||
clipper.ClipEnd(slot);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -557,6 +561,7 @@ namespace Spine.Unity {
|
||||
uvs = clipper.clippedUVs.Items;
|
||||
}
|
||||
|
||||
// Actually add slot/attachment data into buffers.
|
||||
if (attachmentVertexCount != 0 && attachmentIndexCount != 0) {
|
||||
if (tintBlack)
|
||||
AddAttachmentTintBlack(slot.r2, slot.g2, slot.b2, attachmentVertexCount);
|
||||
@ -633,6 +638,7 @@ namespace Spine.Unity {
|
||||
submeshItems[oldTriangleCount + i] = attachmentTriangleIndices[i] + ovc;
|
||||
}
|
||||
}
|
||||
|
||||
clipper.ClipEnd(slot);
|
||||
}
|
||||
clipper.ClipEnd();
|
||||
@ -1155,7 +1161,7 @@ namespace Spine.Unity {
|
||||
doubleBufferedMesh = new DoubleBuffered<SmartMesh>();
|
||||
}
|
||||
|
||||
public Material[] GetUpdatedShaderdMaterialsArray () {
|
||||
public Material[] GetUpdatedSharedMaterialsArray () {
|
||||
if (submeshMaterials.Count == sharedMaterials.Length)
|
||||
submeshMaterials.CopyTo(sharedMaterials);
|
||||
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>
|
||||
/// <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) {
|
||||
if (o == null) throw new System.NullReferenceException("Skin was null");
|
||||
var skinAttachments = o.Attachments;
|
||||
var newSkin = new Skin(newName);
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ using Spine;
|
||||
namespace Spine.Unity {
|
||||
[ExecuteInEditMode, RequireComponent(typeof(CanvasRenderer), typeof(RectTransform)), DisallowMultipleComponent]
|
||||
[AddComponentMenu("Spine/SkeletonGraphic (Unity UI Canvas)")]
|
||||
public class SkeletonGraphic : MaskableGraphic, ISkeletonComponent, IAnimationStateComponent, ISkeletonAnimation {
|
||||
public class SkeletonGraphic : MaskableGraphic, ISkeletonComponent, IAnimationStateComponent, ISkeletonAnimation, ISkeletonDataAssetComponent {
|
||||
|
||||
#region Inspector
|
||||
public SkeletonDataAsset skeletonDataAsset;
|
||||
|
||||
@ -112,9 +112,9 @@ namespace Spine.Unity.Modules {
|
||||
meshGenerator.FillVertexData(mesh);
|
||||
if (updateTriangles) {
|
||||
meshGenerator.FillTriangles(mesh);
|
||||
meshRenderer.sharedMaterials = buffers.GetUpdatedShaderdMaterialsArray();
|
||||
meshRenderer.sharedMaterials = buffers.GetUpdatedSharedMaterialsArray();
|
||||
} else if (buffers.MaterialsChangedInLastUpdate()) {
|
||||
meshRenderer.sharedMaterials = buffers.GetUpdatedShaderdMaterialsArray();
|
||||
meshRenderer.sharedMaterials = buffers.GetUpdatedSharedMaterialsArray();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -126,11 +126,16 @@ namespace Spine.Unity {
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Clears the previously generated mesh, resets the skeleton's pose, and clears all previously active animations.</summary>
|
||||
public override void ClearState () {
|
||||
base.ClearState();
|
||||
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) {
|
||||
if (valid && !overwrite)
|
||||
return;
|
||||
|
||||
@ -38,7 +38,7 @@ namespace Spine.Unity {
|
||||
/// <summary>Renders a skeleton.</summary>
|
||||
[ExecuteInEditMode, RequireComponent(typeof(MeshFilter), typeof(MeshRenderer)), DisallowMultipleComponent]
|
||||
[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 event SkeletonRendererDelegate OnRebuild;
|
||||
@ -163,12 +163,17 @@ namespace Spine.Unity {
|
||||
valid = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears the previously generated mesh and resets the skeleton's pose.</summary>
|
||||
public virtual void ClearState () {
|
||||
meshFilter.sharedMesh = null;
|
||||
currentInstructions.Clear();
|
||||
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) {
|
||||
if (valid && !overwrite)
|
||||
return;
|
||||
@ -219,6 +224,8 @@ namespace Spine.Unity {
|
||||
OnRebuild(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a new UnityEngine.Mesh from the internal Skeleton.</summary>
|
||||
public virtual void LateUpdate () {
|
||||
if (!valid) return;
|
||||
|
||||
@ -305,9 +312,9 @@ namespace Spine.Unity {
|
||||
rendererBuffers.UpdateSharedMaterials(workingSubmeshInstructions);
|
||||
if (updateTriangles) { // Check if the triangles should also be updated.
|
||||
meshGenerator.FillTriangles(currentMesh);
|
||||
meshRenderer.sharedMaterials = rendererBuffers.GetUpdatedShaderdMaterialsArray();
|
||||
meshRenderer.sharedMaterials = rendererBuffers.GetUpdatedSharedMaterialsArray();
|
||||
} else if (rendererBuffers.MaterialsChangedInLastUpdate()) {
|
||||
meshRenderer.sharedMaterials = rendererBuffers.GetUpdatedShaderdMaterialsArray();
|
||||
meshRenderer.sharedMaterials = rendererBuffers.GetUpdatedSharedMaterialsArray();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user