配置环境

  • Clone AssetStudio
  • Clone pkg-doctor
  • 下载Fbx Sdk(AssetStudio的版本)
  • 下载Vs2022(看AssetStudio的版本)
  • 配置附加目录 AssetStudioFBXNative 属性=》C/C++=》附加包含目录(注意x64,x86版本)
  • 配置链接器 AssetStudioFBXNative 属性=》连接器=》附加库目录 D:\Autodesk\FBX\FBX SDK\2020.2.1\lib\vs2019\x64\release (注意x86和x64)

错误解答

xxx.h没有

是否添加了附加目录,这个是最常见的错误,C/C++是否添加了链接目录,注意你要编译的版本,如果你的FbxSDK里面没有这个头文件,一般就是Win10Sdk的目录,自己添加一下就行了,注意编译版本 注意编译版本 注意编译版本

xxx.lib没有

链接器是否添加了fbxSdk的目录,如果是其他的Lib,自己查找Lib目录添加进来,一般都是win10sdk的目录没有添加

运行exe没有输出Console.Writeline

没有修改解决方案为控制台程序 属性=》应用程序=》常规=》控制台应用程序

编译后没有自动拷贝pkg.py

添加编译后处理

1
COPY $(SolutionDir)\pkg.py $(TargetDir)

修改的部分

  • 修改主入口可以接收命令行参数

image-20220901180515625

  • 核心修改部分,支持Ipa,apk,文件夹进行解析

image-20220901180427885

核心代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
public static void ExportAssets2(string savePath, List<AssetItem> toExportAssets)
{
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

string csvFileName = Path.Combine(savePath, "pkg.tsv");
StreamWriter csvFile = new StreamWriter(csvFileName);

csvFile.Write("Name\tContainer\tType\tDimension\tFormat\tSize\tFileName\tHash\tOriginalFile\tWrapMode\n");
int toExportCount = toExportAssets.Count;
int exportedCount = 0;
int i = 0;
Progress.Reset();
foreach (var asset in toExportAssets)
{
StatusStripUpdate($"Exporting {asset.TypeString}: {asset.Text}");
try
{
if (ExportVizFile(asset, savePath, csvFile))
{
exportedCount++;
}
}
catch (Exception ex)
{
MessageBox.Show($"Export {asset.Type}:{asset.Text} error\r\n{ex.Message}\r\n{ex.StackTrace}");
}

Progress.Report(++i, toExportCount);
}

var statusText = exportedCount == 0 ? "Nothing exported." : $"Finished exporting {exportedCount} assets.";

if (toExportCount > exportedCount)
{
statusText += $" {toExportCount - exportedCount} assets skipped (not extractable or files already exist)";
}

StatusStripUpdate(statusText);

if (Properties.Settings.Default.openAfterExport && exportedCount > 0)
{
Process.Start(savePath);
}

if (csvFile.BaseStream != null)
{
csvFile.Close();
}
}

上面的代码就是根据AssetStudio导出来的文件生成类csv文件。