mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-22 02:06:03 +08:00
[unity] Fixed BoundingBoxFollower and BoundingBoxFollowerGraphic ignoring deactivated skin bone. Closes #2836.
This commit is contained in:
parent
ff572ec8a4
commit
480a4b18b7
@ -57,7 +57,7 @@ namespace Spine.Unity {
|
|||||||
BoundingBoxAttachment currentAttachment;
|
BoundingBoxAttachment currentAttachment;
|
||||||
string currentAttachmentName;
|
string currentAttachmentName;
|
||||||
PolygonCollider2D currentCollider;
|
PolygonCollider2D currentCollider;
|
||||||
|
bool skinBoneEnabled = true;
|
||||||
public readonly Dictionary<BoundingBoxAttachment, PolygonCollider2D> colliderTable = new Dictionary<BoundingBoxAttachment, PolygonCollider2D>();
|
public readonly Dictionary<BoundingBoxAttachment, PolygonCollider2D> colliderTable = new Dictionary<BoundingBoxAttachment, PolygonCollider2D>();
|
||||||
public readonly Dictionary<BoundingBoxAttachment, string> nameTable = new Dictionary<BoundingBoxAttachment, string>();
|
public readonly Dictionary<BoundingBoxAttachment, string> nameTable = new Dictionary<BoundingBoxAttachment, string>();
|
||||||
|
|
||||||
@ -132,6 +132,7 @@ namespace Spine.Unity {
|
|||||||
AddCollidersForSkin(skeleton.Skin, slotIndex, colliders, ref requiredCollidersCount);
|
AddCollidersForSkin(skeleton.Skin, slotIndex, colliders, ref requiredCollidersCount);
|
||||||
}
|
}
|
||||||
DisposeExcessCollidersAfter(requiredCollidersCount);
|
DisposeExcessCollidersAfter(requiredCollidersCount);
|
||||||
|
skinBoneEnabled = slot.Bone.Active;
|
||||||
|
|
||||||
if (BoundingBoxFollower.DebugMessages) {
|
if (BoundingBoxFollower.DebugMessages) {
|
||||||
bool valid = colliderTable.Count != 0;
|
bool valid = colliderTable.Count != 0;
|
||||||
@ -210,8 +211,10 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LateUpdate () {
|
void LateUpdate () {
|
||||||
if (slot != null && slot.Attachment != currentAttachment)
|
if (slot != null && (slot.Attachment != currentAttachment || skinBoneEnabled != slot.Bone.Active)) {
|
||||||
|
skinBoneEnabled = slot.Bone.Active;
|
||||||
MatchAttachment(slot.Attachment);
|
MatchAttachment(slot.Attachment);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Sets the current collider to match attachment.</summary>
|
/// <summary>Sets the current collider to match attachment.</summary>
|
||||||
@ -225,7 +228,7 @@ namespace Spine.Unity {
|
|||||||
if (currentCollider != null)
|
if (currentCollider != null)
|
||||||
currentCollider.enabled = false;
|
currentCollider.enabled = false;
|
||||||
|
|
||||||
if (bbAttachment == null) {
|
if (bbAttachment == null || !skinBoneEnabled) {
|
||||||
currentCollider = null;
|
currentCollider = null;
|
||||||
currentAttachment = null;
|
currentAttachment = null;
|
||||||
currentAttachmentName = null;
|
currentAttachmentName = null;
|
||||||
|
|||||||
@ -57,7 +57,7 @@ namespace Spine.Unity {
|
|||||||
BoundingBoxAttachment currentAttachment;
|
BoundingBoxAttachment currentAttachment;
|
||||||
string currentAttachmentName;
|
string currentAttachmentName;
|
||||||
PolygonCollider2D currentCollider;
|
PolygonCollider2D currentCollider;
|
||||||
|
bool skinBoneEnabled = true;
|
||||||
public readonly Dictionary<BoundingBoxAttachment, PolygonCollider2D> colliderTable = new Dictionary<BoundingBoxAttachment, PolygonCollider2D>();
|
public readonly Dictionary<BoundingBoxAttachment, PolygonCollider2D> colliderTable = new Dictionary<BoundingBoxAttachment, PolygonCollider2D>();
|
||||||
public readonly Dictionary<BoundingBoxAttachment, string> nameTable = new Dictionary<BoundingBoxAttachment, string>();
|
public readonly Dictionary<BoundingBoxAttachment, string> nameTable = new Dictionary<BoundingBoxAttachment, string>();
|
||||||
|
|
||||||
@ -133,6 +133,7 @@ namespace Spine.Unity {
|
|||||||
AddCollidersForSkin(skeleton.Skin, slotIndex, colliders, scale, ref requiredCollidersCount);
|
AddCollidersForSkin(skeleton.Skin, slotIndex, colliders, scale, ref requiredCollidersCount);
|
||||||
}
|
}
|
||||||
DisposeExcessCollidersAfter(requiredCollidersCount);
|
DisposeExcessCollidersAfter(requiredCollidersCount);
|
||||||
|
skinBoneEnabled = slot.Bone.Active;
|
||||||
|
|
||||||
if (BoundingBoxFollowerGraphic.DebugMessages) {
|
if (BoundingBoxFollowerGraphic.DebugMessages) {
|
||||||
bool valid = colliderTable.Count != 0;
|
bool valid = colliderTable.Count != 0;
|
||||||
@ -211,8 +212,10 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LateUpdate () {
|
void LateUpdate () {
|
||||||
if (slot != null && slot.Attachment != currentAttachment)
|
if (slot != null && (slot.Attachment != currentAttachment || skinBoneEnabled != slot.Bone.Active)) {
|
||||||
|
skinBoneEnabled = slot.Bone.Active;
|
||||||
MatchAttachment(slot.Attachment);
|
MatchAttachment(slot.Attachment);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Sets the current collider to match attachment.</summary>
|
/// <summary>Sets the current collider to match attachment.</summary>
|
||||||
|
|||||||
@ -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.",
|
"description": "This plugin provides the spine-unity runtime core.",
|
||||||
"version": "4.2.102",
|
"version": "4.2.103",
|
||||||
"unity": "2018.3",
|
"unity": "2018.3",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Esoteric Software",
|
"name": "Esoteric Software",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user