Clean-up test files.

Also, don't add a Global Settings component at import if the xml doesn't have any global settings (option/size/custom).

PiperOrigin-RevId: 495950899
Change-Id: I6599e8ea3f3a82729fc5c974fd7ced8eb93b277e
This commit is contained in:
Tom Erez
2022-12-16 13:38:54 -08:00
committed by Copybara-Service
parent 69c74f850e
commit 6a58fd1522
6 changed files with 21 additions and 14 deletions
+7 -4
View File
@@ -134,10 +134,13 @@ public class MjcfImporter {
}
protected virtual void ParseRoot(GameObject rootObject, XmlElement mujocoNode) {
var globalsObject = CreateGameObjectInParent("Global Settings", rootObject);
var settingsComponent = globalsObject.AddComponent<MjGlobalSettings>();
settingsComponent.ParseGlobalMjcfSections(mujocoNode);
if (mujocoNode.SelectSingleNode("option") != null
|| mujocoNode.SelectSingleNode("size") != null
|| mujocoNode.SelectSingleNode("custom") != null) {
var globalsObject = CreateGameObjectInParent("Global Settings", rootObject);
var settingsComponent = globalsObject.AddComponent<MjGlobalSettings>();
settingsComponent.ParseGlobalMjcfSections(mujocoNode);
}
// This makes references to assets.
var worldBodyNode = mujocoNode.SelectSingleNode("worldbody") as XmlElement;