\r
private void OpenMQOFile(string file)\r
{\r
- TSOGenerateConfig config = new TSOGenerateConfig();\r
+ TSOGeneratorConfig config = new TSOGeneratorConfig();\r
config.ShowMaterials = cbShowMaterials.Checked;\r
\r
if (rbRefBone.Checked)\r
{\r
- TSOGeneratorRefBone gen = new TSOGeneratorRefBone();\r
- gen.Generate(file, tbTso.Text, tbTsoEx.Text, config);\r
+ TSOGeneratorRefBone gen = new TSOGeneratorRefBone(config);\r
+ gen.Generate(file, tbTso.Text, tbTsoEx.Text);\r
}\r
else\r
if (rbOneBone.Checked)\r
{\r
- TSOGeneratorOneBone gen = new TSOGeneratorOneBone();\r
+ TSOGeneratorOneBone gen = new TSOGeneratorOneBone(config);\r
\r
foreach (ListViewItem i in lvObject.Items)\r
{\r
gen.ObjectBoneNames.Add(i.SubItems[0].Text, i.SubItems[1].Text);\r
}\r
\r
- gen.Generate(file, tbTso.Text, tbTsoEx.Text, config);\r
+ gen.Generate(file, tbTso.Text, tbTsoEx.Text);\r
}\r
else\r
{\r
[STAThread]\r
static int Main(string[] args)\r
{\r
- if(args.Length != 0)\r
+ if (args.Length != 0)\r
{ // バッチで処理する\r
try\r
{\r
- string tso = null;\r
- string mqo = null;\r
- string rtso= null;\r
+ string tso = null;\r
+ string mqo = null;\r
+ string tsoref = null;\r
\r
- foreach(string i in args)\r
+ foreach (string i in args)\r
{\r
- string o = i.ToLower();\r
+ string o = i.ToLower();\r
\r
- switch(o)\r
+ switch (o)\r
{\r
- default:\r
- if(o.StartsWith("-tso:")) tso = o.Substring(5).Trim('\r', '\n');\r
- else if(o.StartsWith("-mqo:")) mqo = o.Substring(5).Trim('\r', '\n');\r
- else if(o.StartsWith("-ref:")) rtso= o.Substring(5).Trim('\r', '\n');\r
- else throw new ArgumentException("Invalid option: " + i);\r
- break;\r
+ default:\r
+ if (o.StartsWith("-tso:")) tso = o.Substring(5).Trim('\r', '\n');\r
+ else if (o.StartsWith("-mqo:")) mqo = o.Substring(5).Trim('\r', '\n');\r
+ else if (o.StartsWith("-ref:")) tsoref = o.Substring(5).Trim('\r', '\n');\r
+ else throw new ArgumentException("Invalid option: " + i);\r
+ break;\r
}\r
}\r
\r
- TSOGeneratorRefBone gen = new TSOGeneratorRefBone();\r
- TSOGenerateConfig config = new TSOGenerateConfig();\r
- config.cui = true;\r
- config.ShowMaterials = false;\r
+ TSOGeneratorConfig config = new TSOGeneratorConfig();\r
+ config.cui = true;\r
+ config.ShowMaterials = false;\r
+ TSOGeneratorRefBone gen = new TSOGeneratorRefBone(config);\r
\r
- if(mqo == null) throw new ArgumentException("「-mso:ファイル名」の形式で入力Mqoファイル名を指定してください");\r
- if(tso == null) throw new ArgumentException("「-tso:ファイル名」の形式で出力Tsoファイル名を指定してください");\r
- if(rtso == null) throw new ArgumentException("「-ref:ファイル名」の形式で参照Tsoファイル名を指定してください");\r
+ if (mqo == null) throw new ArgumentException("「-mso:ファイル名」の形式で入力Mqoファイル名を指定してください");\r
+ if (tso == null) throw new ArgumentException("「-tso:ファイル名」の形式で出力Tsoファイル名を指定してください");\r
+ if (tsoref == null) throw new ArgumentException("「-ref:ファイル名」の形式で参照Tsoファイル名を指定してください");\r
\r
- gen.Generate(mqo, rtso, tso, config);\r
- } catch(ArgumentException e)\r
+ gen.Generate(mqo, tsoref, tso);\r
+ }\r
+ catch (ArgumentException e)\r
{\r
System.Diagnostics.Debug.WriteLine(e.Message);\r
System.Console.Out.WriteLine(e.Message);\r
System.Console.Out.Flush();\r
return 1;\r
- } catch(Exception e)\r
+ }\r
+ catch (Exception e)\r
{\r
System.Diagnostics.Debug.WriteLine(e.Message);\r
System.Console.Out.WriteLine(e.Message);\r
{\r
public abstract class TSOGenerator\r
{\r
- private string dir;\r
- private TSOGenerateConfig config;\r
- protected MqoFile mqo;\r
- protected TSOFile tsor;\r
+ private string dir;\r
+ private TSOGeneratorConfig config;\r
+ protected MqoFile mqo;\r
+ protected TSOFile tsor;\r
protected Dictionary<string, TSONode> nodes;\r
- protected List<TSOMesh> meshes;\r
- private ImportInfo ii;\r
- private BinaryWriter bw;\r
- protected Dictionary<string, MaterialInfo> materials;\r
- private Dictionary<string, TextureInfo> textures;\r
+ protected List<TSOMesh> meshes;\r
+ private ImportInfo ii;\r
+ private BinaryWriter bw;\r
+ protected Dictionary<string, MaterialInfo> materials;\r
+ private Dictionary<string, TextureInfo> textures;\r
+\r
+ public TSOGenerator(TSOGeneratorConfig config)\r
+ {\r
+ this.config = config;\r
+ }\r
\r
public TSOFile LoadTSO(string file)\r
{\r
tsor = null;\r
nodes = null;\r
meshes = null;\r
- config = null;\r
mqo = null;\r
ii = null;\r
bw = null;\r
return true;\r
}\r
\r
- public void Generate(string mqoin, string tsoref, string tsoex, TSOGenerateConfig config)\r
+ public void Generate(string mqoin, string tsoref, string tsoex)\r
{\r
- this.config = config;\r
string importinfo_file = Path.ChangeExtension(mqoin, ".xml");\r
\r
try\r
{\r
public Dictionary<string, string> ObjectBoneNames = new Dictionary<string, string>();\r
\r
+ public TSOGeneratorOneBone(TSOGeneratorConfig config)\r
+ : base(config)\r
+ {\r
+ }\r
+\r
protected override bool DoLoadRefTSO(string tsoref)\r
{\r
// 参照TSOロード\r
\r
public unsafe class TSOGeneratorRefBone : TSOGenerator\r
{\r
- private List<Vertex> vlst;\r
- private PointCluster pc;\r
+ private List<Vertex> vlst;\r
+ private PointCluster pc;\r
+\r
+ public TSOGeneratorRefBone(TSOGeneratorConfig config)\r
+ : base(config)\r
+ {\r
+ }\r
\r
private void CreatePointCluster(TSOFile tso)\r
{\r
\r
namespace Tso2MqoGui\r
{\r
- public class TSOGenerateConfig\r
+ public class TSOGeneratorConfig\r
{\r
public bool ShowMaterials = false;\r
public bool cui = false;\r
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">\r
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">\r
<PropertyGroup>\r
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
<Compile Include="RDBBonFile.cs" />\r
<Compile Include="TDCGFile.cs" />\r
<Compile Include="TSOFile.cs" />\r
- <Compile Include="TSOGenerateConfig.cs" />\r
+ <Compile Include="TSOGeneratorConfig.cs" />\r
<Compile Include="TSOGenerator.cs" />\r
<Compile Include="TSOWriter.cs" />\r
<Compile Include="VertexHeap.cs" />\r
<Target Name="AfterBuild">\r
</Target>\r
-->\r
-</Project>\r
+</Project>
\ No newline at end of file