ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/OniSplit/Totoro/BodySetImporter.cs
Revision: 1114
Committed: Wed Jan 22 14:08:57 2020 UTC (5 years, 8 months ago) by iritscen
File size: 1094 byte(s)
Log Message:
Adding OniSplit source code (v0.9.99.0). Many thanks to Neo for all his work over the years.

File Contents

# Content
1 using System;
2 using System.IO;
3
4 namespace 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 }