private bool CanOptimizeAnimation(KeyFrameAnimationSceneNode nodeToTest)
        {
            TimelineSceneNode.PropertyNodePair elementAndProperty = nodeToTest.TargetElementAndProperty;
            if (elementAndProperty.PropertyReference == null || FromToAnimationSceneNode.GetFromToAnimationForType((ITypeId)elementAndProperty.PropertyReference.ValueTypeId, nodeToTest.ProjectContext) == null || (nodeToTest.KeyFrameCount != 1 || DesignTimeProperties.ExplicitAnimationProperty.Equals((object)elementAndProperty.PropertyReference[0])))
            {
                return(false);
            }
            KeyFrameSceneNode keyFrameAtIndex = nodeToTest.GetKeyFrameAtIndex(0);
            Duration?         nullable        = nodeToTest.GetLocalOrDefaultValueAsWpf(TimelineSceneNode.DurationProperty) as Duration?;
            bool flag = !nullable.HasValue || nullable.Value == Duration.Automatic || nullable.Value.HasTimeSpan && nullable.Value.TimeSpan.TotalSeconds == keyFrameAtIndex.Time;

            if (keyFrameAtIndex.InterpolationType != KeyFrameInterpolationType.Easing || !flag)
            {
                return(false);
            }
            foreach (IMemberId memberId in (IEnumerable <IProperty>)((DocumentCompositeNode)nodeToTest.DocumentNode).Properties.Keys)
            {
                switch (memberId.Name)
                {
                case "Duration":
                case "TargetName":
                case "TargetProperty":
                case "BeginTime":
                case "IsAnimationProxy":
                case "KeyFrames":
                case "ShouldSerialize":
                    continue;

                default:
                    return(false);
                }
            }
            return(true);
        }
        public static bool IsOptimizedAnimation(TimelineSceneNode timeline)
        {
            FromToAnimationSceneNode animationSceneNode = timeline as FromToAnimationSceneNode;

            if (animationSceneNode != null)
            {
                return(animationSceneNode.IsOptimized);
            }
            return(false);
        }
        public void Update(SceneUpdateTypeFlags updateType, DocumentNodeChangeList damage, uint changeStamp)
        {
            if (this.activeStoryboard == null || damage.Count == 0 || ((int)this.lastUpdateChangeStamp == (int)changeStamp || !this.activeStoryboard.IsInDocument))
            {
                return;
            }
            this.lastUpdateChangeStamp = changeStamp;
            bool flag = false;

            foreach (DocumentNodeChange documentNodeChange in damage.DistinctChanges)
            {
                if (this.activeStoryboard.DocumentNode.Marker.Equals((object)documentNodeChange.ParentNode.Marker) || this.activeStoryboard.DocumentNode.Marker.Contains(documentNodeChange.ParentNode.Marker))
                {
                    if (documentNodeChange.IsPropertyChange && documentNodeChange.ParentNode.IsInDocument)
                    {
                        DocumentCompositeNode documentCompositeNode = documentNodeChange.ParentNode;
                        while (documentCompositeNode != null && !PlatformTypes.Timeline.IsAssignableFrom((ITypeId)documentCompositeNode.Type))
                        {
                            documentCompositeNode = documentCompositeNode.Parent;
                        }
                        FromToAnimationSceneNode animationSceneNode = this.viewModel.GetSceneNode((DocumentNode)documentCompositeNode) as FromToAnimationSceneNode;
                        AnimationProxyManager.AnimationProxyData animationProxyData;
                        if (animationSceneNode != null && animationSceneNode.IsOptimized && this.targetPathToProxyData.TryGetValue(new AnimationProxyManager.TargetNamePropertyPair((TimelineSceneNode)animationSceneNode), out animationProxyData))
                        {
                            animationProxyData.OptimizedAnimationPropertyChanged = true;
                        }
                    }
                    else if (documentNodeChange.Action == DocumentNodeChangeAction.Add && PlatformTypes.Timeline.IsAssignableFrom((ITypeId)documentNodeChange.NewChildNode.Type))
                    {
                        TimelineSceneNode timeline = this.viewModel.GetSceneNode(documentNodeChange.NewChildNode) as TimelineSceneNode;
                        AnimationProxyManager.AnimationProxyData animationProxyData;
                        if (timeline != null && AnimationProxyManager.IsOptimizedAnimation(timeline) && this.targetPathToProxyData.TryGetValue(new AnimationProxyManager.TargetNamePropertyPair(timeline), out animationProxyData))
                        {
                            animationProxyData.OptimizedAnimationAdded = true;
                        }
                    }
                    flag = true;
                }
            }
            if (!flag)
            {
                return;
            }
            if ((updateType & SceneUpdateTypeFlags.UndoRedo) == SceneUpdateTypeFlags.None && (updateType & SceneUpdateTypeFlags.Canceled) == SceneUpdateTypeFlags.None)
            {
                this.UpdateProxyTable(AnimationProxyManager.AllowedChange.Any);
            }
            else
            {
                this.UpdateProxyTable(AnimationProxyManager.AllowedChange.None);
            }
        }
        private FromToAnimationSceneNode ConvertToOptimizedAnimation(KeyFrameAnimationSceneNode proxyAnimation)
        {
            StoryboardTimelineSceneNode controllingStoryboard = proxyAnimation.ControllingStoryboard;
            FromToAnimationSceneNode    animationSceneNode    = FromToAnimationSceneNode.Factory.InstantiateWithTarget(this.viewModel, proxyAnimation.TargetElement, proxyAnimation.TargetProperty, proxyAnimation.StoryboardContainer, FromToAnimationSceneNode.GetFromToAnimationForType(proxyAnimation.AnimatedType, proxyAnimation.ProjectContext));
            KeyFrameSceneNode           keyFrameAtIndex       = proxyAnimation.GetKeyFrameAtIndex(0);

            animationSceneNode.Duration = keyFrameAtIndex.Time;
            SceneNode.CopyPropertyValue((SceneNode)keyFrameAtIndex, keyFrameAtIndex.ValueProperty, (SceneNode)animationSceneNode, animationSceneNode.ToProperty);
            SceneNode.CopyPropertyValue((SceneNode)keyFrameAtIndex, keyFrameAtIndex.EasingFunctionProperty, (SceneNode)animationSceneNode, animationSceneNode.EasingFunctionProperty);
            animationSceneNode.IsOptimized  = true;
            proxyAnimation.IsAnimationProxy = true;
            proxyAnimation.ShouldSerialize  = false;
            keyFrameAtIndex.ShouldSerialize = false;
            int index = proxyAnimation.ControllingStoryboard.Children.IndexOf((TimelineSceneNode)proxyAnimation);

            proxyAnimation.ControllingStoryboard.Children.Insert(index, (TimelineSceneNode)animationSceneNode);
            return(animationSceneNode);
        }
        private static bool CanFromToAnimationBeOptimized(FromToAnimationSceneNode fromToAnimation)
        {
            foreach (IMemberId memberId in (IEnumerable <IProperty>)((DocumentCompositeNode)fromToAnimation.DocumentNode).Properties.Keys)
            {
                switch (memberId.Name)
                {
                case "To":
                case "Duration":
                case "TargetName":
                case "TargetProperty":
                case "BeginTime":
                case "EasingFunction":
                case "IsOptimized":
                case "ShouldSerialize":
                    continue;

                default:
                    return(false);
                }
            }
            return(true);
        }
        protected override List <TimelineSceneNode> GetAnimationsToCopy()
        {
            List <TimelineSceneNode> list = new List <TimelineSceneNode>();

            if (this.ViewModel.ElementSelectionSet.Count == 0 && this.ViewModel.KeyFrameSelectionSet.Count > 0)
            {
                Dictionary <TimelineSceneNode.PropertyNodePair, KeyFrameAnimationSceneNode> dictionary = new Dictionary <TimelineSceneNode.PropertyNodePair, KeyFrameAnimationSceneNode>();
                foreach (KeyFrameSceneNode keyFrameSceneNode1 in this.ViewModel.KeyFrameSelectionSet.Selection)
                {
                    if (!AnimationProxyManager.IsAnimationProxy((TimelineSceneNode)keyFrameSceneNode1.KeyFrameAnimation))
                    {
                        KeyFrameSceneNode keyFrameSceneNode2 = this.ViewModel.GetSceneNode(keyFrameSceneNode1.DocumentNode.Clone(keyFrameSceneNode1.DocumentNode.DocumentRoot.DocumentContext)) as KeyFrameSceneNode;
                        if (keyFrameSceneNode2 != null)
                        {
                            TimelineSceneNode.PropertyNodePair key1 = new TimelineSceneNode.PropertyNodePair(keyFrameSceneNode1.TargetElement, keyFrameSceneNode1.TargetProperty);
                            KeyFrameAnimationSceneNode         animationSceneNode;
                            if (!dictionary.ContainsKey(key1))
                            {
                                animationSceneNode = (KeyFrameAnimationSceneNode)KeyFrameAnimationSceneNode.Factory.Instantiate(this.ViewModel, (ITypeId)keyFrameSceneNode1.KeyFrameAnimation.Type);
                                DocumentCompositeNode documentCompositeNode = (DocumentCompositeNode)animationSceneNode.DocumentNode;
                                foreach (KeyValuePair <IProperty, DocumentNode> keyValuePair in (IEnumerable <KeyValuePair <IProperty, DocumentNode> >)((DocumentCompositeNode)keyFrameSceneNode1.KeyFrameAnimation.DocumentNode).Properties)
                                {
                                    IProperty key2 = keyValuePair.Key;
                                    if (!keyFrameSceneNode1.KeyFrameAnimation.KeyFramesProperty.Equals((object)key2) && !DesignTimeProperties.ShouldSerializeProperty.Equals((object)key2) && !DesignTimeProperties.IsAnimationProxyProperty.Equals((object)key2))
                                    {
                                        documentCompositeNode.Properties[(IPropertyId)key2] = keyValuePair.Value.Clone(documentCompositeNode.Context);
                                    }
                                }
                                dictionary.Add(key1, animationSceneNode);
                                list.Add((TimelineSceneNode)animationSceneNode);
                            }
                            else
                            {
                                animationSceneNode = dictionary[key1];
                            }
                            animationSceneNode.AddKeyFrame(keyFrameSceneNode2);
                        }
                    }
                    else
                    {
                        FromToAnimationSceneNode animationSceneNode1 = this.ViewModel.AnimationProxyManager != null?this.ViewModel.AnimationProxyManager.GetAnimationForProxy(keyFrameSceneNode1.KeyFrameAnimation) : (FromToAnimationSceneNode)null;

                        if (animationSceneNode1 != null)
                        {
                            FromToAnimationSceneNode animationSceneNode2 = this.ViewModel.GetSceneNode(animationSceneNode1.DocumentNode.Clone(animationSceneNode1.DocumentContext)) as FromToAnimationSceneNode;
                            list.Add((TimelineSceneNode)animationSceneNode2);
                            dictionary.Add(animationSceneNode1.TargetElementAndProperty, (KeyFrameAnimationSceneNode)null);
                        }
                    }
                }
            }
            else if (this.ViewModel.ElementSelectionSet.Count > 0 && this.ViewModel.KeyFrameSelectionSet.Count == 0)
            {
                foreach (TimelineSceneNode timelineSceneNode in (IEnumerable <TimelineSceneNode>) this.SourceState.Storyboard.Children)
                {
                    if (timelineSceneNode.ShouldSerialize)
                    {
                        SceneElement sceneElement = timelineSceneNode.TargetElement as SceneElement;
                        if (sceneElement != null && this.ViewModel.ElementSelectionSet.IsSelected(sceneElement))
                        {
                            list.Add(timelineSceneNode);
                        }
                    }
                }
            }
            return(list);
        }
