Skip to content

Commit 1199616

Browse files
committed
add preference for centering objects
1 parent 14b74f4 commit 1199616

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ public override void OnInspectorGUI() {
3333
" and unexpected character replacements in Maya.")
3434
),
3535
exportSettings.mayaCompatibleNames);
36-
36+
37+
exportSettings.centerObjects = EditorGUILayout.Toggle (
38+
new GUIContent("Center Objects:",
39+
"Export objects centered around the union of the bounding box of selected objects"),
40+
exportSettings.centerObjects
41+
);
42+
3743
GUILayout.BeginHorizontal ();
3844
GUILayout.Label (new GUIContent (
3945
"Model Prefab Path:",
@@ -92,6 +98,7 @@ public class ExportSettings : FbxExporters.EditorTools.ScriptableSingleton<Expor
9298
public bool weldVertices = true;
9399
public bool embedTextures = false;
94100
public bool mayaCompatibleNames = true;
101+
public bool centerObjects = true;
95102
public string convertToModelSavePath;
96103

97104
void OnEnable()

Assets/FbxExporters/Editor/FbxExporter.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -835,9 +835,7 @@ public int ExportAll (IEnumerable<UnityEngine.Object> unityExportSet)
835835
}
836836
else{
837837
// find the center of the export set
838-
Vector3 center = FindCenter(revisedExportSet);
839-
var test = GameObject.CreatePrimitive(PrimitiveType.Sphere);
840-
test.transform.position = center;
838+
Vector3 center = EditorTools.ExportSettings.instance.centerObjects? FindCenter(revisedExportSet) : Vector3.zero;
841839

842840
foreach (var unityGo in revisedExportSet) {
843841
exportProgress = this.ExportComponents (unityGo, fbxScene, fbxRootNode,

0 commit comments

Comments
 (0)