Beispiel #1
0
        internal override void Disarm()
        {
            base.Disarm();

            bool hidden            = ModManager.CheckActive(hitObjectManager.ActiveMods, Mods.Hidden);
            bool hasApproachCircle = ShowApproachCircle && (!hidden || hitObjectManager.hitObjects.Count == 0);

            Transformation fadeout = hidden ?
                                     new Transformation(TransformationType.Fade, 1, 0, StartTime - (int)(LocalPreEmpt * 0.6), StartTime - (int)(LocalPreEmpt * 0.3))
            {
                TagNumeric = ARMED
            } :
            new Transformation(TransformationType.Fade, 1, 0, StartTime + hitObjectManager.HitWindow100, StartTime + hitObjectManager.HitWindow50)
            {
                TagNumeric = ARMED
            };

            SpriteHitCircle1.Transformations.Add(fadeout.Clone());
            SpriteHitCircle2.Transformations.Add(fadeout.Clone());
            SpriteHitCircleText.Transformations.Add(fadeout.Clone());
            if (hasApproachCircle && hidden)
            {
                SpriteApproachCircle.Transformations.Add(fadeout.Clone());
            }

            SpriteHitCircle1.Scale    = 1;
            SpriteHitCircle2.Scale    = 1;
            SpriteHitCircleText.Scale = TEXT_SIZE;
        }
Beispiel #2
0
        public void ZoomViewTo(Point location, float scale)
        {
            var newTransf = Transformation.Clone();

            Matrix invMatrix = newTransf.Clone();

            invMatrix.Invert();

            PointF[] t1Points = new PointF[1] {
                location
            };
            invMatrix.TransformPoints(t1Points);

            var toScale = scale / newTransf.Elements[0];

            newTransf.Scale(toScale, toScale);

            invMatrix = newTransf.Clone();
            invMatrix.Invert();

            PointF[] t2Points = new PointF[1] {
                location
            };
            invMatrix.TransformPoints(t2Points);

            float offsetXDiff = t2Points[0].X - t1Points[0].X;
            float offsetYDiff = t2Points[0].Y - t1Points[0].Y;

            newTransf.Translate(offsetXDiff, offsetYDiff);
            Transformation = newTransf;
        }
Beispiel #3
0
        public override bool IsInFrustum(FrustumParams data, Point3D center, double radius)
        {
            Point3D transfCenter = (Point3D)center.Clone();

            if (t != 0 && rotationAxis != null)
            {
                // Get the BlockReference full transformation
                Transformation brFullTransf = GetFullTransformation(data.Blocks);

                // Apply the inverse of the full transformation to the center to bring it back to original position
                // It's necessary because in the MoveTo() the first transformation is applied before tha base method is called.
                Transformation tr = (Transformation)brFullTransf.Clone();
                tr.Invert();
                transfCenter.TransformBy(tr);

                // Compute a transformation equals to the transformation applied in the MoveTo method
                Translation translation1 = new Translation(t * translationVect.X, t * translationVect.Y, t * translationVect.Z);
                Translation translation2 = new Translation(firstPt.X, firstPt.Y, firstPt.Z);
                Translation translation3 = new Translation(-firstPt.X, -firstPt.Y, -firstPt.Z);
                Rotation    rotation     = new Rotation(Utility.DegToRad(t * rotationAngle), rotationAxis);

                Transformation customTransform = translation1 * brFullTransf;
                customTransform = customTransform * translation2;
                customTransform = customTransform * rotation;
                customTransform = customTransform * translation3;

                // Apply transformation to the center
                transfCenter.TransformBy(customTransform);
            }

            // Call the base with the transformed "center", to avoid undesired clipping
            return(base.IsInFrustum(data, transfCenter, radius));
        }
