[GUI] Some fixes for animation export

- Disabled animation converting if animation export is disabled in the options
- Fixed a bug with ignoring animation selection order when exporting models with selected animationClips via the “Model” tab
This commit is contained in:
VaDiM
2025-08-10 02:23:22 +03:00
parent 054906a426
commit be11fdf14f
6 changed files with 82 additions and 79 deletions

View File

@@ -267,7 +267,7 @@ namespace AssetStudioCLI
} }
var m_Animator = (Animator)item.Asset; var m_Animator = (Animator)item.Asset;
var convert = animationList != null var convert = animationList != null
? new ModelConverter(m_Animator, CLIOptions.o_imageFormat.Value, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) ? new ModelConverter(m_Animator, CLIOptions.o_imageFormat.Value, animationList.Select(x => (AnimationClip)x.Asset).ToList())
: new ModelConverter(m_Animator, CLIOptions.o_imageFormat.Value); : new ModelConverter(m_Animator, CLIOptions.o_imageFormat.Value);
ExportFbx(convert, exportFullPath); ExportFbx(convert, exportFullPath);
return true; return true;
@@ -370,7 +370,7 @@ namespace AssetStudioCLI
public static void ExportGameObject(GameObject gameObject, string exportPath, List<AssetItem> animationList = null) public static void ExportGameObject(GameObject gameObject, string exportPath, List<AssetItem> animationList = null)
{ {
var convert = animationList != null var convert = animationList != null
? new ModelConverter(gameObject, CLIOptions.o_imageFormat.Value, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) ? new ModelConverter(gameObject, CLIOptions.o_imageFormat.Value, animationList.Select(x => (AnimationClip)x.Asset).ToList())
: new ModelConverter(gameObject, CLIOptions.o_imageFormat.Value); : new ModelConverter(gameObject, CLIOptions.o_imageFormat.Value);
var modelName = FixFileName(gameObject.m_Name); var modelName = FixFileName(gameObject.m_Name);
var exportFullPath = Path.Combine(exportPath, "FBX_GameObjects", modelName, modelName + ".fbx"); var exportFullPath = Path.Combine(exportPath, "FBX_GameObjects", modelName, modelName + ".fbx");

View File

@@ -150,10 +150,7 @@ namespace AssetStudioGUI
assetsManager.Options.BundleOptions.DecompressToDisk = Properties.Settings.Default.decompressToDisk; assetsManager.Options.BundleOptions.DecompressToDisk = Properties.Settings.Default.decompressToDisk;
FMODinit(); FMODinit();
listSearchFilterMode.SelectedIndex = 0; listSearchFilterMode.SelectedIndex = 0;
if (string.IsNullOrEmpty(Properties.Settings.Default.fbxSettings)) FbxInitOptions(Properties.Settings.Default.fbxSettings);
{
FBXinitOptions();
}
logger = new GUILogger(StatusStripUpdate); logger = new GUILogger(StatusStripUpdate);
Logger.Default = logger; Logger.Default = logger;
@@ -1700,26 +1697,18 @@ namespace AssetStudioGUI
private void exportAnimatorWithAnimationClipMenuItem_Click(object sender, EventArgs e) private void exportAnimatorWithAnimationClipMenuItem_Click(object sender, EventArgs e)
{ {
AssetItem animator = null;
var selectedAssets = GetSelectedAssets(); var selectedAssets = GetSelectedAssets();
foreach (var assetPreloadData in selectedAssets) var animator = selectedAssets.FirstOrDefault(x => x.Type == ClassIDType.Animator);
{ if (animator == null)
if (assetPreloadData.Type == ClassIDType.Animator) return;
{
animator = assetPreloadData;
}
}
if (animator != null) var saveFolderDialog = new OpenFolderDialog();
saveFolderDialog.InitialFolder = saveDirectoryBackup;
if (saveFolderDialog.ShowDialog(this) == DialogResult.OK)
{ {
var saveFolderDialog = new OpenFolderDialog(); saveDirectoryBackup = saveFolderDialog.Folder;
saveFolderDialog.InitialFolder = saveDirectoryBackup; var exportPath = Path.Combine(saveFolderDialog.Folder, "Animator") + Path.DirectorySeparatorChar;
if (saveFolderDialog.ShowDialog(this) == DialogResult.OK) ExportAnimatorWithAnimationClip(animator, selectedAnimationAssetsList, exportPath);
{
saveDirectoryBackup = saveFolderDialog.Folder;
var exportPath = Path.Combine(saveFolderDialog.Folder, "Animator") + Path.DirectorySeparatorChar;
ExportAnimatorWithAnimationClip(animator, selectedAnimationAssetsList, exportPath);
}
} }
} }
@@ -1744,13 +1733,9 @@ namespace AssetStudioGUI
saveDirectoryBackup = saveFolderDialog.Folder; saveDirectoryBackup = saveFolderDialog.Folder;
var exportPath = Path.Combine(saveFolderDialog.Folder, "GameObject") + Path.DirectorySeparatorChar; var exportPath = Path.Combine(saveFolderDialog.Folder, "GameObject") + Path.DirectorySeparatorChar;
List<AssetItem> animationList = null; List<AssetItem> animationList = null;
if (animation) if(animation && selectedAnimationAssetsList.Count > 0)
{ {
animationList = GetSelectedAssets().Where(x => x.Type == ClassIDType.AnimationClip).ToList(); animationList = selectedAnimationAssetsList;
if (animationList.Count == 0)
{
animationList = null;
}
} }
ExportObjectsWithAnimationClip(exportPath, sceneTreeView.Nodes, animationList); ExportObjectsWithAnimationClip(exportPath, sceneTreeView.Nodes, animationList);
} }
@@ -1789,13 +1774,9 @@ namespace AssetStudioGUI
saveDirectoryBackup = Path.GetDirectoryName(saveFileDialog.FileName); saveDirectoryBackup = Path.GetDirectoryName(saveFileDialog.FileName);
var exportPath = saveFileDialog.FileName; var exportPath = saveFileDialog.FileName;
List<AssetItem> animationList = null; List<AssetItem> animationList = null;
if (animation) if (animation && selectedAnimationAssetsList.Count > 0)
{ {
animationList = GetSelectedAssets().Where(x => x.Type == ClassIDType.AnimationClip).ToList(); animationList = selectedAnimationAssetsList;
if (animationList.Count == 0)
{
animationList = null;
}
} }
ExportObjectsMergeWithAnimationClip(exportPath, gameObjects, animationList); ExportObjectsMergeWithAnimationClip(exportPath, gameObjects, animationList);
} }
@@ -2672,10 +2653,18 @@ namespace AssetStudioGUI
Properties.Settings.Default.Save(); Properties.Settings.Default.Save();
} }
private void FBXinitOptions() private static void FbxInitOptions(string base64String)
{ {
Properties.Settings.Default.fbxSettings = new Fbx.Settings().ToBase64(); if (string.IsNullOrEmpty(base64String))
Properties.Settings.Default.Save(); {
Studio.FbxSettings = new Fbx.Settings();
Properties.Settings.Default.fbxSettings = Studio.FbxSettings.ToBase64();
Properties.Settings.Default.Save();
}
else
{
Studio.FbxSettings = Fbx.Settings.FromBase64(base64String);
}
} }
#region FMOD #region FMOD

