2 using System.Collections.Generic;
\r
8 public class MqoGenerator
\r
10 public TSOFile LoadTSO(string file)
\r
12 TSOFile tso = new TSOFile(file);
\r
17 public void Generate(string tso_file, string out_path, MqoBoneMode bone_mode)
\r
19 string tso_filename = Path.GetFileName(tso_file);
\r
20 string mqo_file = Path.Combine(out_path, Path.ChangeExtension(tso_filename, ".mqo"));
\r
21 string xml_file = Path.Combine(out_path, Path.ChangeExtension(tso_filename, ".xml"));
\r
24 using (MqoWriter mqo = new MqoWriter(mqo_file))
\r
26 TSOFile tso = LoadTSO(tso_file);
\r
27 tso.SwitchBoneIndicesOnMesh();
\r
29 mqo.BoneMode = bone_mode;
\r
34 ImportInfo ii = new ImportInfo();
\r
37 foreach (TSOTex tex in tso.textures)
\r
38 ii.textures.Add(new ImportTextureInfo(tex));
\r
41 foreach (TSOEffect effect in tso.effects)
\r
43 ii.effects.Add(new ImportEffectInfo(effect));
\r
44 File.WriteAllText(Path.Combine(out_path, effect.Name), effect.code, Encoding.Default);
\r
48 foreach (TSOMaterial mat in tso.materials)
\r
50 ii.materials.Add(new ImportMaterialInfo(mat));
\r
51 File.WriteAllText(Path.Combine(out_path, mat.Name), mat.code, Encoding.Default);
\r
54 ImportInfo.Save(xml_file, ii);
\r