Skip to content

Commit a7a9c9a

Browse files
committed
Merge branch 'master' into UNI-40444-export-model-options-UI
2 parents a54d123 + 168eb78 commit a7a9c9a

17 files changed

+969
-102
lines changed

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ public override void OnInspectorGUI() {
3939
exportSettings.autoUpdaterEnabled
4040
);
4141

42+
exportSettings.exportMeshNoRenderer = EditorGUILayout.Toggle(
43+
new GUIContent("Export Unrendered:",
44+
"If checked, meshes will be exported even if they don't have a Renderer component."),
45+
exportSettings.exportMeshNoRenderer
46+
);
47+
4248
GUILayout.BeginHorizontal();
4349
EditorGUILayout.LabelField(new GUIContent(
4450
"Export Path:",
@@ -411,6 +417,7 @@ public static string[] DCCVendorLocations
411417
public bool launchAfterInstallation = true;
412418
public bool HideSendToUnityMenu = true;
413419
public bool BakeAnimation = true;
420+
public bool exportMeshNoRenderer = false;
414421

415422
public string IntegrationSavePath;
416423

Assets/FbxExporters/Editor/FbxExporter.cs

Lines changed: 133 additions & 96 deletions
Large diffs are not rendered by default.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
using UnityEngine;
2+
using UnityEditor;
3+
using NUnit.Framework;
4+
using FbxExporters.Editor;
5+
using UnityEngine.Timeline;
6+
using UnityEngine.Playables;
7+
using UnityEditor.SceneManagement;
8+
9+
namespace FbxExporters.UnitTests
10+
{
11+
public class ExportTimelineClipTest : ExporterTestBase
12+
{
13+
private static string m_testScenePath = "Scene/TestScene.unity";
14+
15+
[SetUp]
16+
public override void Init()
17+
{
18+
base.Init ();
19+
string testScenePath = FindPathInUnitTests (m_testScenePath);
20+
Assert.That (testScenePath, Is.Not.Null);
21+
EditorSceneManager.OpenScene("Assets/" + testScenePath);
22+
}
23+
24+
[Test]
25+
public void ExportSingleTimelineClipTest()
26+
{
27+
GameObject myCube = GameObject.Find("CubeSpecial");
28+
string folderPath = GetRandomFileNamePath(extName: "");
29+
30+
PlayableDirector pd = myCube.GetComponent<PlayableDirector> ();
31+
if (pd != null) {
32+
foreach (PlayableBinding output in pd.playableAsset.outputs) {
33+
AnimationTrack at = output.sourceObject as AnimationTrack;
34+
35+
GameObject atObject = pd.GetGenericBinding (output.sourceObject) as GameObject;
36+
// One file by animation clip
37+
foreach (TimelineClip timeLineClip in at.GetClips()) {
38+
var filePath = string.Format ("{0}/{1}@{2}", folderPath, atObject.name, "Recorded.fbx");
39+
ModelExporter.ExportSingleTimelineClip (timeLineClip, atObject, filePath);
40+
FileAssert.Exists (filePath);
41+
}
42+
}
43+
}
44+
}
45+
46+
[Test]
47+
public void ExportAllTimelineClipTest()
48+
{
49+
GameObject myCube = GameObject.Find("CubeSpecial");
50+
Selection.objects = new UnityEngine.GameObject[] { myCube };
51+
string folderPath = GetRandomFileNamePath(extName: "");
52+
53+
foreach(GameObject obj in Selection.objects)
54+
{
55+
ModelExporter.ExportAllTimelineClips(obj, folderPath);
56+
FileAssert.Exists(string.Format("{0}/{1}@{2}", folderPath, obj.name, "Recorded.fbx"));
57+
}
58+
}
59+
}
60+
}

Assets/FbxExporters/Editor/UnitTests/ExportTimelineClipTest.cs.meta

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/FbxExporters/Editor/UnitTests/ExporterTestBase.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ void DeleteOnNextUpdate()
194194
[TearDown]
195195
public virtual void Term ()
196196
{
197+
// Put back the initial setting for the auto-updater toggle
198+
FbxExporters.EditorTools.ExportSettings.instance.autoUpdaterEnabled = isAutoUpdaterOn;
199+
197200
if (string.IsNullOrEmpty(_testDirectory)) {
198201
return;
199202
}
@@ -213,7 +216,6 @@ public virtual void Init()
213216
FbxExporters.EditorTools.ExportSettings.instance.autoUpdaterEnabled = true;
214217
}
215218

216-
217219
/// <summary>
218220
/// Exports the Objects in selected.
219221
/// </summary>

Assets/FbxExporters/Editor/UnitTests/FbxAnimationTest.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,9 @@ public void AnimOnlyExportTest(string prefabPath)
834834

835835
// export fbx
836836
// get GameObject
837-
string filename = ExportToFbx(originalGO, true);
837+
string filename = GetRandomFbxFilePath ();
838+
var exportedFilePath = ModelExporter.ExportObject (filename, originalGO, ModelExporter.AnimationExportType.componentAnimation);
839+
Assert.That (exportedFilePath, Is.EqualTo (filename));
838840

839841
GameObject fbxObj = AssetDatabase.LoadMainAssetAtPath (filename) as GameObject;
840842
Assert.IsTrue (fbxObj);

Assets/FbxExporters/Editor/UnitTests/FbxCameraTests.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/FbxExporters/Editor/UnitTests/FbxPrefabAutoUpdaterTest.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,11 @@ public void TestNameMapping()
159159
// In FbxPrefab Component of Cube, add SphereFBX/Sphere name mapping
160160
FbxPrefab fbxPrefabScript = cubePrefabInstance.transform.GetComponent<FbxPrefab>();
161161

162-
163162
FbxPrefab.StringPair stringpair = new FbxPrefab.StringPair();
164163
stringpair.FBXObjectName = "SphereFBX";
165164
stringpair.UnityObjectName = "Sphere";
166165
fbxPrefabScript.NameMapping.Add(stringpair);
167166

168-
169167
FbxPrefabAutoUpdater.FbxPrefabUtility fbxPrefabUtility = new FbxPrefabAutoUpdater.FbxPrefabUtility(fbxPrefabScript);
170168

171169
Assert.IsTrue(fbxPrefabUtility.GetUnityObjectName("SphereFBX") == stringpair.UnityObjectName);
@@ -329,7 +327,7 @@ public void RemappingTest()
329327

330328

331329
[TearDown]
332-
public void stopTest()
330+
public void StopTest()
333331
{
334332
// Put back the initial setting for the auto-updater toggle
335333
FbxExporters.EditorTools.ExportSettings.instance.autoUpdaterEnabled = isAutoUpdaterOn;

Assets/FbxExporters/Editor/UnitTests/ModelExporterTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ public void TestComponentAttributeExport()
468468

469469
var gameObject = new GameObject ();
470470
var meshFilter = gameObject.AddComponent<MeshFilter> ();
471+
gameObject.AddComponent<MeshRenderer> ();
471472

472473
meshFilter.sharedMesh = mesh;
473474

Assets/FbxExporters/Editor/UnitTests/Scene.meta

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)