[unity] Fixed Skin created by GetRepackedSkin not copying bones list. Closes #1474.

This commit is contained in:
Harald Csaszar 2019-09-24 17:07:12 +02:00
parent 12ca54ab5e
commit 159d71b827
2 changed files with 19 additions and 0 deletions

View File

@ -141,6 +141,23 @@ namespace Spine {
} }
} }
// Additional overload provided because ExposedList<T> only implements IEnumerable<T>,
// leading to sub-optimal behavior: It grows multiple times as it assumes not
// to know the final size ahead of insertion.
public void AddRange (ExposedList<T> list) {
CheckCollection(list);
int collectionCount = list.Count;
if (collectionCount == 0)
return;
GrowIfNeeded(collectionCount);
list.CopyTo(Items, Count);
Count += collectionCount;
version++;
}
public void AddRange (IEnumerable<T> collection) { public void AddRange (IEnumerable<T> collection) {
CheckCollection(collection); CheckCollection(collection);

View File

@ -324,6 +324,8 @@ namespace Spine.Unity.AttachmentTools {
var skinAttachments = o.Attachments; var skinAttachments = o.Attachments;
var newSkin = new Skin(newName); var newSkin = new Skin(newName);
newSkin.bones.AddRange(o.bones);
// Use these to detect and use shared regions. // Use these to detect and use shared regions.
var existingRegions = new Dictionary<AtlasRegion, int>(); var existingRegions = new Dictionary<AtlasRegion, int>();
var regionIndexes = new List<int>(); var regionIndexes = new List<int>();