Skip to content

Commit e604eec

Browse files
inwoodsvkovec
authored andcommitted
remove isTimeLine from ExportObjects
1 parent e06ad24 commit e604eec

File tree

3 files changed

+209
-202
lines changed

3 files changed

+209
-202
lines changed

Assets/com.unity.formats.fbx.tests/ExportTimelineClipTest.cs

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using UnityEngine.Timeline;
66
using UnityEngine.Playables;
77
using UnityEditor.SceneManagement;
8+
using System.Collections.Generic;
89

910
namespace FbxExporters.UnitTests
1011
{
@@ -22,35 +23,31 @@ public void ExportSingleTimelineClipTest()
2223
{
2324
GameObject myCube = GameObject.Find("CubeSpecial");
2425
string folderPath = GetRandomFileNamePath(extName: "");
26+
string filePath = null;
27+
var exportData = new Dictionary<GameObject, ModelExporter.IExportData>();
2528

2629
PlayableDirector pd = myCube.GetComponent<PlayableDirector> ();
2730
if (pd != null) {
2831
foreach (PlayableBinding output in pd.playableAsset.outputs) {
2932
AnimationTrack at = output.sourceObject as AnimationTrack;
3033

3134
GameObject atObject = pd.GetGenericBinding (output.sourceObject) as GameObject;
35+
Assert.That (atObject, Is.Not.Null);
36+
3237
// One file by animation clip
3338
foreach (TimelineClip timeLineClip in at.GetClips()) {
34-
var filePath = string.Format ("{0}/{1}@{2}", folderPath, atObject.name, "Recorded.fbx");
35-
ModelExporterReflection.ExportSingleTimelineClip (timeLineClip, atObject, filePath);
36-
FileAssert.Exists (filePath);
39+
Assert.That (timeLineClip.animationClip, Is.Not.Null);
40+
41+
filePath = string.Format ("{0}/{1}@{2}", folderPath, atObject.name, "Recorded.fbx");
42+
exportData[atObject] = ModelExporter.GetExportData(atObject, timeLineClip.animationClip);
43+
break;
3744
}
3845
}
3946
}
40-
}
41-
42-
[Test]
43-
public void ExportAllTimelineClipTest()
44-
{
45-
GameObject myCube = GameObject.Find("CubeSpecial");
46-
Selection.objects = new UnityEngine.GameObject[] { myCube };
47-
string folderPath = GetRandomFileNamePath(extName: "");
48-
49-
foreach(GameObject obj in Selection.objects)
50-
{
51-
ModelExporterReflection.ExportAllTimelineClips(obj, folderPath);
52-
FileAssert.Exists(string.Format("{0}/{1}@{2}", folderPath, obj.name, "Recorded.fbx"));
53-
}
47+
Assert.That (filePath, Is.Not.Null);
48+
Assert.That (exportData, Is.Not.Null);
49+
ModelExporter.ExportObjects(filePath, new Object[1]{myCube}, null, exportData);
50+
FileAssert.Exists (filePath);
5451
}
5552
}
5653
}

Packages/com.unity.formats.fbx/Editor/Scripts/ExportModelEditorWindow.cs

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -396,15 +396,15 @@ public class ExportModelEditorWindow : ExportOptionsEditorWindow
396396
protected override float MinWindowHeight { get { return 310; } } // determined by trial and error
397397
protected override bool DisableNameSelection {
398398
get {
399-
return IsPlayableDirector;
399+
return false;
400400
}
401401
}
402402
protected override bool DisableTransferAnim {
403403
get {
404404
// don't transfer animation if we are exporting more than one hierarchy, the timeline clips from
405405
// a playable director, or if only the model is being exported
406406
// if we are on the timeline then export length can be more than 1
407-
return ToExport == null || ToExport.Length == 0 || (!IsTimelineAnim && ToExport.Length > 1) || IsPlayableDirector || SettingsObject.ModelAnimIncludeOption == ExportSettings.Include.Model;
407+
return ToExport == null || ToExport.Length == 0 || (!IsTimelineAnim && ToExport.Length > 1) || SettingsObject.ModelAnimIncludeOption == ExportSettings.Include.Model;
408408
}
409409
}
410410

@@ -441,14 +441,6 @@ protected bool SingleHierarchyExport {
441441
}
442442
}
443443

444-
private bool m_isPlayableDirector = false;
445-
protected bool IsPlayableDirector {
446-
get { return m_isPlayableDirector; }
447-
set {
448-
m_isPlayableDirector = value;
449-
}
450-
}
451-
452444
protected override ExportOptionsSettingsSerializeBase SettingsObject
453445
{
454446
get { return ExportSettings.instance.exportModelSettings.info; }
@@ -460,7 +452,6 @@ public static void Init (IEnumerable<UnityEngine.Object> toExport, string filena
460452
{
461453
ExportModelEditorWindow window = CreateWindow<ExportModelEditorWindow> ();
462454
window.IsTimelineAnim = isTimelineAnim;
463-
window.IsPlayableDirector = isPlayableDirector;
464455

465456
int numObjects = window.SetGameObjectsToExport (toExport);
466457
if (string.IsNullOrEmpty (filename)) {
@@ -543,20 +534,6 @@ protected override bool Export(){
543534
return false;
544535
}
545536

546-
if (IsPlayableDirector) {
547-
foreach (var obj in ToExport) {
548-
var go = ModelExporter.GetGameObject (obj);
549-
if (!go) {
550-
continue;
551-
}
552-
ModelExporter.ExportAllTimelineClips (go, folderPath, SettingsObject);
553-
}
554-
// refresh the asset database so that the file appears in the
555-
// asset folder view.
556-
AssetDatabase.Refresh ();
557-
return true;
558-
}
559-
560537
if (ModelExporter.ExportObjects (filePath, ToExport, SettingsObject) != null) {
561538
// refresh the asset database so that the file appears in the
562539
// asset folder view.

0 commit comments

Comments
 (0)