Beispiel #4
0
        internal virtual void HitAnimation(bool isHit)
        {
            if (isHit)
            {
                //Fade out the actual hit circle
                Transformation circleScaleOut =
                    new Transformation(TransformationType.Scale, 1.1F, 1.9F, GameBase.Time,
                                       (int)(GameBase.Time + (HitObjectManager.FadeOut * 0.7)));
                circleScaleOut.Easing = EasingTypes.In;

                Transformation circleScaleOut2 =
                    new Transformation(TransformationType.Scale, 1.9F, 2F,
                                       (int)(GameBase.Time + (HitObjectManager.FadeOut * 0.7)),
                                       (GameBase.Time + HitObjectManager.FadeOut));

                Transformation textScaleOut = circleScaleOut.Clone();
                textScaleOut.StartFloat *= textSize;
                textScaleOut.EndFloat   *= textSize;

                Transformation textScaleOut2 = circleScaleOut2.Clone();
                textScaleOut2.StartFloat *= textSize;
                textScaleOut2.EndFloat   *= textSize;

                Transformation circleFadeOut =
                    new Transformation(TransformationType.Fade, 1, 0, GameBase.Time,
                                       GameBase.Time + HitObjectManager.FadeOut);


                //SpriteHitCircle1.Depth = SpriteManager.drawOrderFwd(StartTime + 1);
                SpriteHitCircle1.Transformations.Clear();
                SpriteHitCircle1.Clock = ClockTypes.Game;
                SpriteHitCircle1.Transformations.Add(circleScaleOut);
                SpriteHitCircle1.Transformations.Add(circleScaleOut2);
                SpriteHitCircle1.Transformations.Add(circleFadeOut);

                //SpriteHitCircle2.Depth = SpriteManager.drawOrderFwd(StartTime + 2);
                SpriteHitCircle2.Transformations.Clear();
                SpriteHitCircle2.Clock = ClockTypes.Game;
                SpriteHitCircle2.Transformations.Add(circleScaleOut);
                SpriteHitCircle2.Transformations.Add(circleScaleOut2);
                SpriteHitCircle2.Transformations.Add(circleFadeOut);

                //SpriteHitCircleText.Depth = SpriteManager.drawOrderFwd(StartTime + 2);
                SpriteHitCircleText.Transformations.Clear();
                SpriteHitCircleText.Clock = ClockTypes.Game;
                SpriteHitCircleText.Transformations.Add(textScaleOut);
                SpriteHitCircleText.Transformations.Add(textScaleOut2);
                SpriteHitCircleText.Transformations.Add(circleFadeOut);

                SpriteApproachCircle.Transformations.Clear();
            }
            else
            {
                foreach (pSprite p in SpriteCollection)
                {
                    p.Transformations.Clear();
                }
            }
        }
Beispiel #5
0
        public void SetScale(float scale)
        {
            var newTransf = Transformation.Clone();
            var newScale  = scale / newTransf.Elements[0];

            newTransf.Scale(newScale, newScale);
            Transformation = newTransf;
        }
Beispiel #6
0
        public void ScrollViewBy(int deltaX, int deltaY)
        {
            var   newTransf    = Transformation.Clone();
            float currentScale = newTransf.Elements[0];

            newTransf.Translate(deltaX / currentScale, deltaY / currentScale);
            Transformation = newTransf;
        }
 public object Clone()
 {
     return(new ParameterMapping
     {
         SourceRef = SourceRef,
         TargetRef = TargetRef,
         Transformation = Transformation == null ? null : (CMMNExpression)Transformation.Clone()
     });
 }
Beispiel #8
0
        public void CenterView(float x, float y, float width, float height, float scale = 1.0f)
        {
            var newTransf = Transformation.Clone();

            newTransf.Reset();
            newTransf.Translate(width / 2, height / 2);
            newTransf.Scale(scale, scale);
            newTransf.Translate(-x, -y);
            Transformation = newTransf;
        }
Beispiel #9
0
        private Point CalculateWorldPosition(Point viewPosition)
        {
            var inverted = Transformation.Clone();
            //inverted.Invert();

            var list = new Point[] { viewPosition };

            inverted.TransformPoints(list);
            return(list[0]);
        }
