private bool IsHomogeneousTime() { if (keys != null) { int currentTime = 0; bool first = true; foreach (VisibleKey vk in keys.Values) { Key key = vk.Target.GetKey(vk.ParameterIndex, vk.Time); if (first) { currentTime = KeyGroup.Quant(key.Time); first = false; } else { if (KeyGroup.Quant(key.Time) != currentTime) { return(false); } } } return(true); } return(false); }
public void FromXml(System.Xml.XmlNode node) { TargetID = node.Attributes["TargetID"].Value; TargetType = (AnimationTargetTypes)Enum.Parse(typeof(AnimationTargetTypes), node.Attributes["TargetType"].Value, true); if (node.Attributes["Expanded"] != null) { Expanded = bool.Parse(node.Attributes["Expanded"].Value); } foreach (System.Xml.XmlNode child in node.ChildNodes) { KeyGroup kf = new KeyGroup(); kf.FromXml(child); ParameterNames.Add(kf.ParameterName); KeyFrames.Add(kf); } }
public void SetKeyFrame(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); } } for (int i = 0; i < ParameterNames.Count; i++) { Key key = new Key(time, CurrentParameters[i], keyIn, ParameterTypes[i]); if (KeyFrames[i].Keys.ContainsKey(qt)) { KeyFrames[i].Keys[qt].Value = CurrentParameters[i]; } else { KeyFrames[i].Keys.Add(qt, key); } } }
public void PasteFromXML(System.Xml.XmlNode node, bool atTime, double time) { foreach (System.Xml.XmlNode child in node.ChildNodes) { KeyGroup kf = new KeyGroup(); kf.FromXml(child); for (int i = 0; i < ParameterNames.Count; i++) { if (ParameterNames[i] == kf.ParameterName) { foreach (Key key in kf.Keys.Values) { if (atTime) { key.Time = time; } this.KeyFrames[i].AddKey(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 PasteFromXML(System.Xml.XmlNode node, bool atTime, double time) { foreach (System.Xml.XmlNode child in node.ChildNodes) { KeyGroup kf = new KeyGroup(); kf.FromXml(child); for (int i = 0; i < ParameterNames.Count; i++ ) { if (ParameterNames[i] == kf.ParameterName) { foreach (Key key in kf.Keys.Values) { if (atTime) { key.Time = time; } this.KeyFrames[i].AddKey(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); } } }
public static string GetIndexKey(AnimationTarget target, int parameterIndex, double time) { return(target.TargetID + "\t" + parameterIndex.ToString() + "\t" + KeyGroup.Quant(time).ToString()); }