From 426ffc0e8e3ca8a535bdf0d49b586a8860dafa23 Mon Sep 17 00:00:00 2001 From: tanakat01 Date: Thu, 10 Jan 2019 18:37:40 +0900 Subject: [PATCH] can handle a mission.xml file without VideoProducer elements --- marlo/base_env_builder.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/marlo/base_env_builder.py b/marlo/base_env_builder.py index 636428a..94b05da 100644 --- a/marlo/base_env_builder.py +++ b/marlo/base_env_builder.py @@ -577,8 +577,14 @@ def transform_mission_xml(self, params, mission_xml): vp = ElementTree.Element(ns + "VideoProducer") e.append(vp) w = vp.find(ns + "Width") + if w is None: + w = ElementTree.Element(ns + "Width") + vp.append(w) w.text = str(params.videoResolution[0] if params.videoResolution else '800') h = vp.find(ns + "Height") + if h is None: + h = ElementTree.Element(ns + "Height") + vp.append(h) h.text = str(params.videoResolution[1] if params.videoResolution else '600') if params.videoWithDepth is not None: vp.attrib['want_depth'] = 'true' if params.videoWithDepth else 'false'