/// <summary> /// Loads a Model3D whether it is a Model or an Animation. /// </summary> /// <param name="path">The path of the Model3D file.</param> /// <param name="file">The name of the Model3D file.</param> /// <param name="scene">The Assimp Scene of the imported Model3D.</param> public void LoadModel3D(string path, Scene scene) { string workspacePath = System.IO.Path.Combine(GetCategoryPath("models"), !ModelExists(path) ? System.IO.Path.GetFileName(path) : System.IO.Path.GetFileName(path) + "1"); Copy(path, workspacePath); Mckineap.Models.Engine3D.Model3D model3D = new Mckineap.Models.Engine3D.Model3D(workspacePath, scene); if (model3D.HasAnimations) model3D.Serialize(); Load(model3D); }
/// <summary> /// Loads a Model3D in the associated model3DList ands sets the currentModel3D. /// </summary> /// <param name="model3D">The Model3D that needs to be loaded.</param> private void Load(Mckineap.Models.Engine3D.Model3D model3D) { models.Add(model3D); CurrentModel3D = models[models.Count - 1]; }
/// <summary> /// Select a Model from the list /// </summary> /// <param name="model">The Model3D to select</param> public void SelectModel3D(Mckineap.Models.Engine3D.Model3D model) { if (CurrentModel3D != null && CurrentModel3D.HasAnimations) CurrentModel3D.Serialize(); if (model != null) { Mckineap.Models.Engine3D.Model3D deserializedModel3D = model.Deserialize(); CurrentModel3D = deserializedModel3D != null ? deserializedModel3D : model; } }