Beispiel #10
0
        public void TestTransformationClone()
        {
            // transformation should be cloneable
            Transformation transform1 = new Transformation().X(100).Y(100).Width(200).Crop("fill").Chain().Radius(10).Chain().Crop("crop").Width(100).Angle("12", "13", "14");
            Transformation transform2 = transform1.Clone();

            transform1 = transform1.Angle("22", "23").Chain().Crop("fill");

            Assert.AreEqual(3, transform1.NestedTransforms.Count);
            Assert.AreEqual(1, transform1.Params.Count);
            Assert.AreEqual(2, transform2.NestedTransforms.Count);
            Assert.AreEqual(3, transform2.Params.Count);
        }
        public void TestTransformationLayersDeepClone()
        {
            // layers should be cloned
            var layer          = new TextLayer("Hello").FontSize(10).FontFamily("Arial");
            var transformation = new Transformation().Overlay(layer);

            var clone = transformation.Clone();

            layer.FontSize(20);

            Assert.AreEqual(transformation.Generate(), "l_text:Arial_20:Hello");
            Assert.AreEqual(clone.Generate(), "l_text:Arial_10:Hello");
        }
        public CairoNode Clone()
        {
            var clone = new CairoNode();

            clone.Geometry = Geometry;
            if (Transformation != null)
            {
                clone.Transformation = Transformation.Clone();
            }
            foreach (var child in Children)
            {
                clone.AddChild(child.Clone());
            }
            return(clone);
        }
        public void TestExpressionsClone()
        {
            const string transformationStr = "if_pc_lt_300/c_scale/if_end";
            var          expression        = Expression.PageCount().Lt(300);
            var          transformation    = new Transformation()
                                             .IfCondition(expression)
                                             .Crop("scale")
                                             .EndIf();

            var clone = transformation.Clone();

            expression.Gt(2);

            Assert.AreEqual(transformationStr, clone.ToString());
        }
        public void TestDictionaryParamsDeepClone()
        {
            // dictionary params should be cloned
            var codecParams = new Dictionary <string, string>
            {
                { "codec", "h264" }, { "profile", "basic" }, { "level", "3.1" }
            };
            Transformation transform = new Transformation().VideoCodec(codecParams);

            Transformation clone = transform.Clone();

            codecParams["codec"] = "h265";

            Assert.AreEqual(transform.Generate(), "vc_h265:basic:3.1");
            Assert.AreEqual(clone.Generate(), "vc_h264:basic:3.1");
        }
        public void TestCloneWithNested()
        {
            // transformation should be cloneable, including nested transformations
            Transformation transformation = new Transformation().X(100).Y(100).Width(200)
                                            .Crop("fill").Chain().Radius(10).Chain().Crop("crop").Width(100).Angle("12", "13", "14");

            Transformation clone = transformation.Clone();

            transformation.NestedTransforms[0].Width(300);
            transformation = transformation.Angle("22", "23").Chain().Crop("fill");

            Assert.AreEqual(transformation.Generate(),
                            "c_fill,w_300,x_100,y_100/r_10/a_22.23,c_crop,w_100/c_fill");
            Assert.AreEqual(clone.Generate(),
                            "c_fill,w_200,x_100,y_100/r_10/a_12.13.14,c_crop,w_100");
        }
Beispiel #16
0
        public PointF ToWorldCoords(PointF viewCoords)
        {
            Matrix invMatrix = Transformation.Clone();

            invMatrix.Invert();

            PointF[] clipPoints = new PointF[1] {
                viewCoords
            };

            invMatrix.TransformPoints(clipPoints);

            var x = clipPoints[0].X;
            var y = -clipPoints[0].Y;

            return(new PointF(x, y));
        }
Beispiel #17
0
        public void TestTransformationClone()
        {
            // transformation should be cloneable
            Transformation transform1 = new Transformation().X(100).Y(100).Width(200).Crop("fill").Chain().Radius(10).Chain().Crop("crop").Width(100).Angle("12", "13", "14");
            Transformation transform2 = transform1.Clone();
            transform1 = transform1.Angle("22", "23").Chain().Crop("fill");

            Assert.AreEqual(3, transform1.NestedTransforms.Count);
            Assert.AreEqual(1, transform1.Params.Count);
            Assert.AreEqual(2, transform2.NestedTransforms.Count);
            Assert.AreEqual(3, transform2.Params.Count);
        }
