[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

@ -222,9 +222,11 @@ namespace AssetStudioGUI
{
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 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);
ExportFbx(convert, exportFullPath);
return true;
@ -232,8 +234,7 @@ namespace AssetStudioGUI
private static void ExportFbx(IImported convert, string exportPath)
{
var fbxSettings = Fbx.Settings.FromBase64(Properties.Settings.Default.fbxSettings);
ModelExporter.ExportFbx(exportPath, convert, fbxSettings);
ModelExporter.ExportFbx(exportPath, convert, Studio.FbxSettings);
}
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)
{
if (!Studio.FbxSettings.ExportAnimations)
animationList = new List<AssetItem>();
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);
exportPath = exportPath + FixFileName(gameObject.m_Name) + ".fbx";
ExportFbx(convert, exportPath);
@ -332,8 +335,10 @@ namespace AssetStudioGUI
public static void ExportGameObjectMerge(List<GameObject> gameObject, string exportPath, List<AssetItem> animationList = null)
{
var rootName = Path.GetFileNameWithoutExtension(exportPath);
if (!Studio.FbxSettings.ExportAnimations)
animationList = new List<AssetItem>();
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);
ExportFbx(convert, exportPath);
}