diff --git a/AssetStudioGUI/AssetStudioGUI.csproj b/AssetStudioGUI/AssetStudioGUI.csproj
index 548402c..0afc83c 100644
--- a/AssetStudioGUI/AssetStudioGUI.csproj
+++ b/AssetStudioGUI/AssetStudioGUI.csproj
@@ -87,7 +87,6 @@
-
AssetStudioGUIForm.cs
diff --git a/AssetStudioGUI/Exporter.cs b/AssetStudioGUI/Exporter.cs
index 66b58e4..af83c22 100644
--- a/AssetStudioGUI/Exporter.cs
+++ b/AssetStudioGUI/Exporter.cs
@@ -324,14 +324,18 @@ namespace AssetStudioGUI
exportFullPath = Path.Combine(exportPath, item.Text + item.UniqueID, item.Text + ".fbx");
}
var m_Animator = (Animator)item.Asset;
- var convert = animationList != null ? new ModelConverter(m_Animator, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) : new ModelConverter(m_Animator);
+ 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);
ExportFbx(convert, exportFullPath);
return true;
}
public static void ExportGameObject(GameObject gameObject, string exportPath, List animationList = null)
{
- var convert = animationList != null ? new ModelConverter(gameObject, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) : new ModelConverter(gameObject);
+ 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);
exportPath = exportPath + FixFileName(gameObject.m_Name) + ".fbx";
ExportFbx(convert, exportPath);
}
@@ -339,7 +343,9 @@ namespace AssetStudioGUI
public static void ExportGameObjectMerge(List gameObject, string exportPath, List animationList = null)
{
var rootName = Path.GetFileNameWithoutExtension(exportPath);
- var convert = animationList != null ? new ModelConverter(rootName, gameObject, animationList.Select(x => (AnimationClip)x.Asset).ToArray()) : new ModelConverter(rootName, gameObject);
+ 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);
ExportFbx(convert, exportPath);
}
diff --git a/AssetStudioUtility/AssetStudioUtility.csproj b/AssetStudioUtility/AssetStudioUtility.csproj
index dd4072a..780f4d6 100644
--- a/AssetStudioUtility/AssetStudioUtility.csproj
+++ b/AssetStudioUtility/AssetStudioUtility.csproj
@@ -73,6 +73,7 @@
+
diff --git a/AssetStudioUtility/ModelConverter.cs b/AssetStudioUtility/ModelConverter.cs
index e24cbb7..c19b0c8 100644
--- a/AssetStudioUtility/ModelConverter.cs
+++ b/AssetStudioUtility/ModelConverter.cs
@@ -4,6 +4,7 @@ using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
+using TGASharpLib;
namespace AssetStudio
{
@@ -16,6 +17,7 @@ namespace AssetStudio
public List AnimationList { get; protected set; } = new List();
public List MorphList { get; protected set; } = new List();
+ private string imageFormat;
private Avatar avatar;
private HashSet animationClipHashSet = new HashSet();
private Dictionary bonePathHash = new Dictionary();
@@ -23,8 +25,9 @@ namespace AssetStudio
private Dictionary transformDictionary = new Dictionary();
Dictionary morphChannelNames = new Dictionary();
- public ModelConverter(GameObject m_GameObject, AnimationClip[] animationList = null)
+ public ModelConverter(GameObject m_GameObject, string imageFormat, AnimationClip[] animationList = null)
{
+ this.imageFormat = imageFormat;
if (m_GameObject.m_Animator != null)
{
InitWithAnimator(m_GameObject.m_Animator);
@@ -47,8 +50,9 @@ namespace AssetStudio
ConvertAnimations();
}
- public ModelConverter(string rootName, List m_GameObjects, AnimationClip[] animationList = null)
+ public ModelConverter(string rootName, List m_GameObjects, string imageFormat, AnimationClip[] animationList = null)
{
+ this.imageFormat = imageFormat;
RootFrame = CreateFrame(rootName, Vector3.Zero, new Quaternion(0, 0, 0, 0), Vector3.One);
foreach (var m_GameObject in m_GameObjects)
{
@@ -76,8 +80,9 @@ namespace AssetStudio
ConvertAnimations();
}
- public ModelConverter(Animator m_Animator, AnimationClip[] animationList = null)
+ public ModelConverter(Animator m_Animator, string imageFormat, AnimationClip[] animationList = null)
{
+ this.imageFormat = imageFormat;
InitWithAnimator(m_Animator);
if (animationList == null)
{
@@ -689,15 +694,16 @@ namespace AssetStudio
texture.Dest = dest;
+ var ext = $".{imageFormat.ToLower()}";
if (textureNameDictionary.TryGetValue(m_Texture2D, out var textureName))
{
texture.Name = textureName;
}
- else if (ImportedHelpers.FindTexture(m_Texture2D.m_Name + ".png", TextureList) != null) //已有相同名字的图片
+ else if (ImportedHelpers.FindTexture(m_Texture2D.m_Name + ext, TextureList) != null) //已有相同名字的图片
{
for (int i = 1; ; i++)
{
- var name = m_Texture2D.m_Name + $" ({i}).png";
+ var name = m_Texture2D.m_Name + $" ({i}){ext}";
if (ImportedHelpers.FindTexture(name, TextureList) == null)
{
texture.Name = name;
@@ -708,7 +714,7 @@ namespace AssetStudio
}
else
{
- texture.Name = m_Texture2D.m_Name + ".png";
+ texture.Name = m_Texture2D.m_Name + ext;
textureNameDictionary.Add(m_Texture2D, texture.Name);
}
@@ -739,7 +745,22 @@ namespace AssetStudio
{
using (var stream = new MemoryStream())
{
- bitmap.Save(stream, ImageFormat.Png);
+ switch (imageFormat)
+ {
+ case "BMP":
+ bitmap.Save(stream, ImageFormat.Bmp);
+ break;
+ case "PNG":
+ bitmap.Save(stream, ImageFormat.Png);
+ break;
+ case "JPEG":
+ bitmap.Save(stream, ImageFormat.Jpeg);
+ break;
+ case "TGA":
+ var tga = new TGA(bitmap);
+ tga.Save(stream);
+ break;
+ }
iTex = new ImportedTexture(stream, name);
TextureList.Add(iTex);
bitmap.Dispose();
diff --git a/AssetStudioGUI/TGASharpLib.cs b/AssetStudioUtility/TGASharpLib.cs
similarity index 100%
rename from AssetStudioGUI/TGASharpLib.cs
rename to AssetStudioUtility/TGASharpLib.cs