Fixed Skin#copySkin to take into account parent meshes.

This commit is contained in:
badlogic 2019-04-30 16:09:49 +02:00
parent ff5b854860
commit f1e199b2bd
2 changed files with 14 additions and 3 deletions

View File

@ -81,10 +81,19 @@ public class Skin {
for (SkinEntry entry : skin.attachments.keys()) {
Attachment attachment = entry.getAttachment().copy();
if (attachment instanceof MeshAttachment) {
}
setAttachment(entry.getSlotIndex(), entry.getName(), attachment);
}
for (SkinEntry entry : attachments.keys()) {
Attachment attachment = entry.getAttachment();
if (attachment instanceof MeshAttachment) {
MeshAttachment mesh = (MeshAttachment)attachment;
if (mesh.getParentMesh() != null) {
mesh.setParentMesh((MeshAttachment)getAttachment(entry.getSlotIndex(), mesh.getParentMesh().getName()));
mesh.updateUVs();
}
}
}
}
/** Returns the attachment for the specified slot index and name, or null. */

View File

@ -278,8 +278,10 @@ public class MeshAttachment extends VertexAttachment {
}
copy.width = width;
copy.height = height;
} else
} else {
copy.setParentMesh(parentMesh);
copy.updateUVs();
}
return copy;
}