diff --git a/urchin/urdf.py b/urchin/urdf.py index e15b383..80e8a05 100644 --- a/urchin/urdf.py +++ b/urchin/urdf.py @@ -1054,10 +1054,13 @@ def _to_xml(self, parent, path): color.attrib["rgba"] = np.array2string(self.color)[1:-1] node.append(color) - # For non-top-level elements just save the material with a name else: node = ET.Element("material") node.attrib["name"] = self.name + if self.color is not None: + color = ET.Element("color") + color.attrib["rgba"] = np.array2string(self.color)[1:-1] + node.append(color) return node def copy(self, prefix="", scale=None):