From ce2911cc3320dffe04f0b6ad44e0280119ccd607 Mon Sep 17 00:00:00 2001 From: CarolinePascal Date: Thu, 15 Jun 2023 16:48:39 +0200 Subject: [PATCH] Adding save case where no meshes were ever loaded --- urchin/urdf.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/urchin/urdf.py b/urchin/urdf.py index db15834..f509549 100644 --- a/urchin/urdf.py +++ b/urchin/urdf.py @@ -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)