View File

@@ -1,5 +1,6 @@
using AssetStudio; using AssetStudio;
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
@@ -7,7 +8,7 @@ namespace AssetStudioGUI
{ {
public partial class ExportOptions : Form public partial class ExportOptions : Form
{ {
private static Fbx.Settings fbxSettings; private static Dictionary<int, int> uvBindings;
public ExportOptions() public ExportOptions()
{ {
@@ -34,8 +35,7 @@ namespace AssetStudioGUI
((RadioButton)l2dMotionExportMethodPanel.Controls.Cast<Control>().First(x => x.AccessibleName == defaultMotionMode)).Checked = true; ((RadioButton)l2dMotionExportMethodPanel.Controls.Cast<Control>().First(x => x.AccessibleName == defaultMotionMode)).Checked = true;
l2dForceBezierCheckBox.Checked = Properties.Settings.Default.l2dForceBezier; l2dForceBezierCheckBox.Checked = Properties.Settings.Default.l2dForceBezier;
fbxSettings = Fbx.Settings.FromBase64(Properties.Settings.Default.fbxSettings); SetFromFbxSettings(Studio.FbxSettings);
SetFromFbxSettings();
} }
private void OKbutton_Click(object sender, EventArgs e) private void OKbutton_Click(object sender, EventArgs e)
@@ -58,26 +58,27 @@ namespace AssetStudioGUI
Properties.Settings.Default.l2dMotionMode = (CubismLive2DExtractor.Live2DMotionMode)Enum.Parse(typeof(CubismLive2DExtractor.Live2DMotionMode), checkedMotionMode.AccessibleName); Properties.Settings.Default.l2dMotionMode = (CubismLive2DExtractor.Live2DMotionMode)Enum.Parse(typeof(CubismLive2DExtractor.Live2DMotionMode), checkedMotionMode.AccessibleName);
Properties.Settings.Default.l2dForceBezier = l2dForceBezierCheckBox.Checked; Properties.Settings.Default.l2dForceBezier = l2dForceBezierCheckBox.Checked;
fbxSettings.EulerFilter = eulerFilter.Checked; Studio.FbxSettings.EulerFilter = eulerFilter.Checked;
fbxSettings.FilterPrecision = (float)filterPrecision.Value; Studio.FbxSettings.FilterPrecision = (float)filterPrecision.Value;
fbxSettings.ExportAllNodes = exportAllNodes.Checked; Studio.FbxSettings.ExportAllNodes = exportAllNodes.Checked;
fbxSettings.ExportSkins = exportSkins.Checked; Studio.FbxSettings.ExportSkins = exportSkins.Checked;
fbxSettings.ExportAnimations = exportAnimations.Checked; Studio.FbxSettings.ExportAnimations = exportAnimations.Checked;
fbxSettings.ExportBlendShape = exportBlendShape.Checked; Studio.FbxSettings.ExportBlendShape = exportBlendShape.Checked;
fbxSettings.CastToBone = castToBone.Checked; Studio.FbxSettings.CastToBone = castToBone.Checked;
fbxSettings.ExportAllUvsAsDiffuseMaps = exportAllUvsAsDiffuseMaps.Checked; Studio.FbxSettings.ExportAllUvsAsDiffuseMaps = exportAllUvsAsDiffuseMaps.Checked;
fbxSettings.BoneSize = (int)boneSize.Value; Studio.FbxSettings.BoneSize = (int)boneSize.Value;
fbxSettings.ScaleFactor = (float)scaleFactor.Value; Studio.FbxSettings.ScaleFactor = (float)scaleFactor.Value;
fbxSettings.FbxVersionIndex = fbxVersion.SelectedIndex; Studio.FbxSettings.FbxVersionIndex = fbxVersion.SelectedIndex;
fbxSettings.FbxFormat = fbxFormat.SelectedIndex; Studio.FbxSettings.FbxFormat = fbxFormat.SelectedIndex;
for (var i = 0; i < uvIndicesCheckedListBox.Items.Count; i++) for (var i = 0; i < uvIndicesCheckedListBox.Items.Count; i++)
{ {
var isChecked = uvIndicesCheckedListBox.GetItemChecked(i); var isChecked = uvIndicesCheckedListBox.GetItemChecked(i);
var type = fbxSettings.UvBindings[i]; var type = uvBindings[i];
if ((isChecked && type < 0) || (!isChecked && type > 0)) if ((isChecked && type < 0) || (!isChecked && type > 0))
fbxSettings.UvBindings[i] *= -1; uvBindings[i] *= -1;
} }
Properties.Settings.Default.fbxSettings = fbxSettings.ToBase64(); Studio.FbxSettings.UvBindings = uvBindings;
Properties.Settings.Default.fbxSettings = Studio.FbxSettings.ToBase64();
Properties.Settings.Default.Save(); Properties.Settings.Default.Save();
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
@@ -100,7 +101,7 @@ namespace AssetStudioGUI
if (exportAllUvsAsDiffuseMaps.Checked) if (exportAllUvsAsDiffuseMaps.Checked)
return; return;
if (fbxSettings.UvBindings.TryGetValue(uvIndicesCheckedListBox.SelectedIndex, out var uvType)) if (uvBindings.TryGetValue(uvIndicesCheckedListBox.SelectedIndex, out var uvType))
{ {
uvTypesListBox.SelectedIndex = (int)MathF.Abs(uvType) - 1; uvTypesListBox.SelectedIndex = (int)MathF.Abs(uvType) - 1;
} }
@@ -109,7 +110,7 @@ namespace AssetStudioGUI
private void uvTypesListBox_SelectedIndexChanged(object sender, EventArgs e) private void uvTypesListBox_SelectedIndexChanged(object sender, EventArgs e)
{ {
var selectedUv = uvIndicesCheckedListBox.SelectedIndex; var selectedUv = uvIndicesCheckedListBox.SelectedIndex;
fbxSettings.UvBindings[selectedUv] = uvTypesListBox.SelectedIndex + 1; uvBindings[selectedUv] = uvTypesListBox.SelectedIndex + 1;
} }
private void exportAllUvsAsDiffuseMaps_CheckedChanged(object sender, EventArgs e) private void exportAllUvsAsDiffuseMaps_CheckedChanged(object sender, EventArgs e)
@@ -118,7 +119,7 @@ namespace AssetStudioGUI
uvIndicesCheckedListBox.Enabled = !exportAllUvsAsDiffuseMaps.Checked; uvIndicesCheckedListBox.Enabled = !exportAllUvsAsDiffuseMaps.Checked;
} }
private void SetFromFbxSettings() private void SetFromFbxSettings(Fbx.Settings fbxSettings)
{ {
eulerFilter.Checked = fbxSettings.EulerFilter; eulerFilter.Checked = fbxSettings.EulerFilter;
filterPrecision.Value = (decimal)fbxSettings.FilterPrecision; filterPrecision.Value = (decimal)fbxSettings.FilterPrecision;
@@ -132,9 +133,10 @@ namespace AssetStudioGUI
scaleFactor.Value = (decimal)fbxSettings.ScaleFactor; scaleFactor.Value = (decimal)fbxSettings.ScaleFactor;
fbxVersion.SelectedIndex = fbxSettings.FbxVersionIndex; fbxVersion.SelectedIndex = fbxSettings.FbxVersionIndex;
fbxFormat.SelectedIndex = fbxSettings.FbxFormat; fbxFormat.SelectedIndex = fbxSettings.FbxFormat;
uvBindings = new Dictionary<int, int>(fbxSettings.UvBindings);
for (var i = 0; i < uvIndicesCheckedListBox.Items.Count; i++) for (var i = 0; i < uvIndicesCheckedListBox.Items.Count; i++)
{ {
var isChecked = fbxSettings.UvBindings[i] > 0; var isChecked = uvBindings[i] > 0;
uvIndicesCheckedListBox.SetItemChecked(i, isChecked); uvIndicesCheckedListBox.SetItemChecked(i, isChecked);
} }
uvTypesListBox.Enabled = !exportAllUvsAsDiffuseMaps.Checked; uvTypesListBox.Enabled = !exportAllUvsAsDiffuseMaps.Checked;
@@ -143,8 +145,7 @@ namespace AssetStudioGUI
private void resetButton_Click(object sender, EventArgs e) private void resetButton_Click(object sender, EventArgs e)
{ {
fbxSettings.Init(); SetFromFbxSettings(new Fbx.Settings());
SetFromFbxSettings();
uvIndicesCheckedListBox_SelectedIndexChanged(sender, e); uvIndicesCheckedListBox_SelectedIndexChanged(sender, e);
} }
} }

View File

@@ -222,9 +222,11 @@ namespace AssetStudioGUI
{ {
exportFullPath = Path.Combine(exportPath, item.Text + item.UniqueID, item.Text + ".fbx"); exportFullPath = Path.Combine(exportPath, item.Text + item.UniqueID, item.Text + ".fbx");
} }
if (!Studio.FbxSettings.ExportAnimations)
animationList = new List<AssetItem>();
var m_Animator = (Animator)item.Asset; var m_Animator = (Animator)item.Asset;
var convert = animationList != null var convert = animationList != null
? new ModelConverter(m_Animator, Properties.Settings.Default.convertType, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) ? new ModelConverter(m_Animator, Properties.Settings.Default.convertType, animationList.Select(x => (AnimationClip)x.Asset).ToList())
: new ModelConverter(m_Animator, Properties.Settings.Default.convertType); : new ModelConverter(m_Animator, Properties.Settings.Default.convertType);
ExportFbx(convert, exportFullPath); ExportFbx(convert, exportFullPath);
return true; return true;
@@ -232,8 +234,7 @@ namespace AssetStudioGUI
private static void ExportFbx(IImported convert, string exportPath) private static void ExportFbx(IImported convert, string exportPath)
{ {
var fbxSettings = Fbx.Settings.FromBase64(Properties.Settings.Default.fbxSettings); ModelExporter.ExportFbx(exportPath, convert, Studio.FbxSettings);
ModelExporter.ExportFbx(exportPath, convert, fbxSettings);
} }
public static bool ExportRawFile(AssetItem item, string exportPath) public static bool ExportRawFile(AssetItem item, string exportPath)
@@ -322,8 +323,10 @@ namespace AssetStudioGUI
public static void ExportGameObject(GameObject gameObject, string exportPath, List<AssetItem> animationList = null) public static void ExportGameObject(GameObject gameObject, string exportPath, List<AssetItem> animationList = null)
{ {
if (!Studio.FbxSettings.ExportAnimations)
animationList = new List<AssetItem>();
var convert = animationList != null var convert = animationList != null
? new ModelConverter(gameObject, Properties.Settings.Default.convertType, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) ? new ModelConverter(gameObject, Properties.Settings.Default.convertType, animationList.Select(x => (AnimationClip)x.Asset).ToList())
: new ModelConverter(gameObject, Properties.Settings.Default.convertType); : new ModelConverter(gameObject, Properties.Settings.Default.convertType);
exportPath = exportPath + FixFileName(gameObject.m_Name) + ".fbx"; exportPath = exportPath + FixFileName(gameObject.m_Name) + ".fbx";
ExportFbx(convert, exportPath); ExportFbx(convert, exportPath);
@@ -332,8 +335,10 @@ namespace AssetStudioGUI
public static void ExportGameObjectMerge(List<GameObject> gameObject, string exportPath, List<AssetItem> animationList = null) public static void ExportGameObjectMerge(List<GameObject> gameObject, string exportPath, List<AssetItem> animationList = null)
{ {
var rootName = Path.GetFileNameWithoutExtension(exportPath); var rootName = Path.GetFileNameWithoutExtension(exportPath);
if (!Studio.FbxSettings.ExportAnimations)
animationList = new List<AssetItem>();
var convert = animationList != null var convert = animationList != null
? new ModelConverter(rootName, gameObject, Properties.Settings.Default.convertType, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) ? new ModelConverter(rootName, gameObject, Properties.Settings.Default.convertType, animationList.Select(x => (AnimationClip)x.Asset).ToList())
: new ModelConverter(rootName, gameObject, Properties.Settings.Default.convertType); : new ModelConverter(rootName, gameObject, Properties.Settings.Default.convertType);
ExportFbx(convert, exportPath); ExportFbx(convert, exportPath);
} }

View File

@@ -90,6 +90,7 @@ namespace AssetStudioGUI
public static Dictionary<MonoBehaviour, CubismModel> l2dModelDict = new Dictionary<MonoBehaviour, CubismModel>(); public static Dictionary<MonoBehaviour, CubismModel> l2dModelDict = new Dictionary<MonoBehaviour, CubismModel>();
private static Dictionary<Object, string> l2dAssetContainers = new Dictionary<Object, string>(); private static Dictionary<Object, string> l2dAssetContainers = new Dictionary<Object, string>();
internal static Action<string> StatusStripUpdate = x => { }; internal static Action<string> StatusStripUpdate = x => { };
internal static Fbx.Settings FbxSettings;
public static int ExtractFolder(string path, string savePath) public static int ExtractFolder(string path, string savePath)
{ {
@@ -861,7 +862,6 @@ namespace AssetStudioGUI
{ {
Progress.Reset(); Progress.Reset();
Logger.Info($"Exporting {animator.Text}"); Logger.Info($"Exporting {animator.Text}");
Logger.Debug($"Selected AnimationClip(s):\n\"{string.Join("\"\n\"", animationList.Select(x => x.Text))}\"");
try try
{ {
ExportAnimator(animator, exportPath, animationList); ExportAnimator(animator, exportPath, animationList);

View File

@@ -23,14 +23,16 @@ namespace AssetStudio
private Dictionary<Transform, ImportedFrame> transformDictionary = new Dictionary<Transform, ImportedFrame>(); private Dictionary<Transform, ImportedFrame> transformDictionary = new Dictionary<Transform, ImportedFrame>();
Dictionary<uint, string> morphChannelNames = new Dictionary<uint, string>(); Dictionary<uint, string> morphChannelNames = new Dictionary<uint, string>();
private IEqualityComparer<AnimationClip> animationClipEqComparer = new AnimationClip.EqComparer(); private IEqualityComparer<AnimationClip> animationClipEqComparer = new AnimationClip.EqComparer();
private bool collectAnimationClips;
public ModelConverter(GameObject m_GameObject, ImageFormat imageFormat, AnimationClip[] animationList = null) public ModelConverter(GameObject m_GameObject, ImageFormat imageFormat, List<AnimationClip> animationList = null)
{ {
collectAnimationClips = animationList == null;
this.imageFormat = imageFormat; this.imageFormat = imageFormat;
if (m_GameObject.m_Animator != null) if (m_GameObject.m_Animator != null)
{ {
InitWithAnimator(m_GameObject.m_Animator); InitWithAnimator(m_GameObject.m_Animator);
if (animationList == null) if (collectAnimationClips)
{ {
CollectAnimationClip(m_GameObject.m_Animator); CollectAnimationClip(m_GameObject.m_Animator);
} }
@@ -39,20 +41,22 @@ namespace AssetStudio
{ {
InitWithGameObject(m_GameObject); InitWithGameObject(m_GameObject);
} }
if (animationList != null) if (animationList != null && animationList.Count > 0)
{ {
Logger.Debug($"Selected AnimationClip(s):\n\"{string.Join("\"\n\"", animationList.Select(x => x.m_Name))}\"");
animationClipUniqArray = animationList.Distinct(animationClipEqComparer).ToArray(); animationClipUniqArray = animationList.Distinct(animationClipEqComparer).ToArray();
} }
ConvertAnimations(); ConvertAnimations();
} }
public ModelConverter(string rootName, List<GameObject> m_GameObjects, ImageFormat imageFormat, AnimationClip[] animationList = null) public ModelConverter(string rootName, List<GameObject> m_GameObjects, ImageFormat imageFormat, List<AnimationClip> animationList = null)
{ {
collectAnimationClips = animationList == null;
this.imageFormat = imageFormat; this.imageFormat = imageFormat;
RootFrame = CreateFrame(rootName, Vector3.Zero, new Quaternion(0, 0, 0, 0), Vector3.One); RootFrame = CreateFrame(rootName, Vector3.Zero, new Quaternion(0, 0, 0, 0), Vector3.One);
foreach (var m_GameObject in m_GameObjects) foreach (var m_GameObject in m_GameObjects)
{ {
if (m_GameObject.m_Animator != null && animationList == null) if (m_GameObject.m_Animator != null && collectAnimationClips)
{ {
CollectAnimationClip(m_GameObject.m_Animator); CollectAnimationClip(m_GameObject.m_Animator);
} }
@@ -66,23 +70,26 @@ namespace AssetStudio
var m_Transform = m_GameObject.m_Transform; var m_Transform = m_GameObject.m_Transform;
ConvertMeshRenderer(m_Transform); ConvertMeshRenderer(m_Transform);
} }
if (animationList != null) if (animationList != null && animationList.Count > 0)
{ {
Logger.Debug($"Selected AnimationClip(s):\n\"{string.Join("\"\n\"", animationList.Select(x => x.m_Name))}\"");
animationClipUniqArray = animationList.Distinct(animationClipEqComparer).ToArray(); animationClipUniqArray = animationList.Distinct(animationClipEqComparer).ToArray();
} }
ConvertAnimations(); ConvertAnimations();
} }
public ModelConverter(Animator m_Animator, ImageFormat imageFormat, AnimationClip[] animationList = null) public ModelConverter(Animator m_Animator, ImageFormat imageFormat, List<AnimationClip> animationList = null)
{ {
collectAnimationClips = animationList == null;
this.imageFormat = imageFormat; this.imageFormat = imageFormat;
InitWithAnimator(m_Animator); InitWithAnimator(m_Animator);
if (animationList == null) if (collectAnimationClips)
{ {
CollectAnimationClip(m_Animator); CollectAnimationClip(m_Animator);
} }
else else if (animationList?.Count > 0)
{ {
Logger.Debug($"Selected AnimationClip(s):\n\"{string.Join("\"\n\"", animationList.Select(x => x.m_Name))}\"");
animationClipUniqArray = animationList.Distinct(animationClipEqComparer).ToArray(); animationClipUniqArray = animationList.Distinct(animationClipEqComparer).ToArray();
} }
ConvertAnimations(); ConvertAnimations();
@@ -150,7 +157,7 @@ namespace AssetStudio
ConvertMeshRenderer(m_GameObject.m_SkinnedMeshRenderer); ConvertMeshRenderer(m_GameObject.m_SkinnedMeshRenderer);
} }
if (m_GameObject.m_Animation != null) if (m_GameObject.m_Animation != null && collectAnimationClips)
{ {
var animationList = new List<AnimationClip>(); var animationList = new List<AnimationClip>();
foreach (var animation in m_GameObject.m_Animation.m_Animations) foreach (var animation in m_GameObject.m_Animation.m_Animations)
@@ -775,7 +782,8 @@ namespace AssetStudio
private void ConvertAnimations() private void ConvertAnimations()
{ {
var totalCount = animationClipUniqArray.Length; var totalCount = animationClipUniqArray.Length;
Logger.Info($"Trying to convert {totalCount} animation(s)..."); if (totalCount > 0)
Logger.Info($"Trying to convert {totalCount} animation(s)...");
for (var k = 0; k < totalCount; k++) for (var k = 0; k < totalCount; k++)
{ {