mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-05 02:06:53 +08:00
[unity] Fixed Skin extension methods not copying skin bones and constraints. Closes #1556.
This commit is contained in:
parent
a2bae9dea4
commit
237b33d82f
@ -73,10 +73,14 @@ namespace Spine.Unity.AttachmentTools {
|
|||||||
public static Skin GetClone (this Skin original) {
|
public static Skin GetClone (this Skin original) {
|
||||||
var newSkin = new Skin(original.name + " clone");
|
var newSkin = new Skin(original.name + " clone");
|
||||||
var newSkinAttachments = newSkin.Attachments;
|
var newSkinAttachments = newSkin.Attachments;
|
||||||
|
var newSkinBones = newSkin.Bones;
|
||||||
|
var newSkinConstraints = newSkin.Constraints;
|
||||||
|
|
||||||
foreach (var a in original.Attachments)
|
foreach (var a in original.Attachments)
|
||||||
newSkinAttachments[a.Key] = a.Value;
|
newSkinAttachments[a.Key] = a.Value;
|
||||||
|
|
||||||
|
newSkinBones.AddRange(original.bones);
|
||||||
|
newSkinConstraints.AddRange(original.constraints);
|
||||||
return newSkin;
|
return newSkin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,6 +130,8 @@ namespace Spine.Unity.AttachmentTools {
|
|||||||
public static void CopyTo (this Skin source, Skin destination, bool overwrite, bool cloneAttachments, bool cloneMeshesAsLinked = true) {
|
public static void CopyTo (this Skin source, Skin destination, bool overwrite, bool cloneAttachments, bool cloneMeshesAsLinked = true) {
|
||||||
var sourceAttachments = source.Attachments;
|
var sourceAttachments = source.Attachments;
|
||||||
var destinationAttachments = destination.Attachments;
|
var destinationAttachments = destination.Attachments;
|
||||||
|
var destinationBones = destination.Bones;
|
||||||
|
var destinationConstraints = destination.Constraints;
|
||||||
|
|
||||||
if (cloneAttachments) {
|
if (cloneAttachments) {
|
||||||
if (overwrite) {
|
if (overwrite) {
|
||||||
@ -148,9 +154,12 @@ namespace Spine.Unity.AttachmentTools {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (BoneData data in source.bones)
|
||||||
|
if (!destinationBones.Contains(data)) destinationBones.Add(data);
|
||||||
|
|
||||||
|
foreach (ConstraintData data in source.constraints)
|
||||||
|
if (!destinationConstraints.Contains(data)) destinationConstraints.Add(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user