Skip to content

Commit e431ae3

Browse files
committed
fix merge issues
1 parent 3d186f7 commit e431ae3

File tree

2 files changed

+24
-33
lines changed

2 files changed

+24
-33
lines changed

Assets/FbxExporters/Editor/FbxExporter.cs

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2951,29 +2951,18 @@ private void ReplaceFile ()
29512951
[MenuItem(TimelineClipMenuItemName, false, 31)]
29522952
static void OnClipContextClick(MenuCommand command)
29532953
{
2954-
// Now that we know we have stuff to export, get the user-desired path.
2955-
string directory = string.IsNullOrEmpty(LastFilePath)
2956-
? Application.dataPath
2957-
: System.IO.Path.GetDirectoryName(LastFilePath);
2958-
2959-
string title = "Select the folder in which the animation files from the timeline will be exported";
2960-
string folderPath = EditorUtility.SaveFolderPanel(title, directory, "");
2961-
2962-
if (string.IsNullOrEmpty(folderPath))
2963-
{
2964-
return;
2965-
}
2966-
Debug.Log(folderPath);
2967-
29682954
Object[] selectedObjects = Selection.objects;
29692955

29702956
foreach (Object editorClipSelected in selectedObjects)
29712957
{
2972-
ExportSingleEditorClip(editorClipSelected, folderPath);
2958+
// export first selected editor clip.
2959+
if (ExportSingleEditorClip (editorClipSelected)) {
2960+
return;
2961+
}
29732962
}
29742963
}
29752964

2976-
public static void ExportSingleEditorClip(Object editorClipSelected, string folderPath)
2965+
public static bool ExportSingleEditorClip(Object editorClipSelected)
29772966
{
29782967
if (editorClipSelected.GetType().Name.Contains("EditorClip"))
29792968
{
@@ -2985,13 +2974,20 @@ public static void ExportSingleEditorClip(Object editorClipSelected, string fold
29852974
AnimationTrack editorClipAnimationTrack = selClipItemParentTrack as AnimationTrack;
29862975
GameObject animationTrackGObject = UnityEditor.Timeline.TimelineEditor.playableDirector.GetGenericBinding (editorClipAnimationTrack) as GameObject;
29872976

2988-
ExportSingleTimelineClip(timeLineClip, folderPath, animationTrackGObject);
2977+
ExportSingleTimelineClip(timeLineClip, animationTrackGObject);
2978+
return true;
29892979
}
2980+
return false;
29902981
}
29912982

2992-
public static void ExportSingleTimelineClip(TimelineClip timelineClipSelected, string folderPath, GameObject animationTrackGObject)
2983+
public static void ExportSingleTimelineClip(TimelineClip timelineClipSelected, GameObject animationTrackGObject, string filePath = null)
29932984
{
2994-
string filePath = GetExportFilePath (animationTrackGObject.name + "@" + timeLineClip.displayName);
2985+
if (string.IsNullOrEmpty (filePath)) {
2986+
filePath = GetExportFilePath (animationTrackGObject.name + "@" + timelineClipSelected.displayName);
2987+
}
2988+
if (string.IsNullOrEmpty (filePath)) {
2989+
return;
2990+
}
29952991
UnityEngine.Object[] myArray = new UnityEngine.Object[] { animationTrackGObject, timelineClipSelected.animationClip };
29962992
ExportObjects(filePath, myArray, AnimationExportType.timelineAnimationClip);
29972993
}
@@ -3040,23 +3036,19 @@ public static void OnPlayableDirectorGameObjectContextClick(MenuCommand command)
30403036

30413037
public static void ExportAllTimelineClips(GameObject objectWithPlayableDirector, string folderPath)
30423038
{
3043-
Debug.Log(objectWithPlayableDirector.GetType().BaseType.ToString() + ":" + objectWithPlayableDirector.name);
3044-
30453039
PlayableDirector pd = objectWithPlayableDirector.GetComponent<PlayableDirector>();
30463040
if (pd != null)
30473041
{
30483042
foreach (PlayableBinding output in pd.playableAsset.outputs)
30493043
{
30503044
AnimationTrack at = output.sourceObject as AnimationTrack;
30513045

3052-
GameObject atObject = pd.GetGenericBinding(output.sourceObject) as GameObject;
3053-
// One file by animation clip
3054-
foreach (TimelineClip timeLineClip in at.GetClips()) {
3055-
string filePath = string.Format(AnimFbxFileFormat, folderPath, atObject.name, timeLineClip.displayName);
3056-
UnityEngine.Object[] myArray = new UnityEngine.Object[] { atObject, timeLineClip.animationClip };
3057-
ExportObjects (filePath, myArray, AnimationExportType.timelineAnimationClip);
3058-
3059-
}
3046+
GameObject atObject = pd.GetGenericBinding(output.sourceObject) as GameObject;
3047+
// One file by animation clip
3048+
foreach (TimelineClip timeLineClip in at.GetClips()) {
3049+
string filePath = string.Format(AnimFbxFileFormat, folderPath, atObject.name, timeLineClip.displayName);
3050+
UnityEngine.Object[] myArray = new UnityEngine.Object[] { atObject, timeLineClip.animationClip };
3051+
ExportObjects (filePath, myArray, AnimationExportType.timelineAnimationClip);
30603052
}
30613053
}
30623054
}
@@ -3634,7 +3626,6 @@ private static void OnExport (AnimationExportType exportType = AnimationExportTy
36343626
/// Export a list of (Game) objects to FBX file.
36353627
/// Use the SaveFile panel to allow user to enter a file name.
36363628
/// <summary>
3637-
//public static string ExportObjects (string filePath, UnityEngine.Object[] objects = null, AnimationExportType exportType = AnimationExportType.all /*, bool animOnly = false*/)
36383629
public static string ExportObjects (
36393630
string filePath,
36403631
UnityEngine.Object[] objects = null,
@@ -3691,7 +3682,6 @@ public static string ExportObjects (
36913682
return null;
36923683
}
36933684

3694-
//public static string ExportObject (string filePath, UnityEngine.Object root, AnimationExportType exportType = AnimationExportType.all /*, bool animOnly = false*/)
36953685
public static string ExportObject (
36963686
string filePath, UnityEngine.Object root,
36973687
AnimationExportType exportType = AnimationExportType.all,

Assets/FbxExporters/Editor/UnitTests/ExportTimelineClipTest.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ public void ExportSingleTimelineClipTest()
3535
GameObject atObject = pd.GetGenericBinding (output.sourceObject) as GameObject;
3636
// One file by animation clip
3737
foreach (TimelineClip timeLineClip in at.GetClips()) {
38-
ModelExporter.ExportSingleTimelineClip (timeLineClip, folderPath, atObject);
39-
FileAssert.Exists (string.Format("{0}/{1}@{2}", folderPath, atObject.name, "Recorded.fbx"));
38+
var filePath = string.Format ("{0}/{1}@{2}", folderPath, atObject.name, "Recorded.fbx");
39+
ModelExporter.ExportSingleTimelineClip (timeLineClip, atObject, filePath);
40+
FileAssert.Exists (filePath);
4041
}
4142
}
4243
}

0 commit comments

Comments
 (0)