Exemplo n.º 1
0
        public static void CopyKeyframesToClipboard(this IKeyFrames uniformKeyFrames)
        {
            string data = string.Empty;

            foreach (var keyframe in uniformKeyFrames)
            {
                data += keyframe.Key.ToString() + '\t' + keyframe.Value.ToString() + Environment.NewLine;
            }
            Clipboard.SetText(data);
        }
 public FacadeKeyframesVisualisation(string uniformName, IKeyFrames kfs)
 {
     formGraph = new FormGraph(uniformName);
     formGraph.OnChangePoints += FormGraph_OnChangePoints;
     formGraph.OnChangePosition += (pos) => { OnChangePosition?.Invoke((float)pos); };
     formGraph.KeyDown += (sender, args) => { OnKeyDown?.Invoke(sender, args); };
     formGraph.OnCopyCommand += (sender, args) => { if (null != kfs) kfs.CopyKeyframesToClipboard(); };
     formGraph.OnPasteCommand += (sender, args) => { if (null != kfs) kfs.PasteKeyframesFromClipboard(); };
     currentUniform = uniformName;
     this.kfs = kfs;
     Update();
 }
Exemplo n.º 3
0
        public static void PasteKeyframesFromClipboard(this IKeyFrames uniformKeyFrames)
        {
            string data   = Clipboard.GetText();
            var    chunks = data.Split(new string[] { "\t", Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);

            if (chunks.Length % 2 != 0)
            {
                return;
            }
            uniformKeyFrames.Clear();
            for (int i = 0; i < chunks.Length; ++i)
            {
                var time = ConvertToFloat(chunks[i]);
                ++i;
                var value = ConvertToFloat(chunks[i]);
                uniformKeyFrames.AddUpdate(time, value);
            }
        }
Exemplo n.º 4
0
 public FacadeKeyframesVisualisation(string uniformName, IKeyFrames kfs)
 {
     formGraph = new FormGraph(uniformName);
     formGraph.ChangedPoints   += FormGraph_OnChangePoints;
     formGraph.ChangedPosition += (pos) => { ChangedPosition?.Invoke((float)pos); };
     formGraph.KeyDown         += (sender, args) => { KeyDown?.Invoke(sender, args); };
     formGraph.CopyCommand     += (sender, args) => { if (!ReferenceEquals(null, kfs))
                                                      {
                                                          kfs.CopyKeyframesToClipboard();
                                                      }
     };
     formGraph.PasteCommand += (sender, args) => { if (!ReferenceEquals(null, kfs))
                                                   {
                                                       kfs.PasteKeyframesFromClipboard();
                                                   }
     };
     currentUniform = uniformName;
     this.kfs       = kfs;
     Update();
 }