コード例 #1
0
        public void AddKeyFrame(double time, object propertyValue)
        {
            KeyFrameSceneNode keyFrameSceneNode;

            if (!this.IsDiscreteOnly)
            {
                KeyFrameInterpolationType keyFrameInterpolationType = !this.ViewModel.ProjectContext.Platform.Metadata.IsSupported((ITypeResolver)this.ViewModel.ProjectContext, PlatformTypes.IEasingFunction) ? KeyFrameInterpolationType.Spline : KeyFrameInterpolationType.Easing;
                keyFrameSceneNode = (KeyFrameSceneNode)KeyFrameSceneNode.Factory.Instantiate(this.ViewModel, this.GetKeyFrameType(keyFrameInterpolationType));
            }
            else
            {
                keyFrameSceneNode = (KeyFrameSceneNode)KeyFrameSceneNode.Factory.Instantiate(this.ViewModel, this.GetKeyFrameType(KeyFrameInterpolationType.Discrete));
            }
            keyFrameSceneNode.Value = propertyValue;
            keyFrameSceneNode.Time  = time;
            this.AddKeyFrame(keyFrameSceneNode);
        }
コード例 #2
0
        public void ConvertSelection(KeyFrameInterpolationType keyframeInterpolationType)
        {
            SceneNode sceneNode = this.selectedObjects[0];

            if (sceneNode.ViewModel == null)
            {
                return;
            }
            SceneViewModel viewModel = sceneNode.ViewModel;

            using (SceneEditTransaction editTransaction = viewModel.CreateEditTransaction(StringTable.ConvertKeyFramesUndoUnit, false))
            {
                bool flag = false;
                foreach (object obj in this.selectedObjects)
                {
                    KeyFrameSceneNode keyFrame = obj as KeyFrameSceneNode;
                    if (keyFrame == null || keyFrame.KeyFrameAnimation == null)
                    {
                        flag = false;
                        break;
                    }
                    if (keyFrame.InterpolationType != keyframeInterpolationType)
                    {
                        KeyFrameSceneNode selectionToExtend = keyFrame.KeyFrameAnimation.ReplaceKeyFrame(keyFrame, keyframeInterpolationType, (KeySpline)null);
                        if (selectionToExtend == null)
                        {
                            flag = false;
                            break;
                        }
                        viewModel.KeyFrameSelectionSet.ExtendSelection(selectionToExtend);
                        flag = true;
                    }
                }
                if (flag)
                {
                    editTransaction.Commit();
                    viewModel.RefreshSelection();
                }
                else
                {
                    editTransaction.Cancel();
                }
            }
        }
コード例 #3
0
        internal KeyFrameSceneNode ReplaceKeyFrame(KeyFrameSceneNode keyFrame, KeyFrameInterpolationType interpolationType, KeySpline keySpline)
        {
            ITypeId keyFrameType = this.GetKeyFrameType(interpolationType);

            if (keyFrameType == null)
            {
                return((KeyFrameSceneNode)null);
            }
            KeyFrameSceneNode keyFrameSceneNode = (KeyFrameSceneNode)KeyFrameSceneNode.Factory.Instantiate(this.ViewModel, keyFrameType);

            keyFrameSceneNode.Time = keyFrame.Time;
            using (keyFrame.ViewModel.ForceBaseValue())
                keyFrameSceneNode.ValueNode = keyFrame.ValueNode.Clone(keyFrame.ValueNode.Context);
            if (interpolationType == KeyFrameInterpolationType.Spline)
            {
                keyFrameSceneNode.KeySpline = keySpline;
            }
            IList <KeyFrameSceneNode> keyFrameCollection = this.KeyFrameCollection;

            keyFrameCollection[keyFrameCollection.IndexOf(keyFrame)] = keyFrameSceneNode;
            return(keyFrameSceneNode);
        }
コード例 #4
0
        private ITypeId GetKeyFrameType(KeyFrameInterpolationType keyFrameInterpolationType)
        {
            ITypeId typeId;

            switch (keyFrameInterpolationType)
            {
            case KeyFrameInterpolationType.Discrete:
                AnimationSceneNode.PlatformNeutralTypeDictionaryTryGetValue(KeyFrameAnimationSceneNode.discreteKeyFrameTypes, this.AnimatedType, out typeId);
                break;

            case KeyFrameInterpolationType.Spline:
                AnimationSceneNode.PlatformNeutralTypeDictionaryTryGetValue(KeyFrameAnimationSceneNode.splineKeyFrameTypes, this.AnimatedType, out typeId);
                break;

            case KeyFrameInterpolationType.Easing:
                AnimationSceneNode.PlatformNeutralTypeDictionaryTryGetValue(KeyFrameAnimationSceneNode.easingKeyFrameTypes, this.AnimatedType, out typeId);
                break;

            default:
                typeId = (ITypeId)null;
                break;
            }
            return(typeId);
        }
コード例 #5
0
 public ConvertEasingTypeCommand(EasingCategoryCollection easingCategorySelection, KeyFrameInterpolationType interpolationType)
 {
     this.easingCategorySelection = easingCategorySelection;
     this.interpolationType       = interpolationType;
 }