RealtimeMeshComponent
RealtimeMeshComponent copied to clipboard
added a delegete for when mesh update is done
Added a delegate to URuntimeMesh class, which is invoked after mesh calculation in RMC's thread or game thread depending on your RMP's IsThreadSafe. This does NOT guarantee the end of rendering update. This delegate is invoked on game thread and works for both synchronous and asynchronous mesh update.
This delegate is useful if you have no collision but want to do something after mesh update, or if you want to know the end of your mesh calculation such as GetSectionMeshForLOD/GetAllSectionsMeshForLOD.
There already is CollisionUpdated delegate for collision update, but it is not that convenient because it is not called if HasCollisionMesh returns false.
also this is good because this is no cost if you don't use this unlike #227 which uses an extra thread safe counter.
Requested by @Moddingear , I added a function to RMP which can be used instead of the delegate if you want to.
I believe that an overridable function called onto the provider is better than a delegate, because it has a lower overhead and it's simpler to set up. If the user needs a delegate, they can set it up to relay that function call.
Overall the API of this addition matches the existing code for collision-updates. One notable limitation of this is that it doesn't tell you which of the mesh sections updated, but that's more of a limitation of the existing code (update to a single mesh section kind of updates them all).
@Moddingear I left the delegate because I wanted to match the collision update code which has both a delegate CollisionUpdated and an overridable function CollisionUpdateCompleted, as @connorjak said. If you don't want it, I think you better remove both.
Closing as this won't apply to the new version, but I do want to thank you for submitting this!