mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[spine-unity] SkeletonRenderer fix null 1st material.
This commit is contained in:
parent
d6dc425817
commit
2fdd820da0
@ -235,7 +235,6 @@ namespace Spine.Unity {
|
|||||||
ExposedList<Slot> drawOrder = skeleton.drawOrder;
|
ExposedList<Slot> drawOrder = skeleton.drawOrder;
|
||||||
var drawOrderItems = drawOrder.Items;
|
var drawOrderItems = drawOrder.Items;
|
||||||
int drawOrderCount = drawOrder.Count;
|
int drawOrderCount = drawOrder.Count;
|
||||||
int separatorSlotCount = separatorSlots.Count;
|
|
||||||
bool renderMeshes = this.renderMeshes;
|
bool renderMeshes = this.renderMeshes;
|
||||||
|
|
||||||
// Clear last state of attachments and submeshes
|
// Clear last state of attachments and submeshes
|
||||||
@ -298,9 +297,7 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if !SPINE_TK2D
|
#if !SPINE_TK2D
|
||||||
// Material material = (Material)((AtlasRegion)rendererObject).page.rendererObject; // For no customSlotMaterials
|
Material material; //= (Material)((AtlasRegion)rendererObject).page.rendererObject; // For no customSlotMaterials
|
||||||
|
|
||||||
Material material;
|
|
||||||
if (isCustomSlotMaterialsPopulated) {
|
if (isCustomSlotMaterialsPopulated) {
|
||||||
if (!customSlotMaterials.TryGetValue(slot, out material)) {
|
if (!customSlotMaterials.TryGetValue(slot, out material)) {
|
||||||
material = (Material)((AtlasRegion)rendererObject).page.rendererObject;
|
material = (Material)((AtlasRegion)rendererObject).page.rendererObject;
|
||||||
@ -313,8 +310,8 @@ namespace Spine.Unity {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Create a new SubmeshInstruction when material changes. (or when forced to separate by a submeshSeparator)
|
// Create a new SubmeshInstruction when material changes. (or when forced to separate by a submeshSeparator)
|
||||||
bool forceSeparate = (separatorSlotCount > 0 && separatorSlots.Contains(slot));
|
bool forceSeparate = (separatorSlots.Count > 0 && separatorSlots.Contains(slot));
|
||||||
if ((vertexCount > 0 && lastMaterial.GetInstanceID() != material.GetInstanceID()) || forceSeparate) {
|
if (vertexCount > 0 && (lastMaterial.GetInstanceID() != material.GetInstanceID() || forceSeparate)) {
|
||||||
workingSubmeshInstructions.Add(
|
workingSubmeshInstructions.Add(
|
||||||
new Spine.Unity.MeshGeneration.SubmeshInstruction {
|
new Spine.Unity.MeshGeneration.SubmeshInstruction {
|
||||||
skeleton = this.skeleton,
|
skeleton = this.skeleton,
|
||||||
@ -327,14 +324,13 @@ namespace Spine.Unity {
|
|||||||
forceSeparate = forceSeparate
|
forceSeparate = forceSeparate
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
submeshTriangleCount = 0;
|
submeshTriangleCount = 0;
|
||||||
submeshVertexCount = 0;
|
submeshVertexCount = 0;
|
||||||
submeshFirstVertex = vertexCount;
|
submeshFirstVertex = vertexCount;
|
||||||
submeshStartSlotIndex = i;
|
submeshStartSlotIndex = i;
|
||||||
}
|
}
|
||||||
|
// Update state for the next iteration.
|
||||||
lastMaterial = material;
|
lastMaterial = material;
|
||||||
|
|
||||||
submeshTriangleCount += attachmentTriangleCount;
|
submeshTriangleCount += attachmentTriangleCount;
|
||||||
vertexCount += attachmentVertexCount;
|
vertexCount += attachmentVertexCount;
|
||||||
submeshVertexCount += attachmentVertexCount;
|
submeshVertexCount += attachmentVertexCount;
|
||||||
@ -382,10 +378,7 @@ namespace Spine.Unity {
|
|||||||
#if SPINE_OPTIONAL_RENDEROVERRIDE
|
#if SPINE_OPTIONAL_RENDEROVERRIDE
|
||||||
if (this.generateMeshOverride != null) {
|
if (this.generateMeshOverride != null) {
|
||||||
this.generateMeshOverride(workingInstruction);
|
this.generateMeshOverride(workingInstruction);
|
||||||
|
if (disableRenderingOnOverride) return;
|
||||||
if (disableRenderingOnOverride) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -876,9 +869,8 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
for (int ii = 0, nn = attachmentTriangles.Length; ii < nn; ii++, triangleIndex++) {
|
for (int ii = 0, nn = attachmentTriangles.Length; ii < nn; ii++, triangleIndex++)
|
||||||
triangles[triangleIndex] = firstVertex + attachmentTriangles[ii];
|
triangles[triangleIndex] = firstVertex + attachmentTriangles[ii];
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
firstVertex += attachmentVertexCount;
|
firstVertex += attachmentVertexCount;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user