File tree Expand file tree Collapse file tree 2 files changed +12
-18
lines changed
Expand file tree Collapse file tree 2 files changed +12
-18
lines changed Original file line number Diff line number Diff line change 11using System . Collections ;
22using System . Collections . Generic ;
3+ using System . Xml . Linq ;
4+ using System . IO ;
35using UnityEngine ;
46using UnityEditor ;
57using ZO . Document ;
6-
8+ using ZO . ImportExport ;
79
810namespace 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
Original file line number Diff line number Diff 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>
You can’t perform that action at this time.
0 commit comments