示例#1
0
        /** Returns false if preview was prevevent (e.g. because we're blending another preset with virutal slider) */
        public bool PreviewPreset(OperatorPreset preset)
        {
            App.Current.MainWindow.CompositionView.XTimeView.XAnimationCurveEditor.DisableCurveUpdatesOnModifiedEvent = true;

            if (_isBlending)
            {
                return(false);
            }

            var entries = new List <SetValueGroupCommand.Entry>();

            Operator op = App.Current.MainWindow.XParameterView.ShownOperator;

            if (op != null && op.Definition.ID == preset.MetaOperatorID)
            {
                _tempOperatorPresetBeforePreview = CreatePresetFromOperator(op);

                foreach (var input in op.Inputs)
                {
                    var metaInput = input.Parent.GetMetaInput(input);
                    if (preset.ValuesByParameterID.ContainsKey(metaInput.ID))
                    {
                        entries.Add(new SetValueGroupCommand.Entry {
                            OpPart = input, Value = new Float(preset.ValuesByParameterID[metaInput.ID])
                        });
                    }
                }
                App.Current.UpdateRequiredAfterUserInteraction = true;
            }
            _setValueGroupCommand = new SetValueGroupCommand(entries, App.Current.Model.GlobalTime);
            _setValueGroupCommand.Do();
            HighlightActivePreset();
            return(true);
        }
示例#2
0
        public void RestorePreviewPreset()
        {
            App.Current.MainWindow.CompositionView.XTimeView.XAnimationCurveEditor.DisableCurveUpdatesOnModifiedEvent = false;

            if (_blending)
            {
                return;
            }

            if (_setValueGroupCommand != null)
            {
                _setValueGroupCommand.Undo();
                _setValueGroupCommand = null;
                App.Current.UpdateRequiredAfterUserInteraction = true;
            }
        }