Add warning when cloth paint is incorrect size

This commit is contained in:
Wojtek Figat
2025-03-11 23:09:47 +01:00
parent 477c979cdd
commit 5d32bb962f
4 changed files with 12 additions and 1 deletions

View File

@@ -644,6 +644,7 @@ void Cloth::CalculateInvMasses(Array<float>& invMasses)
if (_paint.Count() != verticesCount)
{
// Fix incorrect paint data
LOG(Warning, "Incorrect cloth '{}' paint size {} for mesh '{}' that has {} vertices", GetNamePath(), _paint.Count(), mesh.ToString(), verticesCount);
int32 countBefore = _paint.Count();
_paint.Resize(verticesCount);
for (int32 i = countBefore; i < verticesCount; i++)
@@ -781,7 +782,10 @@ bool Cloth::OnPreUpdate()
if (mesh.Actor->GetMeshData(mesh, MeshBufferType::Vertex0, verticesData, verticesCount))
return false;
if (verticesCount != _paint.Count())
{
LOG(Warning, "Incorrect cloth '{}' paint size {} for mesh '{}' that has {} vertices", GetNamePath(), _paint.Count(), mesh.ToString(), verticesCount);
return false;
}
PROFILE_CPU_NAMED("Skinned Pose");
auto vbStride = (uint32)verticesData.Length() / verticesCount;
ASSERT(vbStride == sizeof(VB0SkinnedElementType));