/// <summary> /// Load From File /// </summary> /// <param name="filename">Filename</param> /// <param name="association">Custom Semantic Association</param> /// <returns>Model</returns> public static ModelData Import(string filename, SemanticAssociations association) { ModelData data = new ModelData(); XDocument doc = XDocument.Load(filename); //search for visual scene //instance_visual_scene XElement scene = doc.GetNode("instance_visual_scene"); if (scene == null) return null; XElement sceneReference = doc.GetReference(scene); data.Name = sceneReference.GetAttribute("name"); //Search for Nodes foreach (XElement c in sceneReference.GetChildren("node")) { data.Nodes.Add(LoadNodes(c, association)); } //Search for Animations XElement animation = doc.GetNode("library_animations"); Animation anim = new Animation(); if (animation != null) { var list = animation.GetNodes("animation"); foreach (XElement a in list) anim.Nodes.Add(CreateAnimationTrack(a)); } data.Animations.Add(anim); return data; }
internal AnimationManager(Animation animation) { Sets = new List<AnimationSet>(); foreach (var n in animation.Nodes) { //Add valid animation if (n.Interpolation != 0) { Sets.Add(new AnimationSet(n)); } } Duration = 0; if (Sets.Count > 0) Duration = (from s in Sets select s.Ticks.Max()).Max(); }