mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
[unity] Fixed broken Skeleton baking on 4.3 branch. Closes #3001.
This commit is contained in:
parent
d050ae6682
commit
5ab48156b4
@ -473,51 +473,43 @@ namespace Spine.Unity.Editor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region Attachment Baking
|
#region Attachment Baking
|
||||||
static Bone DummyBone;
|
static Skeleton DummySkeleton;
|
||||||
static Slot DummySlot;
|
static Slot DummySlot;
|
||||||
|
|
||||||
internal static Bone GetDummyBone () {
|
internal static Skeleton GetDummySkeleton () {
|
||||||
if (DummyBone != null)
|
if (DummySkeleton != null)
|
||||||
return DummyBone;
|
return DummySkeleton;
|
||||||
|
|
||||||
SkeletonData skelData = new SkeletonData();
|
SkeletonData skelData = new SkeletonData();
|
||||||
BoneData data = new BoneData(0, "temp", null) {
|
BoneData boneData = new BoneData(0, "temp", null) {
|
||||||
Length = 100
|
Length = 100
|
||||||
};
|
};
|
||||||
var setup = data.GetSetupPose();
|
var setup = boneData.GetSetupPose();
|
||||||
setup.ScaleX = setup.ScaleY = 1;
|
setup.ScaleX = setup.ScaleY = 1;
|
||||||
|
|
||||||
skelData.Bones.Add(data);
|
skelData.Bones.Add(boneData);
|
||||||
|
|
||||||
Skeleton skeleton = new Skeleton(skelData);
|
SlotData slotData = new SlotData(0, "temp", boneData);
|
||||||
|
skelData.Slots.Add(slotData);
|
||||||
|
|
||||||
Bone bone = new Bone(data, null);
|
DummySkeleton = new Skeleton(skelData);
|
||||||
bone.AppliedPose.UpdateWorldTransform(skeleton);
|
DummySkeleton.UpdateWorldTransform(Physics.Update);
|
||||||
|
|
||||||
DummyBone = bone;
|
return DummySkeleton;
|
||||||
|
|
||||||
return DummyBone;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static Skeleton GetDummySkeleton () {
|
|
||||||
SkeletonData skelData = new SkeletonData();
|
|
||||||
return new Skeleton(skelData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static Slot GetDummySlot () {
|
internal static Slot GetDummySlot () {
|
||||||
if (DummySlot != null)
|
if (DummySlot != null)
|
||||||
return DummySlot;
|
return DummySlot;
|
||||||
|
|
||||||
Bone bone = GetDummyBone();
|
|
||||||
Skeleton skeleton = GetDummySkeleton();
|
Skeleton skeleton = GetDummySkeleton();
|
||||||
SlotData data = new SlotData(0, "temp", bone.Data);
|
DummySlot = skeleton.Slots.Items[0];
|
||||||
Slot slot = new Slot(data, skeleton);
|
|
||||||
DummySlot = slot;
|
|
||||||
return DummySlot;
|
return DummySlot;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static Mesh ExtractRegionAttachment (string name, RegionAttachment attachment, Mesh mesh = null, bool centered = true) {
|
internal static Mesh ExtractRegionAttachment (string name, RegionAttachment attachment, Mesh mesh = null, bool centered = true) {
|
||||||
Slot slot = GetDummySlot();
|
Skeleton skeleton = GetDummySkeleton();
|
||||||
|
Slot slot = skeleton.Slots.Items[0];
|
||||||
Bone bone = slot.Bone;
|
Bone bone = slot.Bone;
|
||||||
|
|
||||||
if (centered) {
|
if (centered) {
|
||||||
@ -525,7 +517,6 @@ namespace Spine.Unity.Editor {
|
|||||||
bone.Pose.Y = -attachment.Y;
|
bone.Pose.Y = -attachment.Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
Skeleton skeleton = GetDummySkeleton();
|
|
||||||
bone.AppliedPose.UpdateWorldTransform(skeleton);
|
bone.AppliedPose.UpdateWorldTransform(skeleton);
|
||||||
|
|
||||||
float[] floatVerts = new float[8];
|
float[] floatVerts = new float[8];
|
||||||
@ -559,8 +550,8 @@ namespace Spine.Unity.Editor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal static Mesh ExtractMeshAttachment (string name, MeshAttachment attachment, Mesh mesh = null) {
|
internal static Mesh ExtractMeshAttachment (string name, MeshAttachment attachment, Mesh mesh = null) {
|
||||||
Slot slot = GetDummySlot();
|
|
||||||
Skeleton skeleton = GetDummySkeleton();
|
Skeleton skeleton = GetDummySkeleton();
|
||||||
|
Slot slot = skeleton.Slots.Items[0];
|
||||||
|
|
||||||
slot.Bone.Pose.X = 0;
|
slot.Bone.Pose.X = 0;
|
||||||
slot.Bone.Pose.Y = 0;
|
slot.Bone.Pose.Y = 0;
|
||||||
|
|||||||
@ -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.34",
|
"version": "4.3.35",
|
||||||
"unity": "2018.3",
|
"unity": "2018.3",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Esoteric Software",
|
"name": "Esoteric Software",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user