mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 22:34:53 +08:00
[unity] Fixed an exception at SkeletonGraphic when no active attachments are set. MeshGenerator.GenerateSingleSubmeshInstruction() didn't handle the case of all-null attachments. Improved code to not generate an unnecessary empty instruction. Closes #1491.
This commit is contained in:
parent
fb98a9b7c8
commit
085549e5fd
@ -313,7 +313,7 @@ namespace Spine.Unity {
|
||||
|
||||
var mesh = smartMesh.mesh;
|
||||
meshGenerator.FillVertexData(mesh);
|
||||
if (updateTriangles) meshGenerator.FillTrianglesSingle(mesh);
|
||||
if (updateTriangles) meshGenerator.FillTriangles(mesh);
|
||||
meshGenerator.FillLateVertexData(mesh);
|
||||
|
||||
canvasRenderer.SetMesh(mesh);
|
||||
|
||||
@ -148,7 +148,6 @@ namespace Spine.Unity {
|
||||
// Clear last state of attachments and submeshes
|
||||
instructionOutput.Clear(); // submeshInstructions.Clear(); attachments.Clear();
|
||||
var workingSubmeshInstructions = instructionOutput.submeshInstructions;
|
||||
workingSubmeshInstructions.Resize(1);
|
||||
|
||||
#if SPINE_TRIANGLECHECK
|
||||
instructionOutput.attachments.Resize(drawOrderCount);
|
||||
@ -206,11 +205,12 @@ namespace Spine.Unity {
|
||||
current.rawVertexCount += attachmentVertexCount;
|
||||
totalRawVertexCount += attachmentVertexCount;
|
||||
}
|
||||
|
||||
#if !SPINE_TK2D
|
||||
if (material == null)
|
||||
if (material == null && rendererObject != null)
|
||||
current.material = (Material)((AtlasRegion)rendererObject).page.rendererObject;
|
||||
#else
|
||||
if (material == null)
|
||||
if (material == null && rendererObject != null)
|
||||
current.material = (rendererObject is Material) ? (Material)rendererObject : (Material)((AtlasRegion)rendererObject).page.rendererObject;
|
||||
#endif
|
||||
|
||||
@ -218,7 +218,13 @@ namespace Spine.Unity {
|
||||
instructionOutput.rawVertexCount = totalRawVertexCount;
|
||||
#endif
|
||||
|
||||
workingSubmeshInstructions.Items[0] = current;
|
||||
if (totalRawVertexCount > 0) {
|
||||
workingSubmeshInstructions.Resize(1);
|
||||
workingSubmeshInstructions.Items[0] = current;
|
||||
}
|
||||
else {
|
||||
workingSubmeshInstructions.Resize(0);
|
||||
}
|
||||
}
|
||||
|
||||
public static void GenerateSkeletonRendererInstruction (SkeletonRendererInstruction instructionOutput, Skeleton skeleton, Dictionary<Slot, Material> customSlotMaterials, List<Slot> separatorSlots, bool generateMeshOverride, bool immutableTriangles = false) {
|
||||
@ -1045,10 +1051,6 @@ namespace Spine.Unity {
|
||||
for (int i = 0; i < submeshCount; i++)
|
||||
mesh.SetTriangles(submeshesItems[i].Items, i, false);
|
||||
}
|
||||
|
||||
public void FillTrianglesSingle (Mesh mesh) {
|
||||
mesh.SetTriangles(submeshes.Items[0].Items, 0, false);
|
||||
}
|
||||
#endregion
|
||||
|
||||
public void EnsureVertexCapacity (int minimumVertexCount, bool inlcudeTintBlack = false, bool includeTangents = false, bool includeNormals = false) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user