Beispiel #18
0
        internal override void Arm(bool isHit)
        {
            base.Arm(isHit);

            int armTime = GameBase.Mode != OsuModes.Edit ? AudioEngine.Time : StartTime;

            if (isHit)
            {
                //Fade out the actual hit circle
                Transformation circleScaleOut = new Transformation(TransformationType.Scale, 1.0F, 1.4F, armTime, (int)(armTime + (HitObjectManager.FadeOut)), EasingTypes.Out)
                {
                    TagNumeric = ARMED
                };

                SpriteHitCircle1.Transformations.Add(circleScaleOut);
                SpriteHitCircle1.Transformations.Add(new Transformation(TransformationType.Fade, 1, 0, armTime, armTime + HitObjectManager.FadeOut)
                {
                    TagNumeric = ARMED
                });

                SpriteHitCircle2.Transformations.Add(circleScaleOut.Clone());
                SpriteHitCircle2.Transformations.Add(new Transformation(TransformationType.Fade, 1, 0, armTime, armTime + HitObjectManager.FadeOut)
                {
                    TagNumeric = ARMED
                });

                SpriteApproachCircle.Transformations.Add(new Transformation(TransformationType.Fade, SpriteApproachCircle.Alpha, 0, armTime, armTime)
                {
                    TagNumeric = ARMED
                });

                if (SkinManager.UseNewLayout)
                {
                    SpriteHitCircleText.Transformations.Add(new Transformation(TransformationType.Fade, 1, 0, armTime, armTime + 60)
                    {
                        TagNumeric = ARMED
                    });
                }
                else
                {
                    SpriteHitCircleText.Transformations.Add(new Transformation(TransformationType.Scale, 1.0F * TEXT_SIZE, 1.4F * TEXT_SIZE, armTime, (int)(armTime + (HitObjectManager.FadeOut)), EasingTypes.Out)
                    {
                        TagNumeric = ARMED
                    });
                    SpriteHitCircleText.Transformations.Add(new Transformation(TransformationType.Fade, SpriteHitCircleText.Alpha, 0, armTime, armTime + HitObjectManager.FadeOut)
                    {
                        TagNumeric = ARMED
                    });
                }
            }
            else
            {
                bool hidden = ModManager.CheckActive(hitObjectManager.ActiveMods, Mods.Hidden);

                SpriteHitCircle1.Transformations.Add(new Transformation(TransformationType.Fade, !hidden ? SpriteHitCircle1.Alpha : 0, 0, armTime, armTime + 60)
                {
                    TagNumeric = ARMED
                });
                SpriteHitCircle2.Transformations.Add(new Transformation(TransformationType.Fade, !hidden ? SpriteHitCircle2.Alpha : 0, 0, armTime, armTime + 60)
                {
                    TagNumeric = ARMED
                });
                SpriteHitCircleText.Transformations.Add(new Transformation(TransformationType.Fade, !hidden ? SpriteHitCircleText.Alpha : 0, 0, armTime, armTime + 60)
                {
                    TagNumeric = ARMED
                });
                SpriteApproachCircle.Transformations.Add(new Transformation(TransformationType.Fade, !hidden ? SpriteApproachCircle.Alpha : 0, 0, armTime, armTime + 60)
                {
                    TagNumeric = ARMED
                });

                SpriteHitCircle1.Scale    = DefaultScale;
                SpriteHitCircle2.Scale    = DefaultScale;
                SpriteHitCircleText.Scale = TEXT_SIZE;
            }
        }
