public void FromXml(XmlNode node) { ParameterName = node.Attributes["ParameterName"].Value; foreach (XmlNode child in node.ChildNodes) { var key = new Key(child); Keys.Add(Quant(key.Time), key); } }
public void SetKeyFrame(int index, double time, Key.KeyType keyIn) { if (Target == null) { return; } int qt = KeyGroup.Quant(time); CurrentParameters = Target.GetParams(); ParameterNames.Clear(); ParameterNames.AddRange(Target.GetParamNames()); ParameterTypes.Clear(); ParameterTypes.AddRange(Target.GetParamTypes()); if (KeyFrames.Count != ParameterNames.Count) { KeyFrames.Clear(); for (int i = 0; i < ParameterNames.Count; i++) { KeyGroup kf = new KeyGroup(); kf.ParameterName = ParameterNames[i]; KeyFrames.Add(kf); } } if (index < ParameterNames.Count) { Key key = new Key(time, CurrentParameters[index], keyIn, ParameterTypes[index]); if (KeyFrames[index].Keys.ContainsKey(qt)) { KeyFrames[index].Keys[qt].Value = CurrentParameters[index]; } else { KeyFrames[index].Keys.Add(qt, key); } } }
public void SetKeyFrame(int index, double time, Key.KeyType keyIn) { if (Target == null) { return; } var qt = KeyGroup.Quant(time); CurrentParameters = Target.GetParams(); ParameterNames.Clear(); ParameterNames.AddRange(Target.GetParamNames()); ParameterTypes.Clear(); ParameterTypes.AddRange(Target.GetParamTypes()); if (KeyFrames.Count != ParameterNames.Count) { KeyFrames.Clear(); foreach (var name in ParameterNames) { var kf = new KeyGroup {ParameterName = name}; KeyFrames.Add(kf); } } if (index < ParameterNames.Count) { var key = new Key(time, CurrentParameters[index], keyIn, ParameterTypes[index]); if (KeyFrames[index].Keys.ContainsKey(qt)) { KeyFrames[index].Keys[qt].Value = CurrentParameters[index]; } else { KeyFrames[index].Keys.Add(qt, key); } } }
internal bool AddKey(Key newKey) { var collide = false; var k = Quant(newKey.Time); if (Keys.ContainsKey(k)) { collide = true; Keys.Remove(k); } Keys.Add(k, newKey); return collide; }