void addToTimeline_Click(object sender, EventArgs e)
        {
            IAnimatable target = layerTree.SelectedNode.Tag as IAnimatable;
            AnimationTarget.AnimationTargetTypes type = AnimationTarget.AnimationTargetTypes.Layer;
            if (target == null)
            {
                if (layerTree.SelectedNode.Tag is LayerMap)
                {
                    target = ((LayerMap)layerTree.SelectedNode.Tag).Frame;
                    type = AnimationTarget.AnimationTargetTypes.ReferenceFrame;
                }
            }

            if (Earth3d.MainWindow.TourEdit != null && target != null)
            {
                if (Earth3d.MainWindow.TourEdit.Tour.EditMode && Earth3d.MainWindow.TourEdit.Tour.CurrentTourStop != null)
                {
                    Undo.Push(new UndoTourStopChange(Language.GetLocalizedText(1290, "Add to Timeline"), Earth3d.MainWindow.TourEdit.Tour));

                    Earth3d.MainWindow.TourEdit.Tour.CurrentTourStop.KeyFramed = true;

                    AnimationTarget aniTarget = new AnimationTarget(Earth3d.MainWindow.TourEdit.Tour.CurrentTourStop);
                    aniTarget.Target = target;
                    aniTarget.TargetType = type;
                    aniTarget.ParameterNames.AddRange(target.GetParamNames());
                    aniTarget.CurrentParameters = target.GetParams();
                    aniTarget.SetKeyFrame(0, Key.KeyType.Linear);
                    //todo add end frames?

                    Earth3d.MainWindow.TourEdit.Tour.CurrentTourStop.AnimationTargets.Add(aniTarget);
                    TimeLine.RefreshUi(false);
                }
            }
        }
Ejemplo n.º 2
0
        void setupMenuK_MenuItemSelected(LayerUIMenuItem item)
        {
            var sso = item.Tag as StockSkyOverlay;

            if (Earth3d.MainWindow.TourEdit != null && sso != null)
            {
                if (Earth3d.MainWindow.TourEdit.Tour.EditMode && Earth3d.MainWindow.TourEdit.Tour.CurrentTourStop != null)
                {

                    var target = Earth3d.MainWindow.TourEdit.Tour.CurrentTourStop.GetSettingAnimator(sso.StockType.ToString());
                    var type = AnimationTarget.AnimationTargetTypes.StockSkyOverlay;

                    Undo.Push(new UndoTourStopChange(Language.GetLocalizedText(1290, "Add to Timeline"), Earth3d.MainWindow.TourEdit.Tour));

                    Earth3d.MainWindow.TourEdit.Tour.CurrentTourStop.KeyFramed = true;

                    var aniTarget = new AnimationTarget(Earth3d.MainWindow.TourEdit.Tour.CurrentTourStop);
                    aniTarget.Target = target;
                    aniTarget.TargetType = type;
                    aniTarget.ParameterNames.AddRange(target.GetParamNames());
                    aniTarget.CurrentParameters = target.GetParams();
                    aniTarget.SetKeyFrame(0, Key.KeyType.Linear);
                    //todo add end frames?

                    Earth3d.MainWindow.TourEdit.Tour.CurrentTourStop.AnimationTargets.Add(aniTarget);
                    TimeLine.RefreshUi();
                }
            }
        }