void ExportViideoMotionKeyframes(XmlElement parent, VideoMotionKeyframes keyframes) { XmlElement elt = AddChild(parent, "Keyframes"); elt.SetAttribute("Count", keyframes.Count.ToString(myNumberFormat)); foreach (VideoMotionKeyframe keyframe in keyframes) { ExportVideoMotionKeyframe(elt, keyframe); } }
void ImportVideoMotionKeyframes(XmlElement parent, VideoMotionKeyframes keyframes) { XmlElement elt = parent["Keyframes"]; if (null == elt) { return; } foreach (XmlElement child in elt.SelectNodes("VideoMotionKeyframe")) { ImportVideoMotionKeyframe(child, keyframes); } }
void ImportVideoMotionKeyframe(XmlElement parent, VideoMotionKeyframes keyframes) { Timecode position = ChildTimecode(parent, "Position"); VideoMotionKeyframe keyframe; if (position.Nanos == 0) { keyframe = (VideoMotionKeyframe)keyframes[0]; } else { keyframe = new VideoMotionKeyframe(position); keyframes.Add(keyframe); } try { keyframe.Type = ChildVideoKeyframeType(parent, "Type"); } catch {} try { keyframe.Smoothness = ChildSingle(parent, "Smoothness"); } catch {} try { keyframe.Center = ChildVideoMotionVertex(parent, "Center"); } catch {} try { keyframe.Rotation = ChildDouble(parent, "Rotation"); } catch {} keyframe.Bounds = ChildVideoMotionBounds(parent, "Bounds"); }