Skip to content

Commit 2dc9154

Browse files
authored
Merge pull request #349 from Unity-Technologies/UNI-41969-restore-include-setting
UNI-41969 restore include setting
2 parents 499ddca + 4a9c644 commit 2dc9154

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

Assets/FbxExporters/Editor/ExportModelEditorWindow.cs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections;
1+
using System.Collections;
22
using System.Collections.Generic;
33
using UnityEngine;
44
using UnityEditor;
@@ -413,6 +413,7 @@ protected bool IsTimelineAnim {
413413
set{
414414
m_isTimelineAnim = value;
415415
if (m_isTimelineAnim) {
416+
m_previousInclude = ExportSettings.instance.exportModelSettings.info.ModelAnimIncludeOption;
416417
ExportSettings.instance.exportModelSettings.info.SetModelAnimIncludeOption(ExportSettings.Include.Anim);
417418
}
418419
if (m_innerEditor) {
@@ -452,6 +453,8 @@ protected override ExportOptionsSettingsSerializeBase SettingsObject
452453
get { return ExportSettings.instance.exportModelSettings.info; }
453454
}
454455

456+
private ExportSettings.Include m_previousInclude = ExportSettings.Include.ModelAndAnim;
457+
455458
public static void Init (IEnumerable<UnityEngine.Object> toExport, string filename = "", bool isTimelineAnim = false, bool isPlayableDirector = false)
456459
{
457460
ExportModelEditorWindow window = CreateWindow<ExportModelEditorWindow> ();
@@ -510,12 +513,28 @@ protected override void OnEnable ()
510513
}
511514
}
512515

516+
protected void OnDisable()
517+
{
518+
RestoreSettings ();
519+
}
520+
521+
/// <summary>
522+
/// Restore changed export settings after export
523+
/// </summary>
524+
protected virtual void RestoreSettings()
525+
{
526+
if (IsTimelineAnim) {
527+
ExportSettings.instance.exportModelSettings.info.SetModelAnimIncludeOption(m_previousInclude);
528+
SaveExportSettings ();
529+
}
530+
}
531+
532+
513533
protected override bool Export(){
514534
if (string.IsNullOrEmpty (m_exportFileName)) {
515535
Debug.LogError ("FbxExporter: Please specify an fbx filename");
516536
return false;
517537
}
518-
519538
var folderPath = ExportSettings.GetFbxAbsoluteSavePath ();
520539
var filePath = System.IO.Path.Combine (folderPath, m_exportFileName + ".fbx");
521540

0 commit comments

Comments
 (0)