Example #1
0
 public static void Perform(Node node)
 {
     foreach (var m in node.Parent.Markers)
     {
         SetMarker.Perform(node, m.Clone(), true);
         SetKeyframe.Perform(node, nameof(Node.Trigger), null, new Keyframe <string> {
             Frame    = m.Frame,
             Value    = m.Id,
             Function = KeyFunction.Linear
         });
     }
 }
Example #2
0
            protected override void InternalDo(TimelineHorizontalShift op)
            {
                var container = Document.Current.Container;

                foreach (var node in container.Nodes)
                {
                    foreach (var animator in node.Animators.Where(i => i.AnimationId == Document.Current.AnimationId))
                    {
                        var keys = op.Direction > 0 ? animator.ReadonlyKeys.Reverse() : animator.ReadonlyKeys;
                        foreach (var k in keys.ToList())
                        {
                            if (k.Frame >= op.Column)
                            {
                                RemoveKeyframe.Perform(animator, k.Frame);
                                var k1 = k.Clone();
                                k1.Frame += op.Direction.Sign();
                                if (op.Direction > 0 || k.Frame > op.Column)
                                {
                                    SetKeyframe.Perform(animator, k1);
                                }
                            }
                        }
                    }
                }
                var markers = container.Markers.ToList();

                if (op.Direction > 0)
                {
                    markers.Reverse();
                }
                foreach (var m in markers)
                {
                    if (m.Frame >= op.Column)
                    {
                        DeleteMarker.Perform(container.Markers, m);
                        var m1 = m.Clone();
                        m1.Frame += op.Direction.Sign();
                        if (op.Direction > 0 || m.Frame > op.Column)
                        {
                            SetMarker.Perform(container.Markers, m1);
                        }
                    }
                }
            }
Example #3
0
        public static void Perform(int column)
        {
            var container = Document.Current.Container;

            foreach (var node in container.Nodes)
            {
                var occupied = new HashSet <int>();
                if (node.Animators.Count == 0)
                {
                    continue;
                }
                foreach (var animator in node.Animators.Where(i => i.AnimationId == Document.Current.AnimationId))
                {
                    foreach (var k in animator.ReadonlyKeys)
                    {
                        occupied.Add(k.Frame);
                    }
                }
                int removeAt = occupied.Max() + 1;
                for (int i = column - 1; ; ++i)
                {
                    if (!occupied.Contains(i))
                    {
                        removeAt = i;
                        break;
                    }
                }
                foreach (var animator in node.Animators.Where(i => i.AnimationId == Document.Current.AnimationId).ToList())
                {
                    var keys = animator.ReadonlyKeys.ToList();
                    foreach (var k in keys)
                    {
                        if (k.Frame != 0 && k.Frame >= removeAt)
                        {
                            var k1 = k.Clone();
                            k1.Frame -= 1;
                            SetKeyframe.Perform(animator, k1);
                            RemoveKeyframe.Perform(animator, k.Frame);
                        }
                    }
                }
            }
            var markers = container.Markers.ToList();

            if (markers.Count == 0)
            {
                return;
            }
            var markersOccupied = new HashSet <int>();

            foreach (var m in markers)
            {
                markersOccupied.Add(m.Frame);
            }
            int markersRemoveAt = markersOccupied.Max() + 1;

            for (int i = column - 1; ; ++i)
            {
                if (!markersOccupied.Contains(i))
                {
                    markersRemoveAt = i;
                    break;
                }
            }
            foreach (var m in markers)
            {
                if (m.Frame != 0 && m.Frame >= markersRemoveAt)
                {
                    var m1 = m.Clone();
                    m1.Frame -= 1;
                    DeleteMarker.Perform(container, m, false);
                    SetMarker.Perform(container, m1, false);
                }
            }
        }