File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed
Assets/FbxExporters/Editor Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -9,13 +9,14 @@ namespace FbxExporters.EditorTools {
9
9
[ CustomEditor ( typeof ( ExportSettings ) ) ]
10
10
public class ExportSettingsEditor : UnityEditor . Editor {
11
11
public override void OnInspectorGUI ( ) {
12
- ExportSettings temp = ( ExportSettings ) target ;
12
+ ExportSettings exportSettings = ( ExportSettings ) target ;
13
13
14
- temp . weldVertices = EditorGUILayout . Toggle ( "Weld Vertices:" , temp . weldVertices ) ;
14
+ exportSettings . weldVertices = EditorGUILayout . Toggle ( "Weld Vertices:" , exportSettings . weldVertices ) ;
15
+ exportSettings . embedTextures = EditorGUILayout . Toggle ( "Embed Textures:" , exportSettings . embedTextures ) ;
15
16
16
17
if ( GUI . changed ) {
17
- EditorUtility . SetDirty ( temp ) ;
18
- temp . Dirty ( ) ;
18
+ EditorUtility . SetDirty ( exportSettings ) ;
19
+ exportSettings . Save ( ) ;
19
20
}
20
21
}
21
22
}
@@ -24,6 +25,7 @@ public override void OnInspectorGUI() {
24
25
public class ExportSettings : FbxExporters . EditorTools . ScriptableSingleton < ExportSettings >
25
26
{
26
27
public bool weldVertices = true ;
28
+ public bool embedTextures = false ;
27
29
28
30
[ MenuItem ( "Edit/Project Settings/Fbx Export" , priority = 300 ) ]
29
31
static void ShowManager ( )
@@ -32,7 +34,7 @@ static void ShowManager()
32
34
Selection . activeObject = instance ;
33
35
}
34
36
35
- public void Dirty ( )
37
+ public void Save ( )
36
38
{
37
39
instance . Save ( true ) ;
38
40
}
Original file line number Diff line number Diff line change @@ -507,13 +507,18 @@ public int ExportAll (IEnumerable<UnityEngine.Object> unityExportSet)
507
507
fbxManager . SetIOSettings ( FbxIOSettings . Create ( fbxManager , Globals . IOSROOT ) ) ;
508
508
509
509
// Export texture as embedded
510
- //fbxManager.GetIOSettings ().SetBoolProp (Globals.EXP_FBX_EMBEDDED, true);
510
+ if ( EditorTools . ExportSettings . instance . embedTextures ) {
511
+ fbxManager . GetIOSettings ( ) . SetBoolProp ( Globals . EXP_FBX_EMBEDDED , true ) ;
512
+ }
511
513
512
514
// Create the exporter
513
515
var fbxExporter = FbxExporter . Create ( fbxManager , "Exporter" ) ;
514
516
515
517
// Initialize the exporter.
516
- int fileFormat = fbxManager . GetIOPluginRegistry ( ) . FindWriterIDByDescription ( "FBX ascii (*.fbx)" ) ;
518
+ // fileFormat must be binary if we are embedding textures
519
+ int fileFormat = EditorTools . ExportSettings . instance . embedTextures ? - 1 :
520
+ fbxManager . GetIOPluginRegistry ( ) . FindWriterIDByDescription ( "FBX ascii (*.fbx)" ) ;
521
+
517
522
bool status = fbxExporter . Initialize ( LastFilePath , fileFormat , fbxManager . GetIOSettings ( ) ) ;
518
523
// Check that initialization of the fbxExporter was successful
519
524
if ( ! status )
You can’t perform that action at this time.
0 commit comments