private void DrawExportSection() { HoudiniGeo houdiniGeo = target as HoudiniGeo; serializedObject.Update(); // Nicely format the export related field and buttons. EditorGUILayout.BeginHorizontal(); GUI.enabled = !string.IsNullOrEmpty(exportPathProperty.stringValue) && exportPathProperty.stringValue.EndsWith("." + HoudiniGeo.EXTENSION); bool pressedExport = GUILayout.Button("Export", GUILayout.Width(75)); GUI.enabled = true; EditorGUILayout.PropertyField(exportPathProperty, GUIContent.none); bool pressedPick = GUILayout.Button("...", GUILayout.Width(25)); EditorGUILayout.EndHorizontal(); if (pressedExport) { HoudiniGeoFileExporter.Export(houdiniGeo); } // Show a nice dialog for picking a directory. if (pressedPick) { string directory, fileName; if (string.IsNullOrEmpty(exportPathProperty.stringValue)) { directory = Application.dataPath; fileName = "Geometry"; } else { directory = Path.GetDirectoryName(exportPathProperty.stringValue); fileName = Path.GetFileName(exportPathProperty.stringValue); } exportPathProperty.stringValue = EditorUtility.SaveFilePanel( "GEO File to Export", directory, fileName, HoudiniGeo.EXTENSION); } serializedObject.ApplyModifiedProperties(); }
public static void Export(this HoudiniGeo houdiniGeo, string path = null) { HoudiniGeoFileExporter.Export(houdiniGeo, path); }