Skip to content

Commit

Permalink
Add project files.
Browse files Browse the repository at this point in the history
  • Loading branch information
Razmoth committed Sep 15, 2023
1 parent d158e86 commit f888273
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 113 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:
run: |
md fbx
cd fbx
Invoke-WebRequest "https://damassets.autodesk.net/content/dam/autodesk/www/adn/fbx/2020-2-1/fbx202021_fbxsdk_vs2019_win.exe" -OutFile "fbxsdk.exe"
Invoke-WebRequest "https://damassets.autodesk.net/content/dam/autodesk/www/adn/fbx/2020-3-2/fbx202032_fbxsdk_vs2019_win.exe" -OutFile "fbxsdk.exe"
Start-Process -FilePath "fbxsdk.exe" /S -Wait
Invoke-WebRequest "https://damassets.autodesk.net/content/dam/autodesk/www/adn/fbx/2020-2-1/fbx202021_fbxsdk_vs2019_pdbs.exe" -OutFile "fbxpdb.exe"
Invoke-WebRequest "https://damassets.autodesk.net/content/dam/autodesk/www/adn/fbx/2020-3-2/fbx202032_fbxsdk_vs2019_pdbs.exe" -OutFile "fbxpdb.exe"
Start-Process -FilePath "fbxpdb.exe" /S -Wait
cd ..
Expand Down
2 changes: 1 addition & 1 deletion AssetStudio/Classes/AnimationClip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ public AnimationClip(ObjectReader reader) : base(reader)
}

m_SampleRate = reader.ReadSingle();
m_WrapMode = reader.ReadInt32();
//m_WrapMode = reader.ReadInt32();
if (version[0] > 3 || (version[0] == 3 && version[1] >= 4)) //3.4 and up
{
m_Bounds = new AABB(reader);
Expand Down
7 changes: 4 additions & 3 deletions AssetStudio/Classes/AudioClip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ public AudioClip(ObjectReader reader) : base(reader)
{
if (version[0] < 5)
{
m_Format = reader.ReadInt32();
m_Type = (FMODSoundType)reader.ReadInt32();
m_3D = reader.ReadBoolean();
m_UseHardware = reader.ReadBoolean();
m_Length = reader.ReadSingle();
m_Frequency = reader.ReadInt32();
m_Size = reader.ReadInt32();
var m_DecompressOnLoad = reader.ReadBoolean();
reader.AlignStream();

if (version[0] >= 4 || (version[0] == 3 && version[1] >= 2)) //3.2.0 to 5
Expand Down
2 changes: 2 additions & 0 deletions AssetStudio/Classes/Material.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public UnityTexEnv(ObjectReader reader)
m_Texture = new PPtr<Texture>(reader);
m_Scale = reader.ReadVector2();
m_Offset = reader.ReadVector2();
var m_Pivot = reader.ReadVector2();
var m_Rotation = reader.ReadSingle();
}
}

Expand Down
131 changes: 42 additions & 89 deletions AssetStudio/Classes/Mesh.cs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ public SubMesh(ObjectReader reader)

firstByte = reader.ReadUInt32();
indexCount = reader.ReadUInt32();
topology = (GfxPrimitiveType)reader.ReadInt32();
topology = reader.ReadUInt32() > 0 ? GfxPrimitiveType.TriangleStrip : GfxPrimitiveType.Triangles;

if (version[0] < 4) //4.0 down
{
Expand Down Expand Up @@ -479,25 +479,6 @@ public Mesh(ObjectReader reader) : base(reader)
m_Use16BitIndices = reader.ReadInt32() > 0;
}

if (version[0] == 2 && version[1] <= 5) //2.5 and down
{
int m_IndexBuffer_size = reader.ReadInt32();

if (m_Use16BitIndices)
{
m_IndexBuffer = new uint[m_IndexBuffer_size / 2];
for (int i = 0; i < m_IndexBuffer_size / 2; i++)
{
m_IndexBuffer[i] = reader.ReadUInt16();
}
reader.AlignStream();
}
else
{
m_IndexBuffer = reader.ReadUInt32Array(m_IndexBuffer_size / 4);
}
}

int m_SubMeshesSize = reader.ReadInt32();
m_SubMeshes = new SubMesh[m_SubMeshesSize];
for (int i = 0; i < m_SubMeshesSize; i++)
Expand All @@ -517,56 +498,53 @@ public Mesh(ObjectReader reader) : base(reader)
var m_RootBoneNameHash = reader.ReadUInt32();
}

