Beispiel #1
0
 /// <summary>
 /// Initializes a KeyWrapper
 /// </summary>
 /// <param name="curveKey">The key to wrap</param>
 /// <param name="curve">The curve that owns curveKey</param>
 /// <param name="id">Pass -1 to autogenerate a new id</param>
 public KeyWrapper(CurveKey curveKey, CurveWrapper curve, KeyTangentMode tangentMode, long id = -1)
 {
     if (id < 0)
         Id = latestId++;
     else
         Id = id;
     Curve = curve;
     Key = curveKey;
     tangentInMode = tangentMode;
     tangentOutMode = tangentMode;
 }
Beispiel #2
0
 public CurveTreeLeaf(CurveTreeNode parent, CurveWrapper curve)
     : base(parent)
 {
     Curve = curve;
 }
        /// <summary>
        /// Adds the curve to the TreeView and also the CurveEditorControl.
        /// </summary>
        internal void AddCurve(string name, Curve curve)
        {
            // Check if the curve is already added.
            var container = FindContainerLeaf(Root, curve);
            if (container != null)
            {
                container.IsSelected = true;
                container.IsVisible = true;
                return;
            }

            // Add to tree
            String[] path = name.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
            CurveTreeNode node = Root;
            for (int i = 0; i < path.Length - 1; i++)
            {
                CurveTreeNode child;
                if ((child = GetChildNode(node, path[i])) == null)
                {
                    child = new CurveTreeNode(path[i], node);
                    node.Children.Add(child);
                }
                node = child;
            }

            // Add to control
            String curveName = path[path.Length - 1];
            CurveWrapper wrapper = new CurveWrapper(curve, curveName, Control, GetColor(curveName));
            Control.Curves.Add(wrapper);
            // Add to tree
            node.Children.Add(new CurveTreeLeaf(node, wrapper));

            //for (int i = 0; i < 20; i++)
            //{
            //    wrapper.AddKey(new CurveKey((float)random.NextDouble(), (float)random.NextDouble()));
            //}
        }