| 1 |
using System; |
| 2 |
using System.Collections.Generic; |
| 3 |
using System.IO; |
| 4 |
|
| 5 |
namespace Oni.Physics |
| 6 |
{ |
| 7 |
internal class ObjectAnimationImporter : Importer |
| 8 |
{ |
| 9 |
public ObjectAnimationImporter(string[] args) |
| 10 |
{ |
| 11 |
} |
| 12 |
|
| 13 |
public override void Import(string filePath, string outputDirPath) |
| 14 |
{ |
| 15 |
string name = Path.GetFileNameWithoutExtension(filePath); |
| 16 |
|
| 17 |
if (name.StartsWith("OBAN", StringComparison.Ordinal)) |
| 18 |
name = name.Substring(4); |
| 19 |
|
| 20 |
var scene = Dae.Reader.ReadFile(filePath); |
| 21 |
|
| 22 |
var importer = new ObjectDaeImporter(null, new Dictionary<string, Akira.AkiraDaeNodeProperties> { |
| 23 |
{ scene.Id, new ObjectDaeNodeProperties { |
| 24 |
HasPhysics = true, |
| 25 |
Animations = { new ObjectAnimationClip { |
| 26 |
} } |
| 27 |
} } |
| 28 |
}); |
| 29 |
|
| 30 |
importer.Import(scene); |
| 31 |
|
| 32 |
BeginImport(); |
| 33 |
|
| 34 |
foreach (var node in importer.Nodes) |
| 35 |
{ |
| 36 |
foreach (var anim in node.Animations) |
| 37 |
ObjectDatWriter.WriteAnimation(anim, this); |
| 38 |
} |
| 39 |
|
| 40 |
Write(outputDirPath); |
| 41 |
} |
| 42 |
} |
| 43 |
} |