Don't recook cloth mesh when rebuilding it

This commit is contained in:
Wojtek Figat
2023-07-17 15:34:38 +02:00
parent 868084286c
commit 3d5d7ad968

View File

@@ -1692,7 +1692,16 @@ void PhysicsBackend::EndSimulateScene(void* scene)
clothSettings.Actor->OnPostUpdate();
}
for (auto cloth : brokenCloths)
{
// Rebuild cloth object but keep fabric ref to prevent fabric recook
auto fabric = &((nv::cloth::Cloth*)cloth->_cloth)->getFabric();
Fabrics[fabric].Refs++;
fabric->incRefCount();
cloth->Rebuild();
fabric->decRefCount();
if (--Fabrics[fabric].Refs == 0)
Fabrics.Remove(fabric);
}
}
}
@@ -3460,6 +3469,7 @@ void* PhysicsBackend::CreateCloth(const PhysicsClothDesc& desc)
if (fabric)
{
Fabrics[fabric].Refs++;
fabric->incRefCount();
}
else
{