Skip to content

Commit

Permalink
fix up
Browse files Browse the repository at this point in the history
  • Loading branch information
MontagueM committed Dec 23, 2024
1 parent 3e15921 commit 1a9ce9e
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 47 deletions.
18 changes: 2 additions & 16 deletions Charm/ActivityMapEntityView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Tiger.Schema.Activity;
using Tiger.Schema.Activity.DESTINY1_RISE_OF_IRON;
using Tiger.Schema.Activity.DESTINY2_SHADOWKEEP_2601;
using Tiger.Schema.Activity.DESTINY2_WITCHQUEEN_6307;
using Tiger.Schema.Entity;
using Tiger.Schema.Havok;
using Tiger.Schema.Shaders;
Expand Down Expand Up @@ -526,11 +527,6 @@ private static void ExportIndividual(List<FileHash> dataTables, string hash, str
ExporterScene dynamicScene = Exporter.Get().CreateScene(entity.Hash, ExportType.EntityInMap);
dynamicScene.AddEntity(entry.GetEntityHash(), entity.Load(ExportDetailLevel.MostDetailed), entity.Skeleton?.GetBoneNodes());
entity.SaveMaterialsFromParts(dynamicScene, entity.Load(ExportDetailLevel.MostDetailed));

if (_config.GetS2VMDLExportEnabled())
{
Source2Handler.SaveEntityVMDL($"{savePath}/Entities", entity);
}
}
}
}
Expand All @@ -545,11 +541,6 @@ private static void ExportIndividual(List<FileHash> dataTables, string hash, str
ExporterScene dynamicScene = Exporter.Get().CreateScene(entity.Hash, ExportType.EntityInMap);
dynamicScene.AddEntity(entry.GetEntityHash(), entity.Load(ExportDetailLevel.MostDetailed), entity.Skeleton?.GetBoneNodes());
entity.SaveMaterialsFromParts(dynamicScene, entity.Load(ExportDetailLevel.MostDetailed));

if (_config.GetS2VMDLExportEnabled())
{
Source2Handler.SaveEntityVMDL($"{savePath}/Entities", entity);
}
}
if (entry.DataResource.GetValue(dataTable.GetReader()) is SMapSkyEntResource skyResource)
{
Expand All @@ -560,18 +551,13 @@ private static void ExportIndividual(List<FileHash> dataTables, string hash, str

ExporterScene skyScene = Exporter.Get().CreateScene(element.Unk60.TagData.Unk08.Hash, ExportType.EntityInMap);
skyScene.AddModel(element.Unk60.TagData.Unk08);

if (_config.GetS2VMDLExportEnabled())
{
Source2Handler.SaveEntityVMDL($"{savePath}/Entities", element.Unk60.TagData.Unk08.Hash, element.Unk60.TagData.Unk08.Load(ExportDetailLevel.MostDetailed, null));
}
}
}
if (entry.DataResource.GetValue(dataTable.GetReader()) is SMapTerrainResource terrainArrangement)
{
ExporterScene staticScene = Exporter.Get().CreateScene($"{terrainArrangement.Terrain.Hash}_Terrain", ExportType.StaticInMap);
terrainArrangement.Terrain.Load();
terrainArrangement.Terrain.LoadIntoExporter(staticScene, savePath, _config.GetUnrealInteropEnabled() || _config.GetS2ShaderExportEnabled(), true);
terrainArrangement.Terrain.LoadIntoExporter(staticScene, savePath);
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion Charm/DevView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
using Tiger.Schema.Investment;
using Tiger.Schema.Shaders;
using Tiger.Schema.Havok;
+using Tiger.Schema.Static;
using Tiger.Schema.Static;

namespace Charm;

Expand Down
25 changes: 10 additions & 15 deletions Charm/EntityView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@ public static void Export(List<Entity> entities, string name, ExportTypeFlag exp
}
}

if (exportType == ExportTypeFlag.Full)
{
if (config.GetUnrealInteropEnabled())
{
AutomatedExporter.SaveInteropUnrealPythonFile(savePath, name, AutomatedExporter.ImportType.Entity, config.GetOutputTextureFormat());
}
}

// Scale and rotate
// fbxHandler.ScaleAndRotateForBlender(boneNodes[0]);
Tiger.Exporters.Exporter.Get().Export();
Expand Down Expand Up @@ -234,23 +242,10 @@ public static void ExportGearShader(ApiItem item, string itemName, string savePa
}
}

ConfigSubsystem config = CharmInstance.GetSubsystem<ConfigSubsystem>();
string savePath = config.GetExportSavePath();
string meshName = Regex.Replace(name, @"[^\u0000-\u007F]", "_").Replace(".", "_");
string itemName = Regex.Replace(string.Join("_", item.ItemName.Split(Path.GetInvalidFileNameChars())), @"[^\u0000-\u007F]", "_").Replace(".", "_");
savePath += $"/{meshName}";
Directory.CreateDirectory(savePath);

