diff --git a/obj2mjcf/cli.py b/obj2mjcf/cli.py index 77c77ff..559976f 100644 --- a/obj2mjcf/cli.py +++ b/obj2mjcf/cli.py @@ -238,7 +238,9 @@ def process_obj(filename: Path, args: Args) -> None: break sub_mtls = [smtl] mtls = [Material.from_string(smtl)] - + + mtls = list(dict.fromkeys(mtls)) + # 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 diff --git a/obj2mjcf/material.py b/obj2mjcf/material.py index a61f5a6..dca59b3 100644 --- a/obj2mjcf/material.py +++ b/obj2mjcf/material.py @@ -4,7 +4,7 @@ from obj2mjcf import constants -@dataclass +@dataclass(frozen=True) class Material: """A convenience class for constructing MuJoCo materials from MTL files."""