if (version[0] > 2 || (version[0] == 2 && version[1] >= 6)) //2.6.0 and up
if (version[0] >= 2019) //2019 and up
{
if (version[0] >= 2019) //2019 and up
var m_BonesAABBSize = reader.ReadInt32();
var m_BonesAABB = new MinMaxAABB[m_BonesAABBSize];
for (int i = 0; i < m_BonesAABBSize; i++)
{
var m_BonesAABBSize = reader.ReadInt32();
var m_BonesAABB = new MinMaxAABB[m_BonesAABBSize];
for (int i = 0; i < m_BonesAABBSize; i++)
{
m_BonesAABB[i] = new MinMaxAABB(reader);
}

var m_VariableBoneCountWeights = reader.ReadUInt32Array();
m_BonesAABB[i] = new MinMaxAABB(reader);
}

var m_MeshCompression = reader.ReadByte();
if (version[0] >= 4)
{
if (version[0] < 5)
{
var m_StreamCompression = reader.ReadByte();
}
var m_IsReadable = reader.ReadBoolean();
var m_KeepVertices = reader.ReadBoolean();
var m_KeepIndices = reader.ReadBoolean();
}
reader.AlignStream();
var m_VariableBoneCountWeights = reader.ReadUInt32Array();
}

//Unity fixed it in 2017.3.1p1 and later versions
if ((version[0] > 2017 || (version[0] == 2017 && version[1] >= 4)) || //2017.4
((version[0] == 2017 && version[1] == 3 && version[2] == 1) && buildType.IsPatch) || //fixed after 2017.3.1px
((version[0] == 2017 && version[1] == 3) && m_MeshCompression == 0))//2017.3.xfx with no compression
var m_MeshCompression = reader.ReadByte();
if (version[0] >= 4)
{
if (version[0] < 5)
{
var m_IndexFormat = reader.ReadInt32();
m_Use16BitIndices = m_IndexFormat == 0;
var m_StreamCompression = reader.ReadByte();
}
var m_IsReadable = reader.ReadBoolean();
var m_KeepVertices = reader.ReadBoolean();
var m_KeepIndices = reader.ReadBoolean();
}
reader.AlignStream();

int m_IndexBuffer_size = reader.ReadInt32();
if (m_Use16BitIndices)
{
m_IndexBuffer = new uint[m_IndexBuffer_size / 2];
for (int i = 0; i < m_IndexBuffer_size / 2; i++)
{
m_IndexBuffer[i] = reader.ReadUInt16();
}
reader.AlignStream();
}
else
//Unity fixed it in 2017.3.1p1 and later versions
if ((version[0] > 2017 || (version[0] == 2017 && version[1] >= 4)) || //2017.4
((version[0] == 2017 && version[1] == 3 && version[2] == 1) && buildType.IsPatch) || //fixed after 2017.3.1px
((version[0] == 2017 && version[1] == 3) && m_MeshCompression == 0))//2017.3.xfx with no compression
{
var m_IndexFormat = reader.ReadInt32();
m_Use16BitIndices = m_IndexFormat == 0;
}

int m_IndexBuffer_size = reader.ReadInt32();
if (m_Use16BitIndices)
{
m_IndexBuffer = new uint[m_IndexBuffer_size / 2];
for (int i = 0; i < m_IndexBuffer_size / 2; i++)
{
m_IndexBuffer = reader.ReadUInt32Array(m_IndexBuffer_size / 4);
m_IndexBuffer[i] = reader.ReadUInt16();
}
reader.AlignStream();
}
else
{
m_IndexBuffer = reader.ReadUInt32Array(m_IndexBuffer_size / 4);
}

if (version[0] < 3 || (version[0] == 3 && version[1] < 5)) //3.4.2 and earlier
Expand All @@ -586,28 +564,9 @@ public Mesh(ObjectReader reader) : base(reader)

m_UV1 = reader.ReadSingleArray(reader.ReadInt32() * 2); //Vector2

if (version[0] == 2 && version[1] <= 5) //2.5 and down
{
int m_TangentSpace_size = reader.ReadInt32();
m_Normals = new float[m_TangentSpace_size * 3];
m_Tangents = new float[m_TangentSpace_size * 4];
for (int v = 0; v < m_TangentSpace_size; v++)
{
m_Normals[v * 3] = reader.ReadSingle();
m_Normals[v * 3 + 1] = reader.ReadSingle();
m_Normals[v * 3 + 2] = reader.ReadSingle();
m_Tangents[v * 3] = reader.ReadSingle();
m_Tangents[v * 3 + 1] = reader.ReadSingle();
m_Tangents[v * 3 + 2] = reader.ReadSingle();
m_Tangents[v * 3 + 3] = reader.ReadSingle(); //handedness
}
}
else //2.6.0 and later
{
m_Tangents = reader.ReadSingleArray(reader.ReadInt32() * 4); //Vector4
m_Tangents = reader.ReadSingleArray(reader.ReadInt32() * 4); //Vector4

m_Normals = reader.ReadSingleArray(reader.ReadInt32() * 3); //Vector3
}
m_Normals = reader.ReadSingleArray(reader.ReadInt32() * 3); //Vector3
}
else
{
Expand All @@ -628,10 +587,7 @@ public Mesh(ObjectReader reader) : base(reader)
m_VertexData = new VertexData(reader);
}

if (version[0] > 2 || (version[0] == 2 && version[1] >= 6)) //2.6.0 and later
{
m_CompressedMesh = new CompressedMesh(reader);
}
m_CompressedMesh = new CompressedMesh(reader);

reader.Position += 24; //AABB m_LocalAABB

