Skip to content

Commit

Permalink
Merge pull request #7 from CarolinePascal/bugfix/lazy-save
Browse files Browse the repository at this point in the history
Adding "lazy" save case when no meshes were ever loaded
  • Loading branch information
fishbotics authored Sep 11, 2023
2 parents 3d4ed6f + ce2911c commit 5a8068a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions urchin/urdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,12 +710,13 @@ def _to_xml(self, parent, path):
fn = get_filename(path, self.filename, makedirs=True)

# Export the meshes as a single file
meshes = self.meshes
if len(meshes) == 1:
meshes = meshes[0]
elif os.path.splitext(fn)[1] == ".glb":
meshes = trimesh.scene.Scene(geometry=meshes)
trimesh.exchange.export.export_mesh(meshes, fn)
if self._meshes is not None:
meshes = self.meshes
if len(meshes) == 1:
meshes = meshes[0]
elif os.path.splitext(fn)[1] == ".glb":
meshes = trimesh.scene.Scene(geometry=meshes)
trimesh.exchange.export.export_mesh(meshes, fn)

# Unparse the node
node = self._unparse(path)
Expand Down

0 comments on commit 5a8068a

Please sign in to comment.