Skip to content

Commit 3192f69

Browse files
committed
removed URDF export from document root.
1 parent 4f82961 commit 3192f69

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

Editor/CustomEditors/ZODocumentRootEditor.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
using System.Collections;
22
using System.Collections.Generic;
3+
using System.Xml.Linq;
4+
using System.IO;
35
using UnityEngine;
46
using UnityEditor;
57
using ZO.Document;
6-
8+
using ZO.ImportExport;
79

810
namespace ZO.Editor {
911

@@ -40,15 +42,22 @@ public override void OnInspectorGUI() {
4042
}
4143
*/
4244
if (GUILayout.Button("Export URDF...")) {
43-
Debug.Log("INFO: ZOSimDocumentRoot Save URDF");
45+
4446
_URDFExportDirectory = EditorUtility.OpenFolderPanel("Select URDF export directory", _URDFExportDirectory, "");
4547

4648
if (_URDFExportDirectory.Length == 0) {
4749
return;
4850
} else if (!System.IO.Directory.Exists(_URDFExportDirectory)) {
4951
EditorUtility.DisplayDialog("URDF Export Error", "Export root folder must be defined and folder must exist.", "Ok");
5052
} else {
51-
documentRoot.ExportURDF(_URDFExportDirectory);
53+
// documentRoot.ExportURDF(_URDFExportDirectory);
54+
ZOExportURDF exportURDF = new ZOExportURDF();
55+
XDocument urdfXML = exportURDF.BuildURDF(documentRoot);
56+
string urdfFilePath = Path.Combine(_URDFExportDirectory, $"{documentRoot.Name}.urdf");
57+
urdfXML.Save(urdfFilePath);
58+
59+
Debug.Log($"INFO: ZOSimDocumentRoot Saved URDF: {urdfFilePath}");
60+
5261
}
5362

5463

Runtime/Scripts/Document/ZOSimDocumentRoot.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ public string Name {
6969
set => gameObject.name = value;
7070
}
7171

72-
public string URDFExportDirectory {
73-
get; set;
74-
} = "";
7572

7673
private static AssetBundle _assetBundle = null;
7774

@@ -247,19 +244,7 @@ public ZOSimOccurrence GetOccurrence(string occurrenceName) {
247244
return null;
248245
}
249246

250-
public void ExportURDF(string exportDirectory) {
251-
URDFExportDirectory = exportDirectory;
252247

253-
ZOExportURDF exportURDF = new ZOExportURDF();
254-
XDocument urdfXML = exportURDF.BuildURDF(this);
255-
string urdfFilePath = Path.Combine(URDFExportDirectory, $"{Name}.urdf");
256-
urdfXML.Save(urdfFilePath);
257-
258-
}
259-
260-
public void ImportURDF(string urdfFilePath) {
261-
//TODO
262-
}
263248
/// <summary>
264249
/// Saves to ZOSim file.
265250
/// </summary>

0 commit comments

Comments
 (0)