Disable material migration for now

This commit is contained in:
Ottermandias 2024-07-16 22:04:36 +02:00
parent 07c3be641d
commit 9c781f8563
3 changed files with 31 additions and 21 deletions

@ -1 +1 @@
Subproject commit 2c067b4f3c1d84888c2b961a93fe2de01fffe5f1
Subproject commit c2a4c4ee7470c5afbd3dd7731697ab49c055d1e3

View file

@ -233,6 +233,8 @@ public class MigrationManager(Configuration config) : IService
/// <summary> Writes or migrates a .mdl file during extraction from a regular archive. </summary>
public void MigrateMdlDuringExtraction(IReader reader, string directory, ExtractionOptions options)
{
// TODO reactivate when this works.
return;
if (!config.MigrateImportedModelsToV6)
{
reader.WriteEntryToDirectory(directory, options);
@ -265,6 +267,8 @@ public class MigrationManager(Configuration config) : IService
public void MigrateMtrlDuringExtraction(IReader reader, string directory, ExtractionOptions options)
{
// TODO reactivate when this works.
return;
if (!config.MigrateImportedMaterialsToLegacy)
{
reader.WriteEntryToDirectory(directory, options);
@ -276,16 +280,20 @@ public class MigrationManager(Configuration config) : IService
using var e = reader.OpenEntryStream();
e.CopyTo(s);
var file = new MtrlFile(s.GetBuffer());
if (!file.IsDawnTrail)
{
file.MigrateToDawntrail();
Penumbra.Log.Debug($"Migrated material {reader.Entry.Key} to Dawntrail during import.");
}
Directory.CreateDirectory(Path.GetDirectoryName(path)!);
using var f = File.Open(path, FileMode.Create, FileAccess.Write);
s.Seek(0, SeekOrigin.Begin);
s.WriteTo(f);
if (file.IsDawnTrail)
{
file.MigrateToDawntrail();
Penumbra.Log.Debug($"Migrated material {reader.Entry.Key} to Dawntrail during import.");
f.Write(file.Write());
}
else
{
s.Seek(0, SeekOrigin.Begin);
s.WriteTo(f);
}
}
/// <summary> Update the data of a .mdl file during TTMP extraction. Returns either the existing array or a new one. </summary>

View file

@ -22,10 +22,11 @@ public class MigrationSectionDrawer(MigrationManager migrationManager, Configura
DrawMdlMigration();
DrawMdlRestore();
DrawMdlCleanup();
ImGui.Separator();
DrawMtrlMigration();
DrawMtrlRestore();
DrawMtrlCleanup();
// TODO enable when this works
//ImGui.Separator();
//DrawMtrlMigration();
//DrawMtrlRestore();
//DrawMtrlCleanup();
}
private void DrawSettings()
@ -39,15 +40,16 @@ public class MigrationSectionDrawer(MigrationManager migrationManager, Configura
ImUtf8.HoverTooltip("This increments the version marker and restructures the bone table to the new version."u8);
value = config.MigrateImportedMaterialsToLegacy;
if (ImUtf8.Checkbox("Automatically Migrate Materials to Dawntrail on Import"u8, ref value))
{
config.MigrateImportedMaterialsToLegacy = value;
config.Save();
}
ImUtf8.HoverTooltip(
"This currently only increases the color-table size and switches the shader from 'character.shpk' to 'characterlegacy.shpk', if the former is used."u8);
// TODO enable when this works
//value = config.MigrateImportedMaterialsToLegacy;
//if (ImUtf8.Checkbox("Automatically Migrate Materials to Dawntrail on Import"u8, ref value))
//{
// config.MigrateImportedMaterialsToLegacy = value;
// config.Save();
//}
//
//ImUtf8.HoverTooltip(
// "This currently only increases the color-table size and switches the shader from 'character.shpk' to 'characterlegacy.shpk', if the former is used."u8);
ImUtf8.Checkbox("Create Backups During Manual Migration", ref _createBackups);
}