[unity] SkeletonRenderSeparator now respects Mask Interaction mode of parent SkeletonRenderer. Closes #1870.

This commit is contained in:
Harald Csaszar 2026-01-08 15:16:48 +01:00
parent c01a7e1203
commit 690b4bac40
4 changed files with 16 additions and 8 deletions

View File

@ -94,7 +94,9 @@ namespace Spine.Unity {
meshFilter.sharedMesh = null; meshFilter.sharedMesh = null;
} }
public void RenderParts (ExposedList<SubmeshInstruction> instructions, int startSubmesh, int endSubmesh) { public void RenderParts (SkeletonRenderer skeletonRenderer, ExposedList<SubmeshInstruction> instructions,
int startSubmesh, int endSubmesh) {
LazyIntialize(); LazyIntialize();
// STEP 1: Create instruction // STEP 1: Create instruction
@ -125,9 +127,12 @@ namespace Spine.Unity {
meshGenerator.FillVertexData(mesh); meshGenerator.FillVertexData(mesh);
if (updateTriangles) { if (updateTriangles) {
meshGenerator.FillTriangles(mesh); meshGenerator.FillTriangles(mesh);
meshRenderer.sharedMaterials = buffers.UpdateSharedMaterialsArray(); }
} else if (materialsChanged) { if (updateTriangles || materialsChanged) {
meshRenderer.sharedMaterials = buffers.UpdateSharedMaterialsArray(); Material[] materials = buffers.UpdateSharedMaterialsArray();
if (skeletonRenderer)
skeletonRenderer.ConfigureMaterials(materials, currentInstructions.submeshInstructions);
meshRenderer.sharedMaterials = materials;
} }
meshGenerator.FillLateVertexData(mesh); meshGenerator.FillLateVertexData(mesh);
} }

View File

@ -281,7 +281,7 @@ namespace Spine.Unity {
if (assignPropertyBlock) if (assignPropertyBlock)
currentRenderer.SetPropertyBlock(copiedBlock); currentRenderer.SetPropertyBlock(copiedBlock);
// Render // Render
currentRenderer.RenderParts(instruction.submeshInstructions, start, si + 1); currentRenderer.RenderParts(skeletonRenderer, instruction.submeshInstructions, start, si + 1);
start = si + 1; start = si + 1;
rendererIndex++; rendererIndex++;

View File

@ -534,8 +534,7 @@ namespace Spine.Unity {
materialsNeedUpdate = false; materialsNeedUpdate = false;
} }
protected virtual void ConfigureMaterials (ExposedList<SubmeshInstruction> instructions) { public virtual void ConfigureMaterials (Material[] sharedMaterials, ExposedList<SubmeshInstruction> instructions) {
Material[] sharedMaterials = rendererBuffers.sharedMaterials;
if (customMaterialOverride.Count > 0) { if (customMaterialOverride.Count > 0) {
for (int i = 0, count = sharedMaterials.Length; i < count; ++i) { for (int i = 0, count = sharedMaterials.Length; i < count; ++i) {
Material material = sharedMaterials[i]; Material material = sharedMaterials[i];
@ -570,6 +569,10 @@ namespace Spine.Unity {
#endif #endif
} }
protected virtual void ConfigureMaterials (ExposedList<SubmeshInstruction> instructions) {
ConfigureMaterials(rendererBuffers.sharedMaterials, instructions);
}
#if BUILT_IN_SPRITE_MASK_COMPONENT #if BUILT_IN_SPRITE_MASK_COMPONENT
private void InitSpriteMaskMaterialsMaskMode (ref MaterialOverrideSet[] maskMaterials, private void InitSpriteMaskMaterialsMaskMode (ref MaterialOverrideSet[] maskMaterials,
SkeletonRenderer skeletonRenderer, string overrideSetName, SkeletonRenderer skeletonRenderer, string overrideSetName,

View File

@ -2,7 +2,7 @@
"name": "com.esotericsoftware.spine.spine-unity", "name": "com.esotericsoftware.spine.spine-unity",
"displayName": "spine-unity Runtime", "displayName": "spine-unity Runtime",
"description": "This plugin provides the spine-unity runtime core and examples. Spine Examples can be installed via the Samples tab.", "description": "This plugin provides the spine-unity runtime core and examples. Spine Examples can be installed via the Samples tab.",
"version": "4.3.36", "version": "4.3.37",
"unity": "2018.3", "unity": "2018.3",
"author": { "author": {
"name": "Esoteric Software", "name": "Esoteric Software",