Преглед на файлове

[unity] Fixed SkeletonRenderSeparator mesh being broken with slot alpha 0. Closes #2532.

Harald Csaszar преди 1 година
родител
ревизия
330e646c08

+ 2 - 0
spine-unity/Assets/Spine/Runtime/spine-unity/Mesh Generation/MeshGenerator.cs

@@ -39,6 +39,8 @@
 // Comment out this line to revert to previous behaviour.
 // You may only need this option disabled when utilizing a custom shader which
 // uses vertex color alpha for purposes other than transparency.
+//
+// Important Note: When disabling this define, also disable the one in SkeletonRenderInstruction.cs
 #define SLOT_ALPHA_DISABLES_ATTACHMENT
 
 using System;

+ 12 - 1
spine-unity/Assets/Spine/Runtime/spine-unity/Mesh Generation/SkeletonRendererInstruction.cs

@@ -31,6 +31,10 @@
 #define SPINE_TRIANGLECHECK // Avoid calling SetTriangles at the cost of checking for mesh differences (vertex counts, memberwise attachment list compare) every frame.
 //#define SPINE_DEBUG
 
+// Important Note: When disabling this define, also disable the one in MeshGenerator.cs
+// For details, see MeshGenerator.cs.
+#define SLOT_ALPHA_DISABLES_ATTACHMENT
+
 using System;
 using System.Collections.Generic;
 using UnityEngine;
@@ -95,7 +99,14 @@ namespace Spine.Unity {
 			Slot[] drawOrderItems = instructionsItems[0].skeleton.DrawOrder.Items;
 			for (int i = 0; i < attachmentCount; i++) {
 				Slot slot = drawOrderItems[startSlot + i];
-				if (!slot.Bone.Active) continue;
+				if (!slot.Bone.Active
+#if SLOT_ALPHA_DISABLES_ATTACHMENT
+					|| slot.A == 0f
+#endif
+					) {
+					attachmentsItems[i] = null;
+					continue;
+				}
 				attachmentsItems[i] = slot.Attachment;
 			}
 

+ 1 - 1
spine-unity/Assets/Spine/package.json

@@ -2,7 +2,7 @@
 	"name": "com.esotericsoftware.spine.spine-unity",
 	"displayName": "spine-unity Runtime",
 	"description": "This plugin provides the spine-unity runtime core.",
-	"version": "4.2.64",
+	"version": "4.2.65",
 	"unity": "2018.3",
 	"author": {
 		"name": "Esoteric Software",