Add **skeleton retargeting** to play animations on different skeletons
This commit is contained in:
@@ -782,6 +782,9 @@ bool ModelData::Pack2SkinnedModelHeader(WriteStream* stream) const
|
||||
return true;
|
||||
}
|
||||
|
||||
// Version
|
||||
stream->WriteByte(1);
|
||||
|
||||
// Min Screen Size
|
||||
stream->WriteFloat(MinScreenSize);
|
||||
|
||||
@@ -792,7 +795,6 @@ bool ModelData::Pack2SkinnedModelHeader(WriteStream* stream) const
|
||||
for (int32 materialSlotIndex = 0; materialSlotIndex < Materials.Count(); materialSlotIndex++)
|
||||
{
|
||||
auto& slot = Materials[materialSlotIndex];
|
||||
|
||||
stream->Write(slot.AssetID);
|
||||
stream->WriteByte(static_cast<byte>(slot.ShadowsMode));
|
||||
stream->WriteString(slot.Name, 11);
|
||||
@@ -878,6 +880,11 @@ bool ModelData::Pack2SkinnedModelHeader(WriteStream* stream) const
|
||||
}
|
||||
}
|
||||
|
||||
// Retargeting
|
||||
{
|
||||
stream->WriteInt32(0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ public:
|
||||
Bones.Swap(other.Bones);
|
||||
}
|
||||
|
||||
int32 FindNode(const StringView& name)
|
||||
int32 FindNode(const StringView& name) const
|
||||
{
|
||||
for (int32 i = 0; i < Nodes.Count(); i++)
|
||||
{
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32 FindBone(int32 nodeIndex)
|
||||
int32 FindBone(int32 nodeIndex) const
|
||||
{
|
||||
for (int32 i = 0; i < Bones.Count(); i++)
|
||||
{
|
||||
|
||||
@@ -331,6 +331,7 @@ bool SkinnedMesh::DownloadDataCPU(MeshBufferType type, BytesContainer& result, i
|
||||
MemoryReadStream stream(chunk->Get(), chunk->Size());
|
||||
|
||||
// Seek to find mesh location
|
||||
byte version = stream.ReadByte();
|
||||
for (int32 i = 0; i <= _index; i++)
|
||||
{
|
||||
// #MODEL_DATA_FORMAT_USAGE
|
||||
|
||||
@@ -15,6 +15,7 @@ bool SkinnedModelLOD::HasAnyMeshInitialized() const
|
||||
bool SkinnedModelLOD::Load(MemoryReadStream& stream)
|
||||
{
|
||||
// Load LOD for each mesh
|
||||
byte version = stream.ReadByte();
|
||||
for (int32 i = 0; i < Meshes.Count(); i++)
|
||||
{
|
||||
auto& mesh = Meshes[i];
|
||||
|
||||
Reference in New Issue
Block a user