Skip to content

Commit

Permalink
Make materials unique (#29)
Browse files Browse the repository at this point in the history
Convert materials to ordered set instead of list to prevent duplication and .mjcf compile errors
  • Loading branch information
AlexKaravaev authored Mar 17, 2024
1 parent 98b7a4d commit 96bdbc0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions obj2mjcf/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ def process_obj(filename: Path, args: Args) -> None:
sub_mtls = [smtl]
mtls = [Material.from_string(smtl)]

mtls = list({obj.name: obj for obj in mtls}.values())

# Delete any MTL files that were created during trimesh processing, if any.
for file in [
x for x in work_dir.glob("**/*") if x.is_file() and "material_0" in x.name
Expand Down

0 comments on commit 96bdbc0

Please sign in to comment.