Skip to content

Commit 0638278

Browse files
committed
Model Export updates to support Liinko's work on full model export.
1 parent 3b3bf05 commit 0638278

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

xivModdingFramework/Models/DataContainers/TTModel.cs

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -866,9 +866,9 @@ public void SaveToFile(string filePath, Action<bool, string> loggingFunction = n
866866
cmd.Parameters.AddWithValue("value", "ffxiv_tt");
867867
cmd.ExecuteScalar();
868868

869-
// Does the framework NOT have a version identifier? I couldn't find one, so the Cache version works.
869+
870870
cmd.Parameters.AddWithValue("key", "version");
871-
cmd.Parameters.AddWithValue("value", XivCache.CacheVersion);
871+
cmd.Parameters.AddWithValue("value", typeof(XivCache).Assembly.GetName().Version);
872872
cmd.ExecuteScalar();
873873

874874
// Axis information
@@ -886,7 +886,7 @@ public void SaveToFile(string filePath, Action<bool, string> loggingFunction = n
886886

887887

888888
// FFXIV stores stuff in Meters.
889-
cmd.Parameters.AddWithValue("key", "name");
889+
cmd.Parameters.AddWithValue("key", "root_name");
890890
cmd.Parameters.AddWithValue("value", Path.GetFileNameWithoutExtension(Source));
891891
cmd.ExecuteScalar();
892892

@@ -914,6 +914,21 @@ public void SaveToFile(string filePath, Action<bool, string> loggingFunction = n
914914
}
915915
}
916916

917+
var modelIdx = 0;
918+
var models = new List<string>() { Path.GetFileNameWithoutExtension(Source) };
919+
foreach (var model in models)
920+
{
921+
query = @"insert into models (model, name) values ($model, $name);";
922+
using (var cmd = new SQLiteCommand(query, db))
923+
{
924+
cmd.Parameters.AddWithValue("model", modelIdx);
925+
cmd.Parameters.AddWithValue("name", model);
926+
cmd.ExecuteScalar();
927+
928+
}
929+
modelIdx++;
930+
}
931+
917932
var matIdx = 0;
918933
foreach(var material in Materials)
919934
{
@@ -963,11 +978,15 @@ public void SaveToFile(string filePath, Action<bool, string> loggingFunction = n
963978
}
964979

965980

966-
query = @"insert into meshes (mesh, name, material_id) values ($mesh, $name, $material_id);";
981+
// Groups
982+
query = @"insert into meshes (mesh, name, material_id, model) values ($mesh, $name, $material_id, $model);";
967983
using (var cmd = new SQLiteCommand(query, db))
968984
{
969985
cmd.Parameters.AddWithValue("name", m.Name);
970986
cmd.Parameters.AddWithValue("mesh", meshIdx);
987+
988+
// This is always 0 for now. Support element for Liinko's work on multi-model export.
989+
cmd.Parameters.AddWithValue("model", 0);
971990
cmd.Parameters.AddWithValue("material_id", GetMaterialIndex(meshIdx));
972991
cmd.ExecuteScalar();
973992
}

xivModdingFramework/Resources/SQL/CreateImportDB.sql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,18 @@ CREATE TABLE "vertices" (
6464
PRIMARY KEY("mesh","part","vertex_id")
6565
);
6666

67+
-- Models
68+
CREATE TABLE "models" (
69+
"model" INTEGER NOT NULL,
70+
"name" TEXT,
71+
72+
Primary KEY("model")
73+
);
74+
6775
-- Meshes
6876
CREATE TABLE "meshes" (
6977
"mesh" INTEGER NOT NULL,
78+
"model" INTEGER NOT NULL,
7079
"material_id" INTEGER,
7180
"name" TEXT,
7281

0 commit comments

Comments
 (0)