diff --git a/AssetStudioCLI/Exporter.cs b/AssetStudioCLI/Exporter.cs index 131dbea..0b2761b 100644 --- a/AssetStudioCLI/Exporter.cs +++ b/AssetStudioCLI/Exporter.cs @@ -140,20 +140,12 @@ namespace AssetStudioCLI private static void ExportFbx(IImported convert, string exportPath) { - var eulerFilter = true; - var filterPrecision = 0.25f; - var exportAllNodes = true; - var exportSkins = true; - var exportAnimations = true; - var exportBlendShape = true; - var castToBone = false; - var boneSize = CLIOptions.o_fbxBoneSize.Value; - var exportAllUvsAsDiffuseMaps = false; - var scaleFactor = CLIOptions.o_fbxScaleFactor.Value; - var fbxVersion = 3; - var fbxFormat = 0; - ModelExporter.ExportFbx(exportPath, convert, eulerFilter, filterPrecision, - exportAllNodes, exportSkins, exportAnimations, exportBlendShape, castToBone, boneSize, exportAllUvsAsDiffuseMaps, scaleFactor, fbxVersion, fbxFormat == 1); + var fbxSettings = new Fbx.Settings + { + BoneSize = CLIOptions.o_fbxBoneSize.Value, + ScaleFactor = CLIOptions.o_fbxScaleFactor.Value, + }; + ModelExporter.ExportFbx(exportPath, convert, fbxSettings); } public static bool ExportRawFile(AssetItem item, string exportPath) diff --git a/AssetStudioCLI/Libraries/linux-x64/libAssetStudioFBXNative.so b/AssetStudioCLI/Libraries/linux-x64/libAssetStudioFBXNative.so index 6ee1b36..f58c168 100644 Binary files a/AssetStudioCLI/Libraries/linux-x64/libAssetStudioFBXNative.so and b/AssetStudioCLI/Libraries/linux-x64/libAssetStudioFBXNative.so differ diff --git a/AssetStudioCLI/Libraries/osx-arm64/libAssetStudioFBXNative.dylib b/AssetStudioCLI/Libraries/osx-arm64/libAssetStudioFBXNative.dylib index 85263f5..e713ca3 100644 Binary files a/AssetStudioCLI/Libraries/osx-arm64/libAssetStudioFBXNative.dylib and b/AssetStudioCLI/Libraries/osx-arm64/libAssetStudioFBXNative.dylib differ diff --git a/AssetStudioCLI/Libraries/osx-x64/libAssetStudioFBXNative.dylib b/AssetStudioCLI/Libraries/osx-x64/libAssetStudioFBXNative.dylib index 8d4d6ca..cd55941 100644 Binary files a/AssetStudioCLI/Libraries/osx-x64/libAssetStudioFBXNative.dylib and b/AssetStudioCLI/Libraries/osx-x64/libAssetStudioFBXNative.dylib differ diff --git a/AssetStudioFBXNative/api.cpp b/AssetStudioFBXNative/api.cpp index 2353d7a..eff8dd1 100644 --- a/AssetStudioFBXNative/api.cpp +++ b/AssetStudioFBXNative/api.cpp @@ -462,26 +462,52 @@ AS_API(void) AsFbxMeshCreateElementNormal(FbxMesh* pMesh) pNormal->SetReferenceMode(FbxGeometryElement::eDirect); } -AS_API(void) AsFbxMeshCreateDiffuseUV(FbxMesh* pMesh, int32_t uv) +AS_API(void) AsFbxMeshCreateUVMap(FbxMesh* pMesh, int32_t uvIndex, int32_t uvType) { if (pMesh == nullptr) { return; } - auto pUV = pMesh->CreateElementUV(FbxString("UV") + FbxString(uv), FbxLayerElement::eTextureDiffuse); - pUV->SetMappingMode(FbxGeometryElement::eByControlPoint); - pUV->SetReferenceMode(FbxGeometryElement::eDirect); -} - -AS_API(void) AsFbxMeshCreateNormalMapUV(FbxMesh* pMesh, int32_t uv) -{ - if (pMesh == nullptr) + FbxLayerElement::EType layerElement; + switch (uvType) { - return; + case 0: + layerElement = FbxLayerElement::eTextureDiffuse; + break; + case 1: + layerElement = FbxLayerElement::eTextureNormalMap; + break; + case 2: + layerElement = FbxLayerElement::eTextureDisplacement; + break; + case 3: + layerElement = FbxLayerElement::eTextureSpecular; + break; + case 4: + layerElement = FbxLayerElement::eTextureBump; + break; + case 5: + layerElement = FbxLayerElement::eTextureEmissive; + break; + case 6: + layerElement = FbxLayerElement::eTextureAmbient; + break; + case 7: + layerElement = FbxLayerElement::eTextureShininess; + break; + case 8: + layerElement = FbxLayerElement::eTextureReflection; + break; + case 9: + layerElement = FbxLayerElement::eTextureTransparency; + break; + default: + layerElement = FbxLayerElement::eTextureDiffuse; + break; } - auto pUV = pMesh->CreateElementUV(FbxString("UV") + FbxString(uv), FbxLayerElement::eTextureNormalMap); + auto pUV = pMesh->CreateElementUV(FbxString("UV") + FbxString(uvIndex), layerElement); pUV->SetMappingMode(FbxGeometryElement::eByControlPoint); pUV->SetReferenceMode(FbxGeometryElement::eDirect); } diff --git a/AssetStudioFBXNative/api.h b/AssetStudioFBXNative/api.h index 444d6e5..cfa8870 100644 --- a/AssetStudioFBXNative/api.h +++ b/AssetStudioFBXNative/api.h @@ -66,9 +66,7 @@ AS_API(void) AsFbxMeshInitControlPoints(fbxsdk::FbxMesh* pMesh, int32_t vertexCo AS_API(void) AsFbxMeshCreateElementNormal(fbxsdk::FbxMesh* pMesh); -AS_API(void) AsFbxMeshCreateDiffuseUV(fbxsdk::FbxMesh* pMesh, int32_t uv); - -AS_API(void) AsFbxMeshCreateNormalMapUV(fbxsdk::FbxMesh* pMesh, int32_t uv); +AS_API(void) AsFbxMeshCreateUVMap(fbxsdk::FbxMesh* pMesh, int32_t uvIndex, int32_t uvType); AS_API(void) AsFbxMeshCreateElementTangent(fbxsdk::FbxMesh* pMesh); diff --git a/AssetStudioFBXWrapper/Fbx.cs b/AssetStudioFBXWrapper/Fbx.cs index 4b4e6e7..b598673 100644 --- a/AssetStudioFBXWrapper/Fbx.cs +++ b/AssetStudioFBXWrapper/Fbx.cs @@ -1,5 +1,7 @@ using AssetStudio.FbxInterop; using System.IO; +using System.Text.Json; +using System.Collections.Generic; #if NETFRAMEWORK using AssetStudio.PInvoke; @@ -30,9 +32,7 @@ namespace AssetStudio public static class Exporter { - - public static void Export(string path, IImported imported, bool eulerFilter, float filterPrecision, - bool allNodes, bool skins, bool animation, bool blendShape, bool castToBone, float boneSize, bool exportAllUvsAsDiffuseMaps, float scaleFactor, int versionIndex, bool isAscii) + public static void Export(string path, IImported imported, Settings fbxSettings) { var file = new FileInfo(path); var dir = file.Directory; @@ -47,16 +47,88 @@ namespace AssetStudio var name = Path.GetFileName(path); - using (var exporter = new FbxExporter(name, imported, allNodes, skins, castToBone, boneSize, exportAllUvsAsDiffuseMaps, scaleFactor, versionIndex, isAscii)) + using (var exporter = new FbxExporter(name, imported, fbxSettings)) { - exporter.Initialize(); - exporter.ExportAll(blendShape, animation, eulerFilter, filterPrecision); + exporter.ExportAll(); } Directory.SetCurrentDirectory(currentDir); } - } + public sealed class Settings + { + public bool EulerFilter { get; set; } + public float FilterPrecision { get; set; } + public bool ExportAllNodes { get; set; } + public bool ExportSkins { get; set; } + public bool ExportAnimations { get; set; } + public bool ExportBlendShape { get; set; } + public bool CastToBone { get; set; } + public float BoneSize { get; set; } + public bool ExportAllUvsAsDiffuseMaps { get; set; } + public float ScaleFactor { get; set; } + public int FbxVersionIndex { get; set; } + public int FbxFormat { get; set; } + public Dictionary UvBindings { get; set; } + public bool IsAscii => FbxFormat == 1; + + public Settings() + { + Init(); + } + + public Settings(bool eulerFilter, float filterPrecision, bool exportAllNodes, bool exportSkins, bool exportAnimations, bool exportBlendShape, bool castToBone, float boneSize, + bool exportAllUvsAsDiffuseMaps, float scaleFactor, int fbxVersionIndex, int fbxFormat, Dictionary uvBindings) + { + EulerFilter = eulerFilter; + FilterPrecision = filterPrecision; + ExportAllNodes = exportAllNodes; + ExportSkins = exportSkins; + ExportAnimations = exportAnimations; + ExportBlendShape = exportBlendShape; + CastToBone = castToBone; + BoneSize = (int)boneSize; + ExportAllUvsAsDiffuseMaps = exportAllUvsAsDiffuseMaps; + ScaleFactor = scaleFactor; + FbxVersionIndex = fbxVersionIndex; + FbxFormat = fbxFormat; + UvBindings = uvBindings; + } + + public void Init() + { + var uvDict = new Dictionary(); + for (var i = 0; i < 8; i++) + { + uvDict[i] = i + 1; + } + + EulerFilter = true; + FilterPrecision = 0.25f; + ExportAllNodes = true; + ExportSkins = true; + ExportAnimations = true; + ExportBlendShape = true; + CastToBone = false; + ExportAllUvsAsDiffuseMaps = false; + BoneSize = 10; + ScaleFactor = 1.0f; + FbxFormat = 0; + FbxVersionIndex = 3; + UvBindings = uvDict; + } + + public static Settings FromBase64(string base64String) + { + var settingsData = System.Convert.FromBase64String(base64String); + return JsonSerializer.Deserialize(settingsData); + } + + public string ToBase64() + { + return System.Convert.ToBase64String(JsonSerializer.SerializeToUtf8Bytes(this)); + } + } } } diff --git a/AssetStudioFBXWrapper/FbxExporter.cs b/AssetStudioFBXWrapper/FbxExporter.cs index b9e5ed6..62ec0e8 100644 --- a/AssetStudioFBXWrapper/FbxExporter.cs +++ b/AssetStudioFBXWrapper/FbxExporter.cs @@ -11,29 +11,15 @@ namespace AssetStudio.FbxInterop private readonly string _fileName; private readonly IImported _imported; - private readonly bool _allNodes; - private readonly bool _exportSkins; - private readonly bool _castToBone; - private readonly float _boneSize; - private readonly bool _exportAllUvsAsDiffuseMaps; - private readonly float _scaleFactor; - private readonly int _versionIndex; - private readonly bool _isAscii; + private readonly Fbx.Settings _settings; - internal FbxExporter(string fileName, IImported imported, bool allNodes, bool exportSkins, bool castToBone, float boneSize, bool exportAllUvsAsDiffuseMaps, float scaleFactor, int versionIndex, bool isAscii) + internal FbxExporter(string fileName, IImported imported, Fbx.Settings fbxSettings) { _context = new FbxExporterContext(); _fileName = fileName; _imported = imported; - _allNodes = allNodes; - _exportSkins = exportSkins; - _castToBone = castToBone; - _boneSize = boneSize; - _exportAllUvsAsDiffuseMaps = exportAllUvsAsDiffuseMaps; - _scaleFactor = scaleFactor; - _versionIndex = versionIndex; - _isAscii = isAscii; + _settings = fbxSettings; } ~FbxExporter() @@ -64,13 +50,13 @@ namespace AssetStudio.FbxInterop IsDisposed = true; } - internal void Initialize() + private void Initialize() { var is60Fps = _imported.AnimationList.Count > 0 && _imported.AnimationList[0].SampleRate.Equals(60.0f); - _context.Initialize(_fileName, _scaleFactor, _versionIndex, _isAscii, is60Fps); + _context.Initialize(_fileName, _settings, is60Fps); - if (!_allNodes) + if (!_settings.ExportAllNodes) { var framePaths = SearchHierarchy(); @@ -78,8 +64,10 @@ namespace AssetStudio.FbxInterop } } - internal void ExportAll(bool blendShape, bool animation, bool eulerFilter, float filterPrecision) + internal void ExportAll() { + Initialize(); + var meshFrames = new List(); ExportRootFrame(meshFrames); @@ -97,16 +85,14 @@ namespace AssetStudio.FbxInterop SetJointsNode(_imported.RootFrame, null, true); } - - - if (blendShape) + if (_settings.ExportBlendShape) { ExportMorphs(); } - if (animation) + if (_settings.ExportAnimations) { - ExportAnimations(eulerFilter, filterPrecision); + ExportAnimations(_settings.EulerFilter, _settings.FilterPrecision); } ExportScene(); @@ -134,7 +120,7 @@ namespace AssetStudio.FbxInterop private void SetJointsFromImportedMeshes() { - if (!_exportSkins) + if (!_settings.ExportSkins) { return; } @@ -156,12 +142,12 @@ namespace AssetStudio.FbxInterop } } - SetJointsNode(_imported.RootFrame, bonePaths, _castToBone); + SetJointsNode(_imported.RootFrame, bonePaths, _settings.CastToBone); } private void SetJointsNode(ImportedFrame rootFrame, HashSet bonePaths, bool castToBone) { - _context.SetJointsNode(rootFrame, bonePaths, castToBone, _boneSize); + _context.SetJointsNode(rootFrame, bonePaths, castToBone, _settings.BoneSize); } private void PrepareMaterials() @@ -173,7 +159,7 @@ namespace AssetStudio.FbxInterop { foreach (var meshFrame in meshFrames) { - _context.ExportMeshFromFrame(rootFrame, meshFrame, _imported.MeshList, _imported.MaterialList, _imported.TextureList, _exportSkins, _exportAllUvsAsDiffuseMaps); + _context.ExportMeshFromFrame(rootFrame, meshFrame, _imported.MeshList, _imported.MaterialList, _imported.TextureList, _settings); } } diff --git a/AssetStudioFBXWrapper/FbxExporterContext.PInvoke.cs b/AssetStudioFBXWrapper/FbxExporterContext.PInvoke.cs index 82c5e1f..2fbca0b 100644 --- a/AssetStudioFBXWrapper/FbxExporterContext.PInvoke.cs +++ b/AssetStudioFBXWrapper/FbxExporterContext.PInvoke.cs @@ -142,10 +142,7 @@ namespace AssetStudio.FbxInterop private static extern void AsFbxMeshCreateElementNormal(IntPtr mesh); [DllImport(FbxDll.DllName, CallingConvention = CallingConvention.Winapi)] - private static extern void AsFbxMeshCreateDiffuseUV(IntPtr mesh, int uv); - - [DllImport(FbxDll.DllName, CallingConvention = CallingConvention.Winapi)] - private static extern void AsFbxMeshCreateNormalMapUV(IntPtr mesh, int uv); + private static extern void AsFbxMeshCreateUVMap(IntPtr mesh, int uvIndex, int uvType); [DllImport(FbxDll.DllName, CallingConvention = CallingConvention.Winapi)] private static extern void AsFbxMeshCreateElementTangent(IntPtr mesh); diff --git a/AssetStudioFBXWrapper/FbxExporterContext.cs b/AssetStudioFBXWrapper/FbxExporterContext.cs index 6c4ed7c..9a50211 100644 --- a/AssetStudioFBXWrapper/FbxExporterContext.cs +++ b/AssetStudioFBXWrapper/FbxExporterContext.cs @@ -59,11 +59,11 @@ namespace AssetStudio.FbxInterop } } - internal void Initialize(string fileName, float scaleFactor, int versionIndex, bool isAscii, bool is60Fps) + internal void Initialize(string fileName, Fbx.Settings fbxSettings, bool is60Fps) { EnsureNotDisposed(); - var b = AsFbxInitializeContext(_pContext, fileName, scaleFactor, versionIndex, isAscii, is60Fps, out var errorMessage); + var b = AsFbxInitializeContext(_pContext, fileName, fbxSettings.ScaleFactor, fbxSettings.FbxVersionIndex, fbxSettings.IsAscii, is60Fps, out var errorMessage); if (!b) { @@ -173,12 +173,12 @@ namespace AssetStudio.FbxInterop AsFbxPrepareMaterials(_pContext, materialCount, textureCount); } - internal void ExportMeshFromFrame(ImportedFrame rootFrame, ImportedFrame meshFrame, List meshList, List materialList, List textureList, bool exportSkins, bool exportAllUvsAsDiffuseMaps) + internal void ExportMeshFromFrame(ImportedFrame rootFrame, ImportedFrame meshFrame, List meshList, List materialList, List textureList, Fbx.Settings fbxSettings) { var meshNode = _frameToNode[meshFrame]; var mesh = ImportedHelpers.FindMesh(meshFrame.Path, meshList); - ExportMesh(rootFrame, materialList, textureList, meshNode, mesh, exportSkins, exportAllUvsAsDiffuseMaps); + ExportMesh(rootFrame, materialList, textureList, meshNode, mesh, fbxSettings); } private IntPtr ExportTexture(ImportedTexture texture) @@ -207,12 +207,12 @@ namespace AssetStudio.FbxInterop return pTex; } - private void ExportMesh(ImportedFrame rootFrame, List materialList, List textureList, IntPtr frameNode, ImportedMesh importedMesh, bool exportSkins, bool exportAllUvsAsDiffuseMaps) + private void ExportMesh(ImportedFrame rootFrame, List materialList, List textureList, IntPtr frameNode, ImportedMesh importedMesh, Fbx.Settings fbxSettings) { var boneList = importedMesh.BoneList; var totalBoneCount = 0; var hasBones = false; - if (exportSkins && boneList?.Count > 0) + if (fbxSettings.ExportSkins && boneList?.Count > 0) { totalBoneCount = boneList.Count; hasBones = true; @@ -253,17 +253,18 @@ namespace AssetStudio.FbxInterop AsFbxMeshCreateElementNormal(mesh); } - for (int i = 0; i < importedMesh.hasUV.Length; i++) + for (var i = 0; i < importedMesh.hasUV.Length; i++) { - if (!importedMesh.hasUV[i]) { continue; } + if (!importedMesh.hasUV[i]) + continue; - if (i == 1 && !exportAllUvsAsDiffuseMaps) + if (fbxSettings.ExportAllUvsAsDiffuseMaps) { - AsFbxMeshCreateNormalMapUV(mesh, 1); + AsFbxMeshCreateUVMap(mesh, i, 0); } - else + else if(fbxSettings.UvBindings[i] > 0) //if checked { - AsFbxMeshCreateDiffuseUV(mesh, i); + AsFbxMeshCreateUVMap(mesh, i, fbxSettings.UvBindings[i]); } } diff --git a/AssetStudioGUI/AssetStudioGUIForm.cs b/AssetStudioGUI/AssetStudioGUIForm.cs index baf6207..c60a21f 100644 --- a/AssetStudioGUI/AssetStudioGUIForm.cs +++ b/AssetStudioGUI/AssetStudioGUIForm.cs @@ -37,18 +37,19 @@ namespace AssetStudioGUI private AssetItem lastPreviewItem; private DirectBitmap imageTexture; private string tempClipboard; + private bool isDarkMode; + #region FMODControl private FMOD.System system; private FMOD.Sound sound; private FMOD.Channel channel; - private FMOD.SoundGroup masterSoundGroup; private FMOD.MODE loopMode = FMOD.MODE.LOOP_OFF; private byte[] soundBuff; private uint FMODlenms; private uint FMODloopstartms; private uint FMODloopendms; private float FMODVolume = 0.8f; - private bool isDarkMode; + #endregion #region SpriteControl private SpriteMaskMode spriteMaskVisibleMode = SpriteMaskMode.On; @@ -146,6 +147,10 @@ namespace AssetStudioGUI autoPlayAudioAssetsToolStripMenuItem.Checked = Properties.Settings.Default.autoplayAudio; FMODinit(); listSearchFilterMode.SelectedIndex = 0; + if (string.IsNullOrEmpty(Properties.Settings.Default.fbxSettings)) + { + FBXinitOptions(); + } logger = new GUILogger(StatusStripUpdate); Logger.Default = logger; @@ -2582,6 +2587,12 @@ namespace AssetStudioGUI Properties.Settings.Default.Save(); } + private void FBXinitOptions() + { + Properties.Settings.Default.fbxSettings = new Fbx.Settings().ToBase64(); + Properties.Settings.Default.Save(); + } + #region FMOD private void FMODinit() { diff --git a/AssetStudioGUI/ExportOptions.Designer.cs b/AssetStudioGUI/ExportOptions.Designer.cs index e7ec935..fd88887 100644 --- a/AssetStudioGUI/ExportOptions.Designer.cs +++ b/AssetStudioGUI/ExportOptions.Designer.cs @@ -60,6 +60,9 @@ this.l2dMotionExportMethodLabel = new System.Windows.Forms.Label(); this.l2dForceBezierCheckBox = new System.Windows.Forms.CheckBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.uvBindingsLabel = new System.Windows.Forms.Label(); + this.uvIndicesCheckedListBox = new System.Windows.Forms.CheckedListBox(); + this.uvTypesListBox = new System.Windows.Forms.ListBox(); this.exportAllUvsAsDiffuseMaps = new System.Windows.Forms.CheckBox(); this.exportBlendShape = new System.Windows.Forms.CheckBox(); this.exportAnimations = new System.Windows.Forms.CheckBox(); @@ -78,6 +81,7 @@ this.exportAllNodes = new System.Windows.Forms.CheckBox(); this.eulerFilter = new System.Windows.Forms.CheckBox(); this.optionTooltip = new System.Windows.Forms.ToolTip(this.components); + this.fbxResetButton = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.parallelExportUpDown)).BeginInit(); this.panel1.SuspendLayout(); @@ -92,7 +96,7 @@ // OKbutton // this.OKbutton.BackColor = System.Drawing.SystemColors.ButtonFace; - this.OKbutton.Location = new System.Drawing.Point(396, 430); + this.OKbutton.Location = new System.Drawing.Point(460, 430); this.OKbutton.Name = "OKbutton"; this.OKbutton.Size = new System.Drawing.Size(75, 23); this.OKbutton.TabIndex = 4; @@ -104,7 +108,7 @@ // this.Cancel.BackColor = System.Drawing.SystemColors.ButtonFace; this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.Cancel.Location = new System.Drawing.Point(477, 430); + this.Cancel.Location = new System.Drawing.Point(541, 430); this.Cancel.Name = "Cancel"; this.Cancel.Size = new System.Drawing.Size(75, 23); this.Cancel.TabIndex = 5; @@ -463,6 +467,10 @@ // this.groupBox2.AutoSize = true; this.groupBox2.BackColor = System.Drawing.SystemColors.Menu; + this.groupBox2.Controls.Add(this.fbxResetButton); + this.groupBox2.Controls.Add(this.uvBindingsLabel); + this.groupBox2.Controls.Add(this.uvIndicesCheckedListBox); + this.groupBox2.Controls.Add(this.uvTypesListBox); this.groupBox2.Controls.Add(this.exportAllUvsAsDiffuseMaps); this.groupBox2.Controls.Add(this.exportBlendShape); this.groupBox2.Controls.Add(this.exportAnimations); @@ -482,33 +490,84 @@ this.groupBox2.Controls.Add(this.eulerFilter); this.groupBox2.Location = new System.Drawing.Point(328, 13); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(224, 411); + this.groupBox2.Size = new System.Drawing.Size(289, 411); this.groupBox2.TabIndex = 3; this.groupBox2.TabStop = false; this.groupBox2.Text = "Fbx"; // + // uvBindingsLabel + // + this.uvBindingsLabel.AutoSize = true; + this.uvBindingsLabel.Location = new System.Drawing.Point(6, 173); + this.uvBindingsLabel.Name = "uvBindingsLabel"; + this.uvBindingsLabel.Size = new System.Drawing.Size(87, 13); + this.uvBindingsLabel.TabIndex = 17; + this.uvBindingsLabel.Text = "UV type bindings"; + // + // uvIndicesCheckedListBox + // + this.uvIndicesCheckedListBox.FormattingEnabled = true; + this.uvIndicesCheckedListBox.IntegralHeight = false; + this.uvIndicesCheckedListBox.Items.AddRange(new object[] { + "UV0", + "UV1", + "UV2", + "UV3", + "UV4", + "UV5", + "UV6", + "UV7"}); + this.uvIndicesCheckedListBox.Location = new System.Drawing.Point(11, 192); + this.uvIndicesCheckedListBox.Name = "uvIndicesCheckedListBox"; + this.uvIndicesCheckedListBox.ScrollAlwaysVisible = true; + this.uvIndicesCheckedListBox.Size = new System.Drawing.Size(125, 95); + this.uvIndicesCheckedListBox.TabIndex = 18; + this.uvIndicesCheckedListBox.SelectedIndexChanged += new System.EventHandler(this.uvIndicesCheckedListBox_SelectedIndexChanged); + // + // uvTypesListBox + // + this.uvTypesListBox.FormattingEnabled = true; + this.uvTypesListBox.IntegralHeight = false; + this.uvTypesListBox.Items.AddRange(new object[] { + "Diffuse", + "NormalMap", + "Displacement", + "Specular", + "Bump", + "Emissive", + "Ambient", + "Shininess", + "Reflection", + "Transparency"}); + this.uvTypesListBox.Location = new System.Drawing.Point(150, 192); + this.uvTypesListBox.Name = "uvTypesListBox"; + this.uvTypesListBox.ScrollAlwaysVisible = true; + this.uvTypesListBox.Size = new System.Drawing.Size(125, 95); + this.uvTypesListBox.TabIndex = 19; + this.uvTypesListBox.SelectedIndexChanged += new System.EventHandler(this.uvTypesListBox_SelectedIndexChanged); + // // exportAllUvsAsDiffuseMaps // this.exportAllUvsAsDiffuseMaps.AccessibleDescription = ""; this.exportAllUvsAsDiffuseMaps.AutoSize = true; - this.exportAllUvsAsDiffuseMaps.Location = new System.Drawing.Point(6, 185); + this.exportAllUvsAsDiffuseMaps.Location = new System.Drawing.Point(6, 292); this.exportAllUvsAsDiffuseMaps.Name = "exportAllUvsAsDiffuseMaps"; this.exportAllUvsAsDiffuseMaps.Size = new System.Drawing.Size(168, 17); - this.exportAllUvsAsDiffuseMaps.TabIndex = 9; + this.exportAllUvsAsDiffuseMaps.TabIndex = 20; this.exportAllUvsAsDiffuseMaps.Text = "Export all UVs as diffuse maps"; - this.optionTooltip.SetToolTip(this.exportAllUvsAsDiffuseMaps, "Unchecked: UV1 exported as normal map. Check this if your export is missing a UV " + - "map."); + this.optionTooltip.SetToolTip(this.exportAllUvsAsDiffuseMaps, "Check this if some UV maps are missing after export (e.g. in Blender)"); this.exportAllUvsAsDiffuseMaps.UseVisualStyleBackColor = true; + this.exportAllUvsAsDiffuseMaps.CheckedChanged += new System.EventHandler(this.exportAllUvsAsDiffuseMaps_CheckedChanged); // // exportBlendShape // this.exportBlendShape.AutoSize = true; this.exportBlendShape.Checked = true; this.exportBlendShape.CheckState = System.Windows.Forms.CheckState.Checked; - this.exportBlendShape.Location = new System.Drawing.Point(6, 138); + this.exportBlendShape.Location = new System.Drawing.Point(6, 114); this.exportBlendShape.Name = "exportBlendShape"; this.exportBlendShape.Size = new System.Drawing.Size(114, 17); - this.exportBlendShape.TabIndex = 7; + this.exportBlendShape.TabIndex = 5; this.exportBlendShape.Text = "Export blendshape"; this.exportBlendShape.UseVisualStyleBackColor = true; // @@ -517,10 +576,10 @@ this.exportAnimations.AutoSize = true; this.exportAnimations.Checked = true; this.exportAnimations.CheckState = System.Windows.Forms.CheckState.Checked; - this.exportAnimations.Location = new System.Drawing.Point(6, 114); + this.exportAnimations.Location = new System.Drawing.Point(6, 91); this.exportAnimations.Name = "exportAnimations"; this.exportAnimations.Size = new System.Drawing.Size(109, 17); - this.exportAnimations.TabIndex = 6; + this.exportAnimations.TabIndex = 4; this.exportAnimations.Text = "Export animations"; this.exportAnimations.UseVisualStyleBackColor = true; // @@ -532,11 +591,10 @@ 0, 0, 131072}); - this.scaleFactor.Location = new System.Drawing.Point(83, 243); + this.scaleFactor.Location = new System.Drawing.Point(233, 73); this.scaleFactor.Name = "scaleFactor"; - this.scaleFactor.Size = new System.Drawing.Size(60, 20); - this.scaleFactor.TabIndex = 13; - this.scaleFactor.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.scaleFactor.Size = new System.Drawing.Size(50, 20); + this.scaleFactor.TabIndex = 12; this.scaleFactor.Value = new decimal(new int[] { 1, 0, @@ -546,10 +604,10 @@ // label5 // this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(6, 245); + this.label5.Location = new System.Drawing.Point(163, 75); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(64, 13); - this.label5.TabIndex = 12; + this.label5.TabIndex = 11; this.label5.Text = "ScaleFactor"; // // fbxFormat @@ -559,18 +617,18 @@ this.fbxFormat.Items.AddRange(new object[] { "Binary", "Ascii"}); - this.fbxFormat.Location = new System.Drawing.Point(77, 275); + this.fbxFormat.Location = new System.Drawing.Point(222, 103); this.fbxFormat.Name = "fbxFormat"; this.fbxFormat.Size = new System.Drawing.Size(61, 21); - this.fbxFormat.TabIndex = 15; + this.fbxFormat.TabIndex = 14; // // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(6, 280); + this.label4.Location = new System.Drawing.Point(156, 106); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(59, 13); - this.label4.TabIndex = 14; + this.label4.TabIndex = 13; this.label4.Text = "FBXFormat"; // // fbxVersion @@ -584,26 +642,26 @@ "7.3", "7.4", "7.5"}); - this.fbxVersion.Location = new System.Drawing.Point(77, 308); + this.fbxVersion.Location = new System.Drawing.Point(236, 135); this.fbxVersion.Name = "fbxVersion"; this.fbxVersion.Size = new System.Drawing.Size(47, 21); - this.fbxVersion.TabIndex = 17; + this.fbxVersion.TabIndex = 16; // // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(6, 311); + this.label3.Location = new System.Drawing.Point(168, 138); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(62, 13); - this.label3.TabIndex = 16; + this.label3.TabIndex = 15; this.label3.Text = "FBXVersion"; // // boneSize // - this.boneSize.Location = new System.Drawing.Point(65, 213); + this.boneSize.Location = new System.Drawing.Point(233, 47); this.boneSize.Name = "boneSize"; - this.boneSize.Size = new System.Drawing.Size(46, 20); - this.boneSize.TabIndex = 11; + this.boneSize.Size = new System.Drawing.Size(50, 20); + this.boneSize.TabIndex = 10; this.boneSize.Value = new decimal(new int[] { 10, 0, @@ -613,10 +671,10 @@ // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(6, 216); + this.label2.Location = new System.Drawing.Point(175, 49); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(52, 13); - this.label2.TabIndex = 10; + this.label2.TabIndex = 9; this.label2.Text = "BoneSize"; // // exportSkins @@ -624,20 +682,20 @@ this.exportSkins.AutoSize = true; this.exportSkins.Checked = true; this.exportSkins.CheckState = System.Windows.Forms.CheckState.Checked; - this.exportSkins.Location = new System.Drawing.Point(6, 90); + this.exportSkins.Location = new System.Drawing.Point(6, 68); this.exportSkins.Name = "exportSkins"; this.exportSkins.Size = new System.Drawing.Size(83, 17); - this.exportSkins.TabIndex = 5; + this.exportSkins.TabIndex = 3; this.exportSkins.Text = "Export skins"; this.exportSkins.UseVisualStyleBackColor = true; // // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(26, 42); + this.label1.Location = new System.Drawing.Point(155, 23); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(72, 13); - this.label1.TabIndex = 2; + this.label1.TabIndex = 7; this.label1.Text = "FilterPrecision"; // // filterPrecision @@ -648,10 +706,10 @@ 0, 0, 131072}); - this.filterPrecision.Location = new System.Drawing.Point(127, 40); + this.filterPrecision.Location = new System.Drawing.Point(233, 21); this.filterPrecision.Name = "filterPrecision"; - this.filterPrecision.Size = new System.Drawing.Size(51, 20); - this.filterPrecision.TabIndex = 3; + this.filterPrecision.Size = new System.Drawing.Size(50, 20); + this.filterPrecision.TabIndex = 8; this.filterPrecision.Value = new decimal(new int[] { 25, 0, @@ -661,10 +719,10 @@ // castToBone // this.castToBone.AutoSize = true; - this.castToBone.Location = new System.Drawing.Point(6, 161); + this.castToBone.Location = new System.Drawing.Point(6, 137); this.castToBone.Name = "castToBone"; this.castToBone.Size = new System.Drawing.Size(131, 17); - this.castToBone.TabIndex = 8; + this.castToBone.TabIndex = 6; this.castToBone.Text = "All nodes cast to bone"; this.castToBone.UseVisualStyleBackColor = true; // @@ -673,10 +731,10 @@ this.exportAllNodes.AutoSize = true; this.exportAllNodes.Checked = true; this.exportAllNodes.CheckState = System.Windows.Forms.CheckState.Checked; - this.exportAllNodes.Location = new System.Drawing.Point(6, 66); + this.exportAllNodes.Location = new System.Drawing.Point(6, 45); this.exportAllNodes.Name = "exportAllNodes"; this.exportAllNodes.Size = new System.Drawing.Size(101, 17); - this.exportAllNodes.TabIndex = 4; + this.exportAllNodes.TabIndex = 2; this.exportAllNodes.Text = "Export all nodes"; this.exportAllNodes.UseVisualStyleBackColor = true; // @@ -692,6 +750,17 @@ this.eulerFilter.Text = "EulerFilter"; this.eulerFilter.UseVisualStyleBackColor = true; // + // fbxResetButton + // + this.fbxResetButton.BackColor = System.Drawing.SystemColors.ButtonFace; + this.fbxResetButton.Location = new System.Drawing.Point(208, 368); + this.fbxResetButton.Name = "fbxResetButton"; + this.fbxResetButton.Size = new System.Drawing.Size(75, 23); + this.fbxResetButton.TabIndex = 21; + this.fbxResetButton.Text = "Reset"; + this.fbxResetButton.UseVisualStyleBackColor = false; + this.fbxResetButton.Click += new System.EventHandler(this.resetButton_Click); + // // ExportOptions // this.AcceptButton = this.OKbutton; @@ -699,7 +768,7 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.Menu; this.CancelButton = this.Cancel; - this.ClientSize = new System.Drawing.Size(564, 461); + this.ClientSize = new System.Drawing.Size(628, 461); this.Controls.Add(this.l2dGroupBox); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); @@ -712,7 +781,6 @@ this.ShowIcon = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Export options"; - this.TopMost = true; this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.parallelExportUpDown)).EndInit(); @@ -782,5 +850,9 @@ private System.Windows.Forms.Label l2dModelGroupLabel; private System.Windows.Forms.ComboBox l2dModelGroupComboBox; private System.Windows.Forms.CheckBox l2dAssetSearchByFilenameCheckBox; + private System.Windows.Forms.CheckedListBox uvIndicesCheckedListBox; + private System.Windows.Forms.ListBox uvTypesListBox; + private System.Windows.Forms.Label uvBindingsLabel; + private System.Windows.Forms.Button fbxResetButton; } } \ No newline at end of file diff --git a/AssetStudioGUI/ExportOptions.cs b/AssetStudioGUI/ExportOptions.cs index 0543c96..4f089da 100644 --- a/AssetStudioGUI/ExportOptions.cs +++ b/AssetStudioGUI/ExportOptions.cs @@ -7,6 +7,8 @@ namespace AssetStudioGUI { public partial class ExportOptions : Form { + private static Fbx.Settings fbxSettings; + public ExportOptions() { InitializeComponent(); @@ -25,23 +27,15 @@ namespace AssetStudioGUI parallelExportUpDown.Value = taskCount <= 0 ? maxParallelTasks : Math.Min(taskCount, maxParallelTasks); parallelExportMaxLabel.Text += maxParallelTasks; parallelExportCheckBox.Checked = Properties.Settings.Default.parallelExport; - eulerFilter.Checked = Properties.Settings.Default.eulerFilter; - filterPrecision.Value = Properties.Settings.Default.filterPrecision; - exportAllNodes.Checked = Properties.Settings.Default.exportAllNodes; - exportSkins.Checked = Properties.Settings.Default.exportSkins; - exportAnimations.Checked = Properties.Settings.Default.exportAnimations; - exportBlendShape.Checked = Properties.Settings.Default.exportBlendShape; - castToBone.Checked = Properties.Settings.Default.castToBone; - exportAllUvsAsDiffuseMaps.Checked = Properties.Settings.Default.exportAllUvsAsDiffuseMaps; - boneSize.Value = Properties.Settings.Default.boneSize; - scaleFactor.Value = Properties.Settings.Default.scaleFactor; - fbxVersion.SelectedIndex = Properties.Settings.Default.fbxVersion; - fbxFormat.SelectedIndex = Properties.Settings.Default.fbxFormat; + l2dModelGroupComboBox.SelectedIndex = (int)Properties.Settings.Default.l2dModelGroupOption; l2dAssetSearchByFilenameCheckBox.Checked = Properties.Settings.Default.l2dAssetSearchByFilename; var defaultMotionMode = Properties.Settings.Default.l2dMotionMode.ToString(); ((RadioButton)l2dMotionExportMethodPanel.Controls.Cast().First(x => x.AccessibleName == defaultMotionMode)).Checked = true; l2dForceBezierCheckBox.Checked = Properties.Settings.Default.l2dForceBezier; + + fbxSettings = Fbx.Settings.FromBase64(Properties.Settings.Default.fbxSettings); + SetFromFbxSettings(); } private void OKbutton_Click(object sender, EventArgs e) @@ -57,23 +51,34 @@ namespace AssetStudioGUI Properties.Settings.Default.openAfterExport = openAfterExport.Checked; Properties.Settings.Default.parallelExport = parallelExportCheckBox.Checked; Properties.Settings.Default.parallelExportCount = (int)parallelExportUpDown.Value; - Properties.Settings.Default.eulerFilter = eulerFilter.Checked; - Properties.Settings.Default.filterPrecision = filterPrecision.Value; - Properties.Settings.Default.exportAllNodes = exportAllNodes.Checked; - Properties.Settings.Default.exportSkins = exportSkins.Checked; - Properties.Settings.Default.exportAnimations = exportAnimations.Checked; - Properties.Settings.Default.exportBlendShape = exportBlendShape.Checked; - Properties.Settings.Default.castToBone = castToBone.Checked; - Properties.Settings.Default.exportAllUvsAsDiffuseMaps = exportAllUvsAsDiffuseMaps.Checked; - Properties.Settings.Default.boneSize = boneSize.Value; - Properties.Settings.Default.scaleFactor = scaleFactor.Value; - Properties.Settings.Default.fbxVersion = fbxVersion.SelectedIndex; - Properties.Settings.Default.fbxFormat = fbxFormat.SelectedIndex; + Properties.Settings.Default.l2dModelGroupOption = (CubismLive2DExtractor.Live2DModelGroupOption)l2dModelGroupComboBox.SelectedIndex; Properties.Settings.Default.l2dAssetSearchByFilename = l2dAssetSearchByFilenameCheckBox.Checked; var checkedMotionMode = (RadioButton)l2dMotionExportMethodPanel.Controls.Cast().First(x => ((RadioButton)x).Checked); Properties.Settings.Default.l2dMotionMode = (CubismLive2DExtractor.Live2DMotionMode)Enum.Parse(typeof(CubismLive2DExtractor.Live2DMotionMode), checkedMotionMode.AccessibleName); Properties.Settings.Default.l2dForceBezier = l2dForceBezierCheckBox.Checked; + + fbxSettings.EulerFilter = eulerFilter.Checked; + fbxSettings.FilterPrecision = (float)filterPrecision.Value; + fbxSettings.ExportAllNodes = exportAllNodes.Checked; + fbxSettings.ExportSkins = exportSkins.Checked; + fbxSettings.ExportAnimations = exportAnimations.Checked; + fbxSettings.ExportBlendShape = exportBlendShape.Checked; + fbxSettings.CastToBone = castToBone.Checked; + fbxSettings.ExportAllUvsAsDiffuseMaps = exportAllUvsAsDiffuseMaps.Checked; + fbxSettings.BoneSize = (int)boneSize.Value; + fbxSettings.ScaleFactor = (float)scaleFactor.Value; + fbxSettings.FbxVersionIndex = fbxVersion.SelectedIndex; + fbxSettings.FbxFormat = fbxFormat.SelectedIndex; + for (var i = 0; i < uvIndicesCheckedListBox.Items.Count; i++) + { + var isChecked = uvIndicesCheckedListBox.GetItemChecked(i); + var type = fbxSettings.UvBindings[i]; + if ((isChecked && type < 0) || (!isChecked && type > 0)) + fbxSettings.UvBindings[i] *= -1; + } + Properties.Settings.Default.fbxSettings = fbxSettings.ToBase64(); + Properties.Settings.Default.Save(); DialogResult = DialogResult.OK; Close(); @@ -89,5 +94,58 @@ namespace AssetStudioGUI { parallelExportUpDown.Enabled = parallelExportCheckBox.Checked; } + + private void uvIndicesCheckedListBox_SelectedIndexChanged(object sender, EventArgs e) + { + if (exportAllUvsAsDiffuseMaps.Checked) + return; + + if (fbxSettings.UvBindings.TryGetValue(uvIndicesCheckedListBox.SelectedIndex, out var uvType)) + { + uvTypesListBox.SelectedIndex = (int)MathF.Abs(uvType) - 1; + } + } + + private void uvTypesListBox_SelectedIndexChanged(object sender, EventArgs e) + { + var selectedUv = uvIndicesCheckedListBox.SelectedIndex; + fbxSettings.UvBindings[selectedUv] = uvTypesListBox.SelectedIndex + 1; + } + + private void exportAllUvsAsDiffuseMaps_CheckedChanged(object sender, EventArgs e) + { + uvTypesListBox.Enabled = !exportAllUvsAsDiffuseMaps.Checked; + uvIndicesCheckedListBox.Enabled = !exportAllUvsAsDiffuseMaps.Checked; + } + + private void SetFromFbxSettings() + { + eulerFilter.Checked = fbxSettings.EulerFilter; + filterPrecision.Value = (decimal)fbxSettings.FilterPrecision; + exportAllNodes.Checked = fbxSettings.ExportAllNodes; + exportSkins.Checked = fbxSettings.ExportSkins; + exportAnimations.Checked = fbxSettings.ExportAnimations; + exportBlendShape.Checked = fbxSettings.ExportBlendShape; + castToBone.Checked = fbxSettings.CastToBone; + exportAllUvsAsDiffuseMaps.Checked = fbxSettings.ExportAllUvsAsDiffuseMaps; + boneSize.Value = (decimal)fbxSettings.BoneSize; + scaleFactor.Value = (decimal)fbxSettings.ScaleFactor; + fbxVersion.SelectedIndex = fbxSettings.FbxVersionIndex; + fbxFormat.SelectedIndex = fbxSettings.FbxFormat; + for (var i = 0; i < uvIndicesCheckedListBox.Items.Count; i++) + { + var isChecked = fbxSettings.UvBindings[i] > 0; + uvIndicesCheckedListBox.SetItemChecked(i, isChecked); + } + uvTypesListBox.Enabled = !exportAllUvsAsDiffuseMaps.Checked; + uvIndicesCheckedListBox.Enabled = !exportAllUvsAsDiffuseMaps.Checked; + } + + private void resetButton_Click(object sender, EventArgs e) + { + fbxSettings.Init(); + SetFromFbxSettings(); + uvIndicesCheckedListBox_SelectedIndexChanged(sender, e); + } } } diff --git a/AssetStudioGUI/Exporter.cs b/AssetStudioGUI/Exporter.cs index c74adfe..e908c77 100644 --- a/AssetStudioGUI/Exporter.cs +++ b/AssetStudioGUI/Exporter.cs @@ -279,20 +279,8 @@ namespace AssetStudioGUI private static void ExportFbx(IImported convert, string exportPath) { - var eulerFilter = Properties.Settings.Default.eulerFilter; - var filterPrecision = (float)Properties.Settings.Default.filterPrecision; - var exportAllNodes = Properties.Settings.Default.exportAllNodes; - var exportSkins = Properties.Settings.Default.exportSkins; - var exportAnimations = Properties.Settings.Default.exportAnimations; - var exportBlendShape = Properties.Settings.Default.exportBlendShape; - var castToBone = Properties.Settings.Default.castToBone; - var boneSize = (int)Properties.Settings.Default.boneSize; - var exportAllUvsAsDiffuseMaps = Properties.Settings.Default.exportAllUvsAsDiffuseMaps; - var scaleFactor = (float)Properties.Settings.Default.scaleFactor; - var fbxVersion = Properties.Settings.Default.fbxVersion; - var fbxFormat = Properties.Settings.Default.fbxFormat; - ModelExporter.ExportFbx(exportPath, convert, eulerFilter, filterPrecision, - exportAllNodes, exportSkins, exportAnimations, exportBlendShape, castToBone, boneSize, exportAllUvsAsDiffuseMaps, scaleFactor, fbxVersion, fbxFormat == 1); + var fbxSettings = Fbx.Settings.FromBase64(Properties.Settings.Default.fbxSettings); + ModelExporter.ExportFbx(exportPath, convert, fbxSettings); } public static bool ExportDumpFile(AssetItem item, string exportPath) diff --git a/AssetStudioGUI/Properties/Settings.Designer.cs b/AssetStudioGUI/Properties/Settings.Designer.cs index a168198..d68db64 100644 --- a/AssetStudioGUI/Properties/Settings.Designer.cs +++ b/AssetStudioGUI/Properties/Settings.Designer.cs @@ -119,138 +119,6 @@ namespace AssetStudioGUI.Properties { } } - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool eulerFilter { - get { - return ((bool)(this["eulerFilter"])); - } - set { - this["eulerFilter"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("0.25")] - public decimal filterPrecision { - get { - return ((decimal)(this["filterPrecision"])); - } - set { - this["filterPrecision"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool exportAllNodes { - get { - return ((bool)(this["exportAllNodes"])); - } - set { - this["exportAllNodes"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool exportSkins { - get { - return ((bool)(this["exportSkins"])); - } - set { - this["exportSkins"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool exportAnimations { - get { - return ((bool)(this["exportAnimations"])); - } - set { - this["exportAnimations"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("10")] - public decimal boneSize { - get { - return ((decimal)(this["boneSize"])); - } - set { - this["boneSize"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("3")] - public int fbxVersion { - get { - return ((int)(this["fbxVersion"])); - } - set { - this["fbxVersion"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("0")] - public int fbxFormat { - get { - return ((int)(this["fbxFormat"])); - } - set { - this["fbxFormat"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("1")] - public decimal scaleFactor { - get { - return ((decimal)(this["scaleFactor"])); - } - set { - this["scaleFactor"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool exportBlendShape { - get { - return ((bool)(this["exportBlendShape"])); - } - set { - this["exportBlendShape"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool castToBone { - get { - return ((bool)(this["castToBone"])); - } - set { - this["castToBone"] = value; - } - } - [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("True")] @@ -263,18 +131,6 @@ namespace AssetStudioGUI.Properties { } } - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool exportAllUvsAsDiffuseMaps { - get { - return ((bool)(this["exportAllUvsAsDiffuseMaps"])); - } - set { - this["exportAllUvsAsDiffuseMaps"] = value; - } - } - [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("True")] @@ -454,5 +310,17 @@ namespace AssetStudioGUI.Properties { this["autoplayAudio"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string fbxSettings { + get { + return ((string)(this["fbxSettings"])); + } + set { + this["fbxSettings"] = value; + } + } } } diff --git a/AssetStudioGUI/Properties/Settings.settings b/AssetStudioGUI/Properties/Settings.settings index 69111a0..1dbb002 100644 --- a/AssetStudioGUI/Properties/Settings.settings +++ b/AssetStudioGUI/Properties/Settings.settings @@ -26,45 +26,9 @@ Png - - True - - - 0.25 - - - True - - - True - - - True - - - 10 - - - 3 - - - 0 - - - 1 - - - True - - - False - True - - False - True @@ -110,5 +74,8 @@ False + + + \ No newline at end of file diff --git a/AssetStudioUtility/ModelExporter.cs b/AssetStudioUtility/ModelExporter.cs index 5b7813e..4df9d1d 100644 --- a/AssetStudioUtility/ModelExporter.cs +++ b/AssetStudioUtility/ModelExporter.cs @@ -2,10 +2,6 @@ { public static class ModelExporter { - public static void ExportFbx(string path, IImported imported, bool eulerFilter, float filterPrecision, - bool allNodes, bool skins, bool animation, bool blendShape, bool castToBone, float boneSize, bool exportAllUvsAsDiffuseMaps, float scaleFactor, int versionIndex, bool isAscii) - { - Fbx.Exporter.Export(path, imported, eulerFilter, filterPrecision, allNodes, skins, animation, blendShape, castToBone, boneSize, exportAllUvsAsDiffuseMaps, scaleFactor, versionIndex, isAscii); - } + public static void ExportFbx(string path, IImported imported, Fbx.Settings settings) => Fbx.Exporter.Export(path, imported, settings); } }