foreach (var dye in dyes)
{
dye.Value.ExportTextures($"{savePath}/Textures/DetailTextures/", config.GetOutputTextureFormat());
AutomatedExporter.SaveBlenderApiFile(savePath, itemName,
config.GetOutputTextureFormat(), dyes.Values.ToList());
}

AutomatedExporter.SaveBlenderApiFile(savePath, itemName,
config.GetOutputTextureFormat(), dyes.Values.ToList());

SBoxHandler.SaveGearVMAT(savePath, itemName,
config.GetOutputTextureFormat(), dyes.Values.ToList());
}

private List<MainViewModel.DisplayPart> MakeEntityDisplayParts(Entity entity, ExportDetailLevel detailLevel)
Expand Down
16 changes: 9 additions & 7 deletions Charm/MapView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ public static void ExportTerrainMap(Tag<SMapContainer> map)
if (entry.DataResource.GetValue(data.MapDataTable.GetReader()) is SMapTerrainResource terrainArrangement) // Terrain
{
terrainArrangement.Terrain.Load();
terrainArrangement.Terrain.LoadIntoExporter(scene, savePath, _config.GetUnrealInteropEnabled() || _config.GetS2ShaderExportEnabled());
terrainArrangement.Terrain.LoadIntoExporter(scene, savePath);
if (exportStatics)
{
ExporterScene staticScene = Exporter.Get().CreateScene($"{terrainArrangement.Terrain.Hash}_Terrain", ExportType.StaticInMap);
terrainArrangement.Terrain.LoadIntoExporter(staticScene, savePath, _config.GetUnrealInteropEnabled() || _config.GetS2ShaderExportEnabled(), true);
terrainArrangement.Terrain.LoadIntoExporter(staticScene, savePath);
}
}
});
Expand Down Expand Up @@ -274,10 +274,12 @@ private static void ExportStatics(string savePath, Tag<SMapContainer> map)
{
if (File.Exists($"{savePath}/Statics/{part.Static.Hash}.fbx")) continue;

string staticMeshName = part.Static.Hash.ToString();
ExporterScene staticScene = Exporter.Get().CreateScene(staticMeshName, ExportType.StaticInMap);
var staticmesh = part.Static.Load(ExportDetailLevel.MostDetailed);
staticScene.AddStatic(part.Static.Hash, staticmesh);
string staticMeshName = part.Static.Hash.ToString();
ExporterScene staticScene =
Exporter.Get().CreateScene(staticMeshName, ExportType.StaticInMap);
var staticmesh = part.Static.Load(ExportDetailLevel.MostDetailed);
staticScene.AddStatic(part.Static.Hash, staticmesh);
}
}
}
});
Expand Down Expand Up @@ -348,7 +350,7 @@ private static void ExportStatics(string savePath, Tag<SMapContainer> map)
List<StaticPart> parts = new();
foreach (var partEntry in terrain.TagData.StaticParts)
{
if (partEntry.DetailLevel == 0)
if (partEntry.Lod.DetailLevel == ELodCategory.MainGeom0)
{
var part = terrain.MakePart(partEntry);
terrain.TransformPositions(part);
Expand Down
14 changes: 8 additions & 6 deletions Charm/TagListView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ public enum ETagListType
WeaponAudioList,
[Description("Weapon Audio [Final]")]
WeaponAudio,
[Description("BKHD Group List")]
BKHDGroupList,
[Description("BKHD Group [Final]")]
BKHDGroup,
[Description("BKHD Audio List")]
BKHDAudioList,
[Description("BKHD Audio [Final]")]
BKHDAudio,
[Description("Material List [Packages]")]
MaterialList,
[Description("Material [Final]")]
Expand Down Expand Up @@ -286,12 +294,6 @@ public async void LoadContent(ETagListType tagListType, TigerHash contentValue =
case ETagListType.Material:
LoadMaterial(contentValue as FileHash);
break;
case ETagListType.MaterialList:
await LoadMaterialList();
break;
case ETagListType.Material:
LoadMaterial(contentValue as FileHash);
break;
case ETagListType.BKHDGroupList:
await LoadBKHDGroupList();
break;
Expand Down
4 changes: 2 additions & 2 deletions Tiger/Schema/Static/Terrain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public StaticPart MakeLODPart(SMeshGroup entry, int groupIndex)
return part;
}

private void TransformPositions(StaticPart part)
public void TransformPositions(StaticPart part)
{
Debug.Assert(part.VertexPositions.Count == part.VertexNormals.Count);
for (int i = 0; i < part.VertexPositions.Count; i++)
Expand Down Expand Up @@ -241,7 +241,7 @@ private void TransformPositions(StaticPart part)
}
}

private void TransformTexcoords(StaticPart part)
public void TransformTexcoords(StaticPart part)
{
for (int i = 0; i < part.VertexTexcoords0.Count; i++)
{
Expand Down

0 comments on commit 1a9ce9e

Please sign in to comment.