Search Unity

Exporting Multiple Timeline Clips

Discussion in 'Asset Importing & Exporting' started by andysaia, Jun 2, 2021.

  1. andysaia

    andysaia

    Joined:
    Nov 2, 2015
    Posts:
    21
    Our artists are requesting the ability to export multiple selected timeline clips as animation only fbx assets.

    Currently, the FBXExporter only supports exporting a single Timeline Clip. See code below

    Code (CSharp):
    1.         /// <summary>
    2.         /// GameObject/Export Selected Timeline Clip...
    3.         /// </summary>
    4.         /// <param name="command"></param>
    5.         [MenuItem(TimelineClipMenuItemName, false, 31)]
    6.         static void OnClipContextClick(MenuCommand command)
    7.         {
    8.             Object[] selectedObjects = Selection.objects;
    9.  
    10.             foreach (Object editorClipSelected in selectedObjects)
    11.             {
    12.                 // export first selected editor clip.
    13.                 if (IsEditorClip(editorClipSelected)) {
    14.                     ExportSingleTimelineClip(editorClipSelected);
    15.                     return;
    16.                 }
    17.             }
    18.         }
    It would be pretty simple to add this functionally ourselves by calling something like.

    Code (CSharp):
    1. var previousInclude = ExportSettings.instance.ExportModelSettings.info.ModelAnimIncludeOption;
    2. ExportSettings.instance.ExportModelSettings.info.SetModelAnimIncludeOption(ExportSettings.Include.Anim);
    3.  
    4. if (ExportObjects(filePath, exportArray, ExportSettings.instance.ExportModelSettings.info) != null)
    5. {
    6.     // refresh the asset database so that the file appears in the
    7.     // asset folder view.
    8.     AssetDatabase.Refresh();
    9. }
    10.  
    11. ExportSettings.instance.ExportModelSettings.info.SetModelAnimIncludeOption(previousInclude);
    However, several of the classes needed are internal. Specifically, the IExportData interface is needed.

    I really don't want to mod the FBX Exporter just to have access to some of these data structures. Could you guys expose some of these for extension and ideally support exporting multiple timeline clips?
     
  2. DanielAtLevelEx

    DanielAtLevelEx

    Joined:
    Jun 4, 2019
    Posts:
    12
    Interesting! We had the same issue at our studio.
     
  3. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    257
    Hi @andysaia and @unity_hit0UtLbogV6mw,

    Thank you for the feedback, we have plans to expose more of the export functions in a future release.
    I have also logged a task for adding the ability to export multiple selected timeline clips.