예제 #1
0
        private List <Core.Curve.ICurve> InsertCurvePoint(double u)
        {
            var curvesToUpdate = new List <Core.Curve.ICurve>();

            _updatingCurveEnabled = false;
            foreach (var curve in _curvesWithPointControls.Keys)
            {
                if (!curve.HasVAt(u))
                {
                    var    newKey = new Core.Curve.VDefinition();
                    double?prevU  = curve.GetPreviousU(u);
                    if (prevU != null)
                    {
                        newKey = curve.GetV(prevU.Value).Clone();
                    }

                    newKey.Value = curve.GetSampledValue(u);
                    var command = new AddOrUpdateKeyframeCommand(u, newKey, curve);
                    App.Current.UndoRedoStack.AddAndExecute(command);

                    curvesToUpdate.Add(curve);
                }
            }
            _updatingCurveEnabled = true;
            return(curvesToUpdate);
        }
예제 #2
0
        private void FloatEditButton_EditingStartedHandler()
        {
            if (IsAnimated)
            {
                _addKeyframeCommand = new AddOrUpdateKeyframeCommand(App.Current.Model.GlobalTime, Value, ValueHolder);
            }
            else
            {
                // Disable rebuilding of animation curves...
                App.Current.MainWindow.CompositionView.XTimeView.XAnimationCurveEditor.DisableCurveUpdatesOnModifiedEvent = true;

                _updateValueCommand = new UpdateOperatorPartValueFunctionCommand(ValueHolder, new Float(Value));
            }
        }
        private ICommand BuildManipulationCommand(FloatParameterControl control, float newValue)
        {
            ICommand cmd;

            if (control.IsAnimated)
            {
                cmd = new AddOrUpdateKeyframeCommand(App.Current.Model.GlobalTime, newValue, control.ValueHolder);
            }
            else
            {
                cmd = new UpdateOperatorPartValueFunctionCommand(control.ValueHolder, new Float(newValue));
            }
            _commandsForControls[control] = cmd;
            return(cmd);
        }
예제 #4
0
 private void OnDragCompleted(object sender, DragCompletedEventArgs e)
 {
     XCenterThumb.Cursor = Cursors.Arrow;
     if (m_MoveDirection == MoveDirection.Vertical)
     {
         App.Current.UndoRedoStack.Add(_addOrUpdateKeyframeCommand);
     }
     else if (m_MoveDirection == MoveDirection.Horizontal)
     {
         App.Current.UndoRedoStack.Add(_moveKeyframeCommand);
     }
     _addOrUpdateKeyframeCommand = null;
     _moveKeyframeCommand        = null;
     m_CE.RebuildCurrentCurves();
 }
예제 #5
0
        private ICommand BuildManipulationCommand(OperatorPart input, float newValue)
        {
            ICommand cmd;

            OperatorPart animationOpPart = Animation.GetRegardingAnimationOpPart(input);

            if (animationOpPart != null && animationOpPart.Func is ICurve)
            {
                cmd = new AddOrUpdateKeyframeCommand(App.Current.Model.GlobalTime, newValue, input);
            }
            else
            {
                cmd = new UpdateOperatorPartValueFunctionCommand(input, new Float(newValue));
            }
            _commandsForInputs[input] = cmd;
            return(cmd);
        }
예제 #6
0
        private void OnDragStart(object sender, DragStartedEventArgs e)
        {
            XCenterThumb.Cursor = Cursors.Cross;
            m_MoveDirection     = MoveDirection.Undecided;
            if (Keyboard.Modifiers != ModifierKeys.Shift)
            {
                var alreadySelected = CurveEditor._SelectionHandler.SelectedElements.Count == 1 &&
                                      Equals(CurveEditor._SelectionHandler.SelectedElements.First(), this);

                if (!alreadySelected)
                {
                    CurveEditor._SelectionHandler.Clear();
                }
            }
            CurveEditor._SelectionHandler.AddElement(this);
            _addOrUpdateKeyframeCommand = new AddOrUpdateKeyframeCommand(U, m_vdef, Curve);
            _moveKeyframeCommand        = new MoveKeyframeCommand(U, U, Curve);
        }
예제 #7
0
        private ICommand BuildManipulationCommand(OperatorPart input, float newValue = Single.NaN)
        {
            ICommand cmd;

            var isAnimated = Animation.GetRegardingAnimationOpPart(input) != null;

            if (isAnimated)
            {
                cmd = new AddOrUpdateKeyframeCommand(App.Current.Model.GlobalTime, newValue, input);
            }

            else
            {
                cmd = new UpdateOperatorPartValueFunctionCommand(input, new Float(newValue));
            }

            _commandsForInputs[input] = cmd;
            return(cmd);
        }
예제 #8
0
        private void FloatEditButton_EditingEndedHandler()
        {
            if (IsAnimated)
            {
                App.Current.UndoRedoStack.AddAndExecute(_addKeyframeCommand);
                _addKeyframeCommand = null;
            }
            else
            {
                // Re-enable rebuilding of animation curves...
                App.Current.MainWindow.CompositionView.XTimeView.XAnimationCurveEditor.DisableCurveUpdatesOnModifiedEvent = false;

                if (_updateValueCommand != null && ((_updateValueCommand.Value as Float).Val) != ((_updateValueCommand.PreviousValue as Float).Val))
                {
                    App.Current.UndoRedoStack.Add(_updateValueCommand);
                }

                _updateValueCommand = null;
            }
        }
예제 #9
0
 private void FloatEditButton_CancelledHandler()
 {
     _addKeyframeCommand = null;
     _updateValueCommand = null;
 }
예제 #10
0
 private void OnDragTangentDeltaCompleted(object sender, DragCompletedEventArgs e)
 {
     App.Current.UndoRedoStack.Add(_addOrUpdateKeyframeCommand);
     _addOrUpdateKeyframeCommand = null;
 }
예제 #11
0
 private void OnDragTangentDeltaStarted(object sender, DragStartedEventArgs e)
 {
     _addOrUpdateKeyframeCommand = new AddOrUpdateKeyframeCommand(U, m_vdef, Curve);
 }