Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix cloth loading problems: caused by non-watertight, and potential multiple pieces #1063

Merged
merged 6 commits into from
Feb 5, 2025
Prev Previous commit
Next Next commit
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
pre-commit-ci[bot] committed Dec 25, 2024
commit ea8d531d09b0436a2f37833d509bf454947c68ef
6 changes: 4 additions & 2 deletions omnigibson/systems/micro_particle_system.py
Original file line number Diff line number Diff line change
@@ -1717,11 +1717,13 @@ def clothify_mesh_prim(self, mesh_prim, remesh=True, particle_distance=None):
# Make sure the clothes is watertight
ms.meshing_repair_non_manifold_edges()
ms.meshing_repair_non_manifold_vertices()

# If the cloth has multiple pieces, only keep the largest one
ms.generate_splitting_by_connected_components(delete_source_mesh=True)
if len(ms) > 1:
log.warning(f"The cloth mesh has {len(ms)} disconnected pieces. To simplify, we only keep the mesh with largest face number.")
log.warning(
f"The cloth mesh has {len(ms)} disconnected pieces. To simplify, we only keep the mesh with largest face number."
)
biggest_face_num = 0
for split_mesh in ms:
face_num = split_mesh.face_number()