source: OniSplit/Totoro/BodySetImporter.cs@ 1114

Last change on this file since 1114 was 1114, checked in by iritscen, 5 years ago

Adding OniSplit source code (v0.9.99.0). Many thanks to Neo for all his work over the years.

File size: 1.1 KB
Line 
1using System;
2using System.IO;
3
4namespace Oni.Totoro
5{
6 internal class BodySetImporter : Importer
7 {
8 private BodyDaeImporter bodyImporter;
9
10 public BodySetImporter(string[] args)
11 {
12 bodyImporter = new BodyDaeImporter(args);
13 }
14
15 public override void Import(string filePath, string outputDirPath)
16 {
17 var name = Path.GetFileNameWithoutExtension(filePath);
18
19 if (name.StartsWith("ONCC", StringComparison.Ordinal))
20 name = name.Substring(4);
21
22 BeginImport();
23
24 var trbs = CreateInstance(TemplateTag.TRBS, name);
25 var trcm = bodyImporter.Import(filePath, ImporterFile);
26
27 WriteTRBS(trbs, trcm);
28
29 Write(outputDirPath);
30 }
31
32 private void WriteTRBS(ImporterDescriptor trbs, ImporterDescriptor trcm)
33 {
34 using (var writer = trbs.OpenWrite())
35 {
36 for (int i = 0; i < 5; i++)
37 writer.Write(trcm);
38 }
39 }
40 }
41}
Note: See TracBrowser for help on using the repository browser.