Expand Down Expand Up @@ -695,10 +651,7 @@ private void ProcessData()
ReadVertexData();
}

if (version[0] > 2 || (version[0] == 2 && version[1] >= 6)) //2.6.0 and later
{
DecompressCompressedMesh();
}
DecompressCompressedMesh();

GetTriangles();
}
Expand Down
8 changes: 6 additions & 2 deletions AssetStudio/Classes/PPtr.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Buffers.Binary;

namespace AssetStudio
{
Expand All @@ -12,8 +13,11 @@ public sealed class PPtr<T> where T : Object

public PPtr(ObjectReader reader)
{
m_FileID = reader.ReadInt32();
m_PathID = reader.m_Version < SerializedFileFormatVersion.Unknown_14 ? reader.ReadInt32() : reader.ReadInt64();
var buffer = (new byte[8]);
reader.Read(buffer, 0, buffer.Length);

m_FileID = BinaryPrimitives.ReadInt16LittleEndian(buffer);
m_PathID = ((long)BinaryPrimitives.ReadUInt16LittleEndian(buffer.AsSpan(2)) << 32) | BinaryPrimitives.ReadUInt32LittleEndian(buffer.AsSpan(4));
assetsFile = reader.assetsFile;
}

Expand Down
5 changes: 0 additions & 5 deletions AssetStudio/Classes/SkinnedMeshRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ public SkinnedMeshRenderer(ObjectReader reader) : base(reader)
var m_SkinNormals = reader.ReadBoolean(); //3.1.0 and below
reader.AlignStream();

if (version[0] == 2 && version[1] < 6) //2.6 down
{
var m_DisableAnimationWhenOffscreen = new PPtr<Animation>(reader);
}

m_Mesh = new PPtr<Mesh>(reader);

m_Bones = new PPtr<Transform>[reader.ReadInt32()];
Expand Down
3 changes: 3 additions & 0 deletions AssetStudio/Classes/Texture2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ public Texture2D(ObjectReader reader) : base(reader)
var m_PlatformBlob = reader.ReadUInt8Array();
reader.AlignStream();
}
var m_Limit = reader.ReadInt32();
var m_Touchable = reader.ReadBoolean();
reader.AlignStream();
var image_data_size = reader.ReadInt32();
if (image_data_size == 0 && ((version[0] == 5 && version[1] >= 3) || version[0] > 5))//5.3.0 and up
{
Expand Down
2 changes: 1 addition & 1 deletion AssetStudio/SerializedFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public SerializedFile(FileReader reader, AssetsManager assetsManager)
}
if (header.m_Version >= SerializedFileFormatVersion.Unknown_7)
{
unityVersion = reader.ReadStringToNull();
unityVersion = "2.5.5b4";
SetVersion(unityVersion);
}
if (header.m_Version >= SerializedFileFormatVersion.Unknown_8)
Expand Down
16 changes: 8 additions & 8 deletions AssetStudioFBXNative/AssetStudioFBXNative.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_AS_DLL;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.2.1\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.3.2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libfbxsdk-mt.lib;libxml2-mt.lib;zlib-mt.lib;wininet.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.2.1\lib\vs2019\x86\debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.3.2\lib\vs2019\x86\debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries>LIBCMT;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
</Link>
</ItemDefinitionGroup>
Expand All @@ -119,7 +119,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_AS_DLL;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.2.1\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.3.2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
Expand All @@ -128,7 +128,7 @@
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libfbxsdk-mt.lib;libxml2-mt.lib;zlib-mt.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.2.1\lib\vs2019\x86\release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.3.2\lib\vs2019\x86\release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
Expand All @@ -137,14 +137,14 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_AS_DLL;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.2.1\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.3.2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libfbxsdk-mt.lib;libxml2-mt.lib;zlib-mt.lib;wininet.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.2.1\lib\vs2019\x64\debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.3.2\lib\vs2019\x64\debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries>LIBCMT;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
</Link>
</ItemDefinitionGroup>
Expand All @@ -156,7 +156,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_AS_DLL;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.2.1\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.3.2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
Expand All @@ -165,7 +165,7 @@
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libfbxsdk-mt.lib;libxml2-mt.lib;zlib-mt.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.2.1\lib\vs2019\x64\release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.3.2\lib\vs2019\x64\release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# AssetStudio
[![Build status](https://ci.appveyor.com/api/projects/status/rnu7l90422pdewx4?svg=true)](https://ci.appveyor.com/project/Perfare/assetstudio/branch/master/artifacts)
# FFStudio

Customized `AssetStudio` that works with FF.

Special Thanks To:
- [OpenFusion](https://github.com/OpenFusionProject/OpenFusion).
- [Jade](https://github.com/JadeShrineMaiden).
- [bc15bekl](https://github.com/bc15bekl).

_____________________________________________________________________________________________________________________________

**None of the repo, the tool, nor the repo owner is affiliated with, or sponsored or authorized by, Unity Technologies or its affiliates.**

Expand Down

0 comments on commit f888273

Please sign in to comment.