Beispiel #19
0
        internal HitCircleOsu(HitObjectManager hom, Vector2 pos, int startTime, bool newCombo, bool addWhistle, bool addFinish, bool addClap, int comboOffset)
            : base(hom)
        {
            Position     = pos;
            BasePosition = pos;
            StartTime    = startTime;
            EndTime      = startTime;

            Type               = HitObjectType.Normal;
            SoundType          = HitObjectSoundType.None;
            SampleSet          = Audio.SampleSet.None;
            SampleSetAdditions = Audio.SampleSet.None;

            int p = LocalPreEmpt;

            if (newCombo)
            {
                Type       |= HitObjectType.NewCombo;
                ComboOffset = comboOffset;
            }
            if (addWhistle)
            {
                SoundType |= HitObjectSoundType.Whistle;
            }
            if (addFinish)
            {
                SoundType |= HitObjectSoundType.Finish;
            }
            if (addClap)
            {
                SoundType |= HitObjectSoundType.Clap;
            }


            if (hom.spriteManager == null)
            {
                return;
            }

            bool hidden            = ModManager.CheckActive(hitObjectManager.ActiveMods, Mods.Hidden);
            bool hasApproachCircle = ShowApproachCircle && (!hidden || (hom.hitObjects.Count == 0 && ConfigManager.sHiddenShowFirstApproach));

            Color white = Color.White;

            pTexture t_approachCircle = TextureManager.Load(@"approachcircle");
            pTexture t_hit1           = TextureManager.LoadFirstAvailable(new[] { SpriteNameHitCircle, default_sprite_hitcircle });

            pTexture[] t_hit2 = TextureManager.LoadAll((t_hit1 != null ? t_hit1.AssetName : default_sprite_hitcircle) + @"overlay");

            SpriteApproachCircle = new pSprite(t_approachCircle, Fields.Gamefield, Origins.Centre, Clocks.Audio, Position, SpriteManager.drawOrderFwdPrio(StartTime - p), false, white);
            if (hasApproachCircle)
            {
                SpriteCollection.Add(SpriteApproachCircle);
            }
            SpriteApproachCircle.Transformations.Add(new Transformation(TransformationType.Fade, 0, 0.9F, startTime - p, Math.Min(startTime, startTime - p + HitObjectManager.FadeIn * 2)));
            SpriteApproachCircle.Transformations.Add(new Transformation(TransformationType.Scale, 4, 1, startTime - p, startTime));

            SpriteHitCircle1 = new pSprite(t_hit1, Fields.Gamefield, Origins.Centre, Clocks.Audio, Position, SpriteManager.drawOrderBwd(StartTime), false, white)
            {
                TagNumeric = 1
            };
            SpriteCollection.Add(SpriteHitCircle1);
            DimCollection.Add(SpriteHitCircle1);


            SpriteHitCircle2 = new pAnimation(t_hit2, Fields.Gamefield, Origins.Centre, Clocks.Audio, Position,
                                              SpriteManager.drawOrderBwd(StartTime - (hitObjectManager.ShowOverlayAboveNumber ? 2 : 1)), false, Color.White);
            SpriteHitCircle2.FrameDelay = 1000 / 2F;
            SpriteCollection.Add(SpriteHitCircle2);
            DimCollection.Add(SpriteHitCircle2);

            SpriteHitCircleText = new pSpriteText(null, SkinManager.Current.FontHitCircle, SkinManager.Current.FontHitCircleOverlap, Fields.Gamefield, Origins.Centre,
                                                  Clocks.Audio, Position, SpriteManager.drawOrderBwd(StartTime - (hitObjectManager.ShowOverlayAboveNumber ? 1 : 2)), false, Color.White);
            SpriteHitCircleText.Scale = TEXT_SIZE;

            if (ShowCircleText)
            {
                SpriteCollection.Add(SpriteHitCircleText);
            }

            Transformation t;

            //fade in
            if (hidden)
            {
                t = new Transformation(TransformationType.Fade, 0, 1, startTime - p, startTime - (int)(p * 0.6));
            }
            else
            {
                t = new Transformation(TransformationType.Fade, 0, 1, startTime - p, startTime - p + HitObjectManager.FadeIn);
            }

            SpriteHitCircle1.Transformations.Add(t.Clone());
            SpriteHitCircle2.Transformations.Add(t.Clone());
            SpriteHitCircleText.Transformations.Add(t.Clone());

            //fade out
            if (GameBase.Mode == OsuModes.Edit)
            {
                SpriteSelectionCircle =
                    new pSprite(TextureManager.Load(@"hitcircleselect"), Fields.Gamefield,
                                Origins.Centre, Clocks.Game, Position,
                                SpriteManager.drawOrderBwd(StartTime - 3), true, Color.TransparentWhite);
                SpriteCollection.Add(SpriteSelectionCircle);

                if (ConfigManager.sEditorHitAnimations)
                {
                    Arm(true);
                }
                else
                {
                    t = new Transformation(TransformationType.Fade, 1, 0, startTime, startTime + hitObjectManager.ForceFadeOut);
                    SpriteHitCircle1.Transformations.Add(t.Clone());
                    SpriteHitCircle2.Transformations.Add(t.Clone());
                    SpriteHitCircleText.Transformations.Add(t.Clone());
                    SpriteApproachCircle.Transformations.Add(t.Clone());
                }

                SpriteApproachCircle.Transformations.Add(new Transformation(TransformationType.Scale, 1, 1.1F, startTime, startTime + 100));
            }
            else
            {
                Disarm();
            }
        }
        private void SetTweening(bool enabled)
        {
            if (selectedEvent == null)
            {
                return;
            }

            if (!enabled)
            {
                checkTweenEaseIn.SetStatusQuietly(false);
                checkTweenEaseOut.SetStatusQuietly(false);
            }

            changeManager.BeginAction(ChangeType.Event, ActionType.Tween, selectedEvent);

            if (enabled)
            {
                int index =
                    selectedEventTransformations.FindIndex(
                        t => t.Time1 <= AudioEngine.Time && t.Time2 >= AudioEngine.Time);

                if (index >= 0)
                {
                    changeManager.FinishAction(true);
                    return;
                }

                index = selectedEventTransformations.FindLastIndex(t => t.Time2 < AudioEngine.Time);

                if (index < 0)
                {
                    changeManager.FinishAction(true);
                    return;
                }

                Transformation tr = selectedEventTransformations[index];

                Transformation tween = null;

                int idx = -1;

                if (tr.Time1 == tr.Time2)
                {
                    //remove the existing non-tween.
                    idx   = selectedEvent.Sprite.Transformations.IndexOf(tr);
                    tween = tr;
                }
                else
                {
                    tween             = tr.Clone();
                    tween.Time1       = tween.Time2;
                    tween.StartFloat  = tween.EndFloat;
                    tween.StartVector = tween.EndVector;
                    tween.StartColour = tween.EndColour;
                }

                //We have our starting point for the tween - now we should get the other end.

                index = selectedEventTransformations.FindIndex(t => t.Time1 > AudioEngine.Time);

                if (index < 0)
                {
                    changeManager.FinishAction(true);
                    return;
                }

                if (idx >= 0) //delete the first static transform if necessary (after checking the last exit condition)
                {
                    changeManager.PushAction(ActionType.RemoveTransformation);
                    changeManager.BackupData(new EventRecord.TransformationData(selectedEvent, selectedEvent.Sprite.Transformations[idx], idx));
                    selectedEvent.Sprite.Transformations.RemoveAt(idx);
                }

                tr = selectedEventTransformations[index];

                if (tr.Time1 == tr.Time2)
                {
                    //remove the existing non-tween.
                    idx = selectedEvent.Sprite.Transformations.IndexOf(tr);
                    changeManager.PushAction(ActionType.RemoveTransformation);
                    changeManager.BackupData(new EventRecord.TransformationData(selectedEvent, selectedEvent.Sprite.Transformations[idx], idx));
                    selectedEvent.Sprite.Transformations.RemoveAt(idx);
                }

                tween.EndFloat  = tr.StartFloat;
                tween.EndVector = tr.StartVector;
                tween.EndColour = tr.StartColour;
                tween.Time2     = tr.Time1;

                changeManager.PushAction(ActionType.AddTransformation);
                if (idx >= 0)
                {
                    changeManager.BackupData(new EventRecord.TransformationData(selectedEvent, tween, idx));
                    selectedEvent.Sprite.Transformations.Insert(idx, tween);
                }
                else
                {
                    changeManager.BackupData(new EventRecord.TransformationData(selectedEvent, tween, index + 1));
                    selectedEvent.Sprite.Transformations.Insert(index + 1, tween);
                }
            }
            else
            {
                int index = selectedEventTransformations.FindIndex(t => t.Time1 <= AudioEngine.Time && t.Time2 >= AudioEngine.Time);

                if (index < 0)
                {
                    changeManager.FinishAction(true);
                    return;
                }
                else
                {
                    Transformation t = selectedEventTransformations[index];

                    int idx = selectedEvent.Sprite.Transformations.IndexOf(t);
                    changeManager.PushAction(ActionType.RemoveTransformation);
                    changeManager.BackupData(new EventRecord.TransformationData(selectedEvent, selectedEvent.Sprite.Transformations[idx], idx));
                    selectedEvent.Sprite.Transformations.RemoveAt(idx);


                    if (index == selectedEventTransformations.Count - 1 ||        //doesn't collide with last transformation
                        selectedEventTransformations[index + 1].Time1 != t.Time2) //doesn't collide with next transformation
                    {
                        Transformation nt = t.Clone();
                        nt.Time1       = nt.Time2;
                        nt.StartFloat  = nt.EndFloat;
                        nt.StartVector = nt.EndVector;
                        nt.StartColour = nt.EndColour;

                        changeManager.PushAction(ActionType.AddTransformation);
                        changeManager.BackupData(new EventRecord.TransformationData(selectedEvent, nt, idx));
                        selectedEvent.Sprite.Transformations.Insert(idx, nt);
                    }

                    //Decide whether we need to split the transformation into two parts or not...
                    if (index == 0 || //is first transformation
                        selectedEventTransformations[index - 1].Time2 != t.Time1)
                    {
                        Transformation nt = t.Clone();
                        nt.Time2     = nt.Time1;
                        nt.EndFloat  = nt.StartFloat;
                        nt.EndVector = nt.StartVector;
                        nt.EndColour = nt.StartColour;


                        changeManager.PushAction(ActionType.AddTransformation);
                        changeManager.BackupData(new EventRecord.TransformationData(selectedEvent, nt, idx));
                        selectedEvent.Sprite.Transformations.Insert(idx, nt);
                    }
                }
            }
            changeManager.FinishAction();
        }