mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
[unity] Allow empty slots as separators.
This commit is contained in:
parent
8e138b56e0
commit
015ade60ea
@ -38,7 +38,6 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Spine.Unity {
|
||||
public static class SpineMesh {
|
||||
|
||||
internal const HideFlags MeshHideflags = HideFlags.DontSaveInBuild | HideFlags.DontSaveInEditor;
|
||||
|
||||
/// <summary>Factory method for creating a new mesh for use in Spine components. This can be called in field initializers.</summary>
|
||||
@ -132,6 +131,8 @@ namespace Spine.Unity {
|
||||
[NonSerialized] ExposedList<Vector2> uv3;
|
||||
#endregion
|
||||
|
||||
public int VertexCount { get { return vertexBuffer.Count; } }
|
||||
|
||||
#region Step 1 : Generate Instructions
|
||||
public static void GenerateSingleSubmeshInstruction (SkeletonRendererInstruction instructionOutput, Skeleton skeleton, Material material) {
|
||||
ExposedList<Slot> drawOrder = skeleton.drawOrder;
|
||||
@ -295,7 +296,7 @@ namespace Spine.Unity {
|
||||
}
|
||||
|
||||
if (noRender) {
|
||||
if (current.forceSeparate && current.rawVertexCount > 0 && generateMeshOverride) {
|
||||
if (current.forceSeparate && generateMeshOverride && current.rawVertexCount > 0) {
|
||||
{ // Add
|
||||
current.endSlot = i;
|
||||
current.preActiveClippingSlotSource = lastPreActiveClipping;
|
||||
@ -305,6 +306,7 @@ namespace Spine.Unity {
|
||||
|
||||
submeshIndex++;
|
||||
}
|
||||
|
||||
current.startSlot = i;
|
||||
lastPreActiveClipping = clippingAttachmentSource;
|
||||
#if SPINE_TRIANGLECHECK
|
||||
@ -327,7 +329,7 @@ namespace Spine.Unity {
|
||||
Material material = (rendererObject.GetType() == typeof(Material)) ? (Material)rendererObject : (Material)((AtlasRegion)rendererObject).page.rendererObject;
|
||||
#endif
|
||||
|
||||
if (current.rawVertexCount > 0 && (current.forceSeparate || !System.Object.ReferenceEquals(current.material, material))) { // Material changed. Add the previous submesh.
|
||||
if (current.forceSeparate || (current.rawVertexCount > 0 && !System.Object.ReferenceEquals(current.material, material))) { // Material changed. Add the previous submesh.
|
||||
{ // Add
|
||||
current.endSlot = i;
|
||||
current.preActiveClippingSlotSource = lastPreActiveClipping;
|
||||
|
||||
@ -104,12 +104,18 @@ namespace Spine.Unity.Modules {
|
||||
|
||||
// STEP 3: modify mesh.
|
||||
var mesh = smartMesh.mesh;
|
||||
meshGenerator.FillVertexData(mesh);
|
||||
if (updateTriangles) {
|
||||
meshGenerator.FillTriangles(mesh);
|
||||
meshRenderer.sharedMaterials = buffers.GetUpdatedShaderdMaterialsArray();
|
||||
} else if (buffers.MaterialsChangedInLastUpdate()) {
|
||||
meshRenderer.sharedMaterials = buffers.GetUpdatedShaderdMaterialsArray();
|
||||
|
||||
if (meshGenerator.VertexCount <= 0) { // Clear an empty mesh
|
||||
updateTriangles = false;
|
||||
mesh.Clear();
|
||||
} else {
|
||||
meshGenerator.FillVertexData(mesh);
|
||||
if (updateTriangles) {
|
||||
meshGenerator.FillTriangles(mesh);
|
||||
meshRenderer.sharedMaterials = buffers.GetUpdatedShaderdMaterialsArray();
|
||||
} else if (buffers.MaterialsChangedInLastUpdate()) {
|
||||
meshRenderer.sharedMaterials = buffers.GetUpdatedShaderdMaterialsArray();
|
||||
}
|
||||
}
|
||||
|
||||
meshFilter.sharedMesh = mesh;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user