Skip to content

Commit 12cecee

Browse files
authored
Merge pull request #203 from Unity-Technologies/Uni-25217_option_to_export_in_Binary
Uni-25217 option to export in Binary or ascii
2 parents 535e28e + 22d3fc1 commit 12cecee

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ public override void OnInspectorGUI() {
4545
exportSettings.centerObjects
4646
);
4747

48+
EditorGUILayout.Space();
49+
50+
GUILayout.BeginHorizontal();
51+
GUILayout.Label(new GUIContent("Export Format:", "Export the FBX file in the standard binary format." +
52+
" Select ASCII to export the FBX file in ASCII format."), GUILayout.Width(LabelWidth - 3));
53+
exportSettings.ExportFormatSelection = EditorGUILayout.Popup(exportSettings.ExportFormatSelection, new string[]{"Binary", "ASCII"});
54+
GUILayout.EndHorizontal();
55+
56+
EditorGUILayout.Space();
57+
4858
GUILayout.BeginHorizontal ();
4959
GUILayout.Label (new GUIContent (
5060
"Export Path:",
@@ -146,7 +156,9 @@ public override void OnInspectorGUI() {
146156
}
147157
GUILayout.EndHorizontal ();
148158

149-
var installIntegrationContent = new GUIContent(
159+
EditorGUILayout.Space();
160+
161+
var installIntegrationContent = new GUIContent(
150162
"Install Unity Integration",
151163
"Install and configure the Unity integration for the selected 3D application so that you can import and export directly with this project.");
152164
if (GUILayout.Button (installIntegrationContent)) {
@@ -246,6 +258,7 @@ public static string kDefaultAdskRoot {
246258
public bool mayaCompatibleNames;
247259
public bool centerObjects;
248260
public bool launchAfterInstallation;
261+
public int ExportFormatSelection;
249262

250263
public int selectedDCCApp = 0;
251264

@@ -274,6 +287,7 @@ protected override void LoadDefaults()
274287
mayaCompatibleNames = true;
275288
centerObjects = true;
276289
launchAfterInstallation = true;
290+
ExportFormatSelection = 0;
277291
convertToModelSavePath = kDefaultSavePath;
278292
dccOptionPaths = null;
279293
dccOptionNames = null;

Assets/FbxExporters/Editor/FbxExporter.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ public class ModelExporter : System.IDisposable
5454

5555
public const string PACKAGE_UI_NAME = "FBX Exporter";
5656

57+
public enum ExportFormat
58+
{
59+
Binary = 0,
60+
ASCII = 1
61+
}
62+
5763
/// <summary>
5864
/// Create instance of exporter.
5965
/// </summary>
@@ -981,7 +987,11 @@ public int ExportAll (IEnumerable<UnityEngine.Object> unityExportSet)
981987

982988
// Initialize the exporter.
983989
// fileFormat must be binary if we are embedding textures
984-
int fileFormat = fbxManager.GetIOPluginRegistry ().FindWriterIDByDescription ("FBX ascii (*.fbx)");
990+
int fileFormat = -1;
991+
if (EditorTools.ExportSettings.instance.ExportFormatSelection == (int)ExportFormat.ASCII)
992+
{
993+
fileFormat = fbxManager.GetIOPluginRegistry().FindWriterIDByDescription("FBX ascii (*.fbx)");
994+
}
985995

986996
status = fbxExporter.Initialize (m_tempFilePath, fileFormat, fbxManager.GetIOSettings ());
987997
// Check that initialization of the fbxExporter was successful

0 commit comments

Comments
 (0)