Optimize when colliders are regenerated for imported meshes #88045
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request fixes unnecessary regeneration of collision shapes in the import dialog. The old logic recalculated the colliders for every mesh in the model - including for meshes that did not have physics colliders enabled, and for meshes with existing colliders whose settings had not been modified.
This was not a problem for simple models; however @yythlj encountered this attempting to import the shop_house.zip model which consists of:
Changing physics settings on any mesh resulted in calculating colliders for all 1176 meshes, which takes so long I gave up trying to measure it. This behavior is now modified to only calculate the collider for a mesh under the following circumstances:
For the shop_house model described above; if collision happened to be enabled for all 1176 meshes there would still be an unavoidable enormous delay on opening the import dialog so the collider meshes could be calculated for preview.
The following video demonstrates opening the import settings on the shop_house model with a few colliders enabled, then toggling the collider-generation on a few meshes and re-importing.
2024-02-06.22-58-29.mp4