Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
ImportAssimpCommand.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 using System.ComponentModel;
5 using System.IO;
6 using System.Linq;
7 
8 using SiliconStudio.Paradox.DataModel;
9 using SiliconStudio.Core.Serialization.Assets;
10 using SiliconStudio.Paradox.Effects.Data;
11 
12 namespace SiliconStudio.BuildEngine
13 {
14  [CommandDependsOn(typeof(Paradox.Importer.AssimpNET.MeshConverter))]
15  [Description("Import Assimp")]
17  {
18  private static string[] supportedExtensions = { ".dae", ".dae", ".3ds", ".obj", ".blend" };
19 
20  /// <inheritdoc/>
21  public override string Title { get { string title = "Import Assimp "; try { title += Path.GetFileName(SourcePath) ?? "[File]"; } catch { title += "[INVALID PATH]"; } return title; } }
22 
23  public static bool IsSupportingExtensions(string ext)
24  {
25  var extToLower = ext.ToLower();
26 
27  return !String.IsNullOrEmpty(ext) && supportedExtensions.Any(supExt => supExt.Equals(extToLower));
28  }
29 
30  private Paradox.Importer.AssimpNET.MeshConverter CreateMeshConverter(ICommandContext commandContext)
31  {
32  return new Paradox.Importer.AssimpNET.MeshConverter(commandContext.Logger)
33  {
34  ViewDirectionForTransparentZSort = this.ViewDirectionForTransparentZSort,
35  AllowUnsignedBlendIndices = this.AllowUnsignedBlendIndices
36  };
37  }
38 
39  protected override ModelData LoadModel(ICommandContext commandContext, AssetManager assetManager)
40  {
41  var converter = CreateMeshConverter(commandContext);
42  var sceneData = converter.Convert(SourcePath, Location);
43  return sceneData;
44  }
45 
46  protected override AnimationClip LoadAnimation(ICommandContext commandContext, AssetManager assetManager)
47  {
48  var meshConverter = this.CreateMeshConverter(commandContext);
49  var sceneData = meshConverter.ConvertAnimation(SourcePath, Location);
50  return sceneData;
51  }
52 
53  public override string ToString()
54  {
55  return "Import Assimp " + base.ToString();
56  }
57  }
58 }
An aggregation of AnimationCurve with their channel names.
override AnimationClip LoadAnimation(ICommandContext commandContext, AssetManager assetManager)
override ModelData LoadModel(ICommandContext commandContext, AssetManager assetManager)
Data type for SiliconStudio.Paradox.Effects.Model.
Definition: EngineData.cs:241