Esempio n. 7
0
        public override DocumentNode GetLocalValueAsDocumentNode(SceneNodeProperty property, GetLocalValueFlags flags, out bool isMixed)
        {
            DocumentNode documentNode = (DocumentNode)null;
            bool         flag         = false;

            foreach (SceneNode sceneNode1 in this.Objects)
            {
                PropertyReference propertyReference1 = SceneNodeObjectSet.FilterProperty(sceneNode1, property.Reference);
                if (propertyReference1 != null)
                {
                    DocumentNode other = (DocumentNode)null;
                    if ((flags & GetLocalValueFlags.CheckKeyframes) != GetLocalValueFlags.None && sceneNode1.ViewModel.AnimationEditor.ActiveStoryboardTimeline != null && this.ShouldAllowAnimation)
                    {
                        SceneNode         ancestor           = (SceneNode)null;
                        PropertyReference propertyReference2 = propertyReference1;
                        SceneNode         sceneNode2         = sceneNode1;
                        if (this.FindAncestor(sceneNode1, out ancestor, ref propertyReference2, new Predicate <SceneNode>(SceneNodeObjectSetBase.IsAnimationParent)))
                        {
                            sceneNode2 = ancestor;
                        }
                        foreach (TimelineSceneNode timelineSceneNode in (IEnumerable <TimelineSceneNode>)sceneNode1.ViewModel.AnimationEditor.ActiveStoryboardTimeline.Children)
                        {
                            TimelineSceneNode.PropertyNodePair elementAndProperty = timelineSceneNode.TargetElementAndProperty;
                            if (elementAndProperty.SceneNode == sceneNode2 && elementAndProperty.PropertyReference != null)
                            {
                                PropertyReference propertyReference3 = SceneNodeObjectSet.FilterProperty(elementAndProperty.SceneNode, elementAndProperty.PropertyReference);
                                if (propertyReference2.Equals((object)propertyReference3))
                                {
                                    KeyFrameAnimationSceneNode animationSceneNode1 = timelineSceneNode as KeyFrameAnimationSceneNode;
                                    FromToAnimationSceneNode   animationSceneNode2 = timelineSceneNode as FromToAnimationSceneNode;
                                    if (animationSceneNode1 != null)
                                    {
                                        KeyFrameSceneNode keyFrameAtTime = animationSceneNode1.GetKeyFrameAtTime(sceneNode1.ViewModel.AnimationEditor.AnimationTime);
                                        if (keyFrameAtTime != null)
                                        {
                                            using ((flags & GetLocalValueFlags.Resolve) == GetLocalValueFlags.None ? this.ViewModel.ForceBaseValue() : (IDisposable)null)
                                            {
                                                other = keyFrameAtTime.ValueNode;
                                                break;
                                            }
                                        }
                                        else
                                        {
                                            break;
                                        }
                                    }
                                    else if (animationSceneNode2 != null)
                                    {
                                        double animationTime = sceneNode1.ViewModel.AnimationEditor.AnimationTime;
                                        using ((flags & GetLocalValueFlags.Resolve) == GetLocalValueFlags.None ? this.ViewModel.ForceBaseValue() : (IDisposable)null)
                                        {
                                            DocumentNodePath documentNodePath = (DocumentNodePath)null;
                                            if (animationTime == animationSceneNode2.Begin + animationSceneNode2.Duration)
                                            {
                                                documentNodePath = animationSceneNode2.GetLocalValueAsDocumentNode(animationSceneNode2.ToProperty);
                                            }
                                            else if (animationTime == animationSceneNode2.Begin)
                                            {
                                                documentNodePath = animationSceneNode2.GetLocalValueAsDocumentNode(animationSceneNode2.FromProperty);
                                            }
                                            other = documentNodePath != null ? documentNodePath.Node : (DocumentNode)null;
                                            break;
                                        }
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    if (other == null)
                    {
                        if ((flags & GetLocalValueFlags.Resolve) != GetLocalValueFlags.None)
                        {
                            DocumentNodePath valueAsDocumentNode = sceneNode1.GetLocalValueAsDocumentNode(propertyReference1);
                            if (valueAsDocumentNode != null)
                            {
                                other = valueAsDocumentNode.Node;
                            }
                        }
                        else
                        {
                            other = (DocumentNode)sceneNode1.GetLocalValue(propertyReference1, PropertyContext.AsDocumentNodes);
                        }
                    }
                    if (!flag)
                    {
                        if (other == null && (flags & GetLocalValueFlags.SkipCheckIfMixed) != GetLocalValueFlags.None)
                        {
                            isMixed = false;
                            return((DocumentNode)null);
                        }
                        flag         = true;
                        documentNode = other;
                    }
                    else if (documentNode == null && other != null || documentNode != null && !documentNode.Equals(other))
                    {
                        isMixed = true;
                        return((DocumentNode)null);
                    }
                }
            }
            isMixed = false;
            return(documentNode);
        }
 public AnimationProxyData(FromToAnimationSceneNode optimizedAnimation, KeyFrameAnimationSceneNode proxyAnimation)
 {
     this.OptimizedAnimation = optimizedAnimation;
     this.ProxyAnimation     = proxyAnimation;
 }
        private void UpdateProxyTable(Dictionary <AnimationProxyManager.TargetNamePropertyPair, AnimationProxyManager.AnimationProxyData> proxyTable, StoryboardTimelineSceneNode storyboard, AnimationProxyManager.AllowedChange allowedChange)
        {
            if (allowedChange != AnimationProxyManager.AllowedChange.Any)
            {
                proxyTable.Clear();
            }
            List <KeyFrameAnimationSceneNode> list1 = new List <KeyFrameAnimationSceneNode>();

            foreach (TimelineSceneNode timeline in (IEnumerable <TimelineSceneNode>)storyboard.Children)
            {
                FromToAnimationSceneNode   animationSceneNode = timeline as FromToAnimationSceneNode;
                KeyFrameAnimationSceneNode nodeToTest         = timeline as KeyFrameAnimationSceneNode;
                if (animationSceneNode != null && animationSceneNode.IsOptimized || nodeToTest != null && nodeToTest.IsAnimationProxy)
                {
                    AnimationProxyManager.TargetNamePropertyPair key = new AnimationProxyManager.TargetNamePropertyPair(timeline);
                    if (key.TargetName != null)
                    {
                        AnimationProxyManager.AnimationProxyData animationProxyData;
                        if (!proxyTable.TryGetValue(key, out animationProxyData))
                        {
                            animationProxyData = new AnimationProxyManager.AnimationProxyData((FromToAnimationSceneNode)null, (KeyFrameAnimationSceneNode)null);
                            proxyTable[key]    = animationProxyData;
                        }
                        if (animationSceneNode != null)
                        {
                            animationProxyData.OptimizedAnimation = animationSceneNode;
                        }
                        else
                        {
                            animationProxyData.ProxyAnimation = nodeToTest;
                        }
                    }
                }
                else if (nodeToTest != null && this.CanOptimizeAnimation(nodeToTest))
                {
                    list1.Add(nodeToTest);
                }
            }
            if (allowedChange != AnimationProxyManager.AllowedChange.OnlyNonSerializing && allowedChange != AnimationProxyManager.AllowedChange.Any)
            {
                return;
            }
            if (allowedChange == AnimationProxyManager.AllowedChange.Any)
            {
                foreach (KeyFrameAnimationSceneNode proxyAnimation in list1)
                {
                    FromToAnimationSceneNode optimizedAnimation      = this.ConvertToOptimizedAnimation(proxyAnimation);
                    AnimationProxyManager.TargetNamePropertyPair key = new AnimationProxyManager.TargetNamePropertyPair((TimelineSceneNode)proxyAnimation);
                    AnimationProxyManager.AnimationProxyData     animationProxyData;
                    if (proxyTable.TryGetValue(key, out animationProxyData))
                    {
                        if (animationProxyData.OptimizedAnimation != null && animationProxyData.OptimizedAnimation.IsInDocument)
                        {
                            animationProxyData.OptimizedAnimation.ControllingStoryboard.Children.Remove((TimelineSceneNode)animationProxyData.OptimizedAnimation);
                        }
                        if (animationProxyData.ProxyAnimation != null && animationProxyData.ProxyAnimation.IsInDocument)
                        {
                            animationProxyData.ProxyAnimation.ControllingStoryboard.Children.Remove((TimelineSceneNode)animationProxyData.ProxyAnimation);
                        }
                        proxyTable.Remove(key);
                    }
                    proxyTable.Add(key, new AnimationProxyManager.AnimationProxyData(optimizedAnimation, proxyAnimation));
                }
            }
            List <AnimationProxyManager.TargetNamePropertyPair> list2 = new List <AnimationProxyManager.TargetNamePropertyPair>();

            foreach (KeyValuePair <AnimationProxyManager.TargetNamePropertyPair, AnimationProxyManager.AnimationProxyData> keyValuePair in proxyTable)
            {
                AnimationProxyManager.AnimationProxyData animationProxyData = keyValuePair.Value;
                int count = list2.Count;
                if (animationProxyData.ProxyAnimation != null && !keyValuePair.Key.Equals((object)new AnimationProxyManager.TargetNamePropertyPair((TimelineSceneNode)animationProxyData.ProxyAnimation)))
                {
                    animationProxyData.ProxyAnimation = (KeyFrameAnimationSceneNode)null;
                }
                if (animationProxyData.OptimizedAnimation != null && !keyValuePair.Key.Equals((object)new AnimationProxyManager.TargetNamePropertyPair((TimelineSceneNode)animationProxyData.OptimizedAnimation)))
                {
                    animationProxyData.OptimizedAnimation = (FromToAnimationSceneNode)null;
                }
                if (animationProxyData.OptimizedAnimation == null && animationProxyData.ProxyAnimation == null)
                {
                    list2.Add(keyValuePair.Key);
                }
                else if (animationProxyData.OptimizedAnimation == null || !animationProxyData.OptimizedAnimation.IsInDocument)
                {
                    if (allowedChange == AnimationProxyManager.AllowedChange.Any)
                    {
                        if (animationProxyData.ProxyAnimation != null && animationProxyData.ProxyAnimation.IsInDocument)
                        {
                            this.viewModel.AnimationEditor.RemoveAnimation(storyboard, (TimelineSceneNode)animationProxyData.ProxyAnimation);
                            if (animationProxyData.OptimizedAnimation != null && animationProxyData.OptimizedAnimation.IsInDocument)
                            {
                                animationProxyData.OptimizedAnimation.IsOptimized = false;
                            }
                        }
                        list2.Add(keyValuePair.Key);
                    }
                }
                else if (animationProxyData.ProxyWasUserDeleted && !animationProxyData.OptimizedAnimationAdded)
                {
                    if (allowedChange == AnimationProxyManager.AllowedChange.Any)
                    {
                        this.viewModel.AnimationEditor.RemoveAnimation(storyboard, (TimelineSceneNode)animationProxyData.OptimizedAnimation);
                        list2.Add(keyValuePair.Key);
                    }
                }
                else if (animationProxyData.ProxyAnimation == null || !animationProxyData.ProxyAnimation.IsInDocument)
                {
                    if (allowedChange == AnimationProxyManager.AllowedChange.OnlyNonSerializing || allowedChange == AnimationProxyManager.AllowedChange.Any)
                    {
                        animationProxyData.OptimizedAnimation.Invalidate();
                        if (animationProxyData.OptimizedAnimation.TargetElement != null)
                        {
                            KeyFrameAnimationSceneNode animationSceneNode = KeyFrameAnimationSceneNode.Factory.InstantiateWithTarget(this.viewModel, animationProxyData.OptimizedAnimation.TargetElement, animationProxyData.OptimizedAnimation.TargetProperty, animationProxyData.OptimizedAnimation.StoryboardContainer, KeyFrameAnimationSceneNode.GetKeyFrameAnimationForType(animationProxyData.OptimizedAnimation.AnimatedType, animationProxyData.OptimizedAnimation.ProjectContext));
                            animationSceneNode.AddKeyFrame(animationProxyData.OptimizedAnimation.Duration, animationProxyData.OptimizedAnimation.To);
                            KeyFrameSceneNode keyFrameAtIndex = animationSceneNode.GetKeyFrameAtIndex(0);
                            SceneNode.CopyPropertyValue((SceneNode)animationProxyData.OptimizedAnimation, animationProxyData.OptimizedAnimation.EasingFunctionProperty, (SceneNode)keyFrameAtIndex, keyFrameAtIndex.EasingFunctionProperty);
                            keyFrameAtIndex.ShouldSerialize     = false;
                            animationSceneNode.ShouldSerialize  = false;
                            animationSceneNode.IsAnimationProxy = true;
                            storyboard.Children.Insert(storyboard.Children.IndexOf((TimelineSceneNode)animationProxyData.OptimizedAnimation) + 1, (TimelineSceneNode)animationSceneNode);
                            animationProxyData.ProxyAnimation = animationSceneNode;
                        }
                    }
                }
                else if (!this.CanOptimizeAnimation(animationProxyData.ProxyAnimation))
                {
                    if (allowedChange == AnimationProxyManager.AllowedChange.Any)
                    {
                        this.RemoveOptimizedAndPromoteProxy(animationProxyData);
                        list2.Add(keyValuePair.Key);
                    }
                }
                else if ((!animationProxyData.OptimizedAnimation.IsOptimized || !AnimationProxyManager.CanFromToAnimationBeOptimized(animationProxyData.OptimizedAnimation)) && allowedChange == AnimationProxyManager.AllowedChange.Any)
                {
                    this.viewModel.AnimationEditor.RemoveAnimation(storyboard, (TimelineSceneNode)animationProxyData.ProxyAnimation);
                    animationProxyData.OptimizedAnimation.IsOptimized = false;
                    list2.Add(keyValuePair.Key);
                }
                if (count == list2.Count && allowedChange == AnimationProxyManager.AllowedChange.Any)
                {
                    if (!animationProxyData.OptimizedAnimationPropertyChanged && !animationProxyData.OptimizedAnimationAdded)
                    {
                        this.MovePropertiesFromProxyToOptimized(animationProxyData);
                    }
                    else
                    {
                        this.MovePropertiesFromOptimizedToProxy(animationProxyData);
                    }
                }
                animationProxyData.ResetUpdateState();
            }
            foreach (AnimationProxyManager.TargetNamePropertyPair key in list2)
            {
                proxyTable.Remove(key);
            }
        }