示例#1
0
 private void ChangeAnimationProperty(PropertyReference fromProperty, PropertyReference toProperty, Dictionary <TimelineSceneNode, StoryboardTimelineSceneNode> toAdd, Dictionary <TimelineSceneNode, StoryboardTimelineSceneNode> toRemove, bool exactMatch)
 {
     foreach (StoryboardTimelineSceneNode timelineSceneNode in this.targetElement.ViewModel.AnimationEditor.EnumerateStoryboardsForContainer(this.targetElement.StoryboardContainer))
     {
         foreach (TimelineSceneNode timeline in (IEnumerable <TimelineSceneNode>)timelineSceneNode.Children)
         {
             if (timeline.TargetElement == this.targetElement && timeline.TargetProperty != null)
             {
                 PropertyReference propertyReference = toProperty;
                 bool flag1 = AnimationProxyManager.IsOptimizedAnimation(timeline);
                 bool flag2 = !flag1 && fromProperty.Equals((object)timeline.TargetProperty);
                 if (!flag1 && !exactMatch && !flag2)
                 {
                     flag2 = fromProperty.IsPrefixOf(timeline.TargetProperty);
                     if (flag2)
                     {
                         for (int count = toProperty.Count; count < timeline.TargetProperty.Count; ++count)
                         {
                             propertyReference = propertyReference.Append(timeline.TargetProperty[count]);
                         }
                     }
                 }
                 if (flag2)
                 {
                     if (toRemove != null)
                     {
                         toRemove[timeline] = timelineSceneNode;
                     }
                     TimelineSceneNode index = (TimelineSceneNode)this.targetElement.ViewModel.GetSceneNode(timeline.DocumentNode.Clone(timeline.DocumentContext));
                     index.TargetProperty  = propertyReference;
                     index.ShouldSerialize = true;
                     KeyFrameAnimationSceneNode animationSceneNode = index as KeyFrameAnimationSceneNode;
                     if (animationSceneNode != null)
                     {
                         animationSceneNode.IsAnimationProxy = false;
                     }
                     toAdd[index] = timelineSceneNode;
                 }
             }
         }
     }
 }
示例#2
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);
        }
示例#3
0
 private void RemoveAnimation(PropertyReference animationPrefix, Dictionary <TimelineSceneNode, StoryboardTimelineSceneNode> toRemove)
 {
     foreach (StoryboardTimelineSceneNode timelineSceneNode in this.targetElement.ViewModel.AnimationEditor.EnumerateStoryboardsForContainer(this.targetElement.StoryboardContainer))
     {
         foreach (TimelineSceneNode timeline in (IEnumerable <TimelineSceneNode>)timelineSceneNode.Children)
         {
             if (timeline.TargetElement == this.targetElement && timeline.TargetProperty != null && !AnimationProxyManager.IsOptimizedAnimation(timeline) && (animationPrefix.Equals((object)timeline.TargetProperty) || animationPrefix.IsPrefixOf(timeline.TargetProperty)))
             {
                 toRemove[timeline] = timelineSceneNode;
             }
         }
     }
 }
示例#4
0
        private void SubdivideSegment(PathGeometry oldGeometry, int figure, int segment, int pointIndex, double parameter, Dictionary <TimelineSceneNode, StoryboardTimelineSceneNode> subdivisionProperties)
        {
            PropertyReference propertyReference1 = new PropertyReference(this.pathProperty).Append(PathElement.FiguresProperty).Append((ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((IPlatformMetadata)this.platformMetadata, PlatformTypes.PathFigureCollection, figure));
            PropertyReference propertyReference2 = propertyReference1.Append(PathElement.PathFigureSegmentsProperty);
            PropertyReference propertyReference3 = segment != oldGeometry.Figures[figure].Segments.Count ? propertyReference2.Append((ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((IPlatformMetadata)this.platformMetadata, PlatformTypes.PathSegmentCollection, segment)) : propertyReference1.Append(PathElement.PathFigureStartPointProperty);
            PropertyReference propertyReference4;

            if (segment == 0)
            {
                propertyReference4 = propertyReference1.Append(PathElement.PathFigureStartPointProperty);
            }
            else
            {
                ReferenceStep step = (ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((IPlatformMetadata)this.platformMetadata, PlatformTypes.PathSegmentCollection, segment - 1);
                propertyReference4 = propertyReference2.Append(step).Append(this.LastPointProperty(oldGeometry.Figures[figure].Segments[segment - 1]));
            }
            PropertyReference propertyReference5 = (PropertyReference)null;

            if (segment == oldGeometry.Figures[figure].Segments.Count - 1 && PathFigureUtilities.IsClosed(oldGeometry.Figures[figure]) && PathFigureUtilities.IsCloseSegmentDegenerate(oldGeometry.Figures[figure]))
            {
                propertyReference5 = propertyReference1.Append(PathElement.PathFigureStartPointProperty);
            }
            foreach (StoryboardTimelineSceneNode timelineSceneNode1 in this.targetElement.ViewModel.AnimationEditor.EnumerateStoryboardsForContainer(this.targetElement.StoryboardContainer))
            {
                Dictionary <double, List <KeyFrameSceneNode> > keyFrames1 = new Dictionary <double, List <KeyFrameSceneNode> >();
                foreach (KeyValuePair <TimelineSceneNode, StoryboardTimelineSceneNode> keyValuePair in subdivisionProperties)
                {
                    if (keyValuePair.Value == timelineSceneNode1)
                    {
                        KeyFrameAnimationSceneNode keyFrameNode = keyValuePair.Key as KeyFrameAnimationSceneNode;
                        if (keyFrameNode != null)
                        {
                            this.RecordKeyFrames(keyFrames1, keyFrameNode);
                        }
                    }
                }
                Dictionary <double, List <KeyFrameSceneNode> > keyFrames2 = new Dictionary <double, List <KeyFrameSceneNode> >();
                foreach (TimelineSceneNode timelineSceneNode2 in (IEnumerable <TimelineSceneNode>)timelineSceneNode1.Children)
                {
                    if (timelineSceneNode2.TargetElement == this.targetElement && timelineSceneNode2.TargetProperty != null && (propertyReference3.Equals((object)timelineSceneNode2.TargetProperty) || propertyReference3.IsPrefixOf(timelineSceneNode2.TargetProperty) || propertyReference4.Equals((object)timelineSceneNode2.TargetProperty) || propertyReference5 != null && propertyReference5.Equals((object)timelineSceneNode2.TargetProperty)))
                    {
                        KeyFrameAnimationSceneNode keyFrameNode = timelineSceneNode2 as KeyFrameAnimationSceneNode;
                        if (keyFrameNode != null)
                        {
                            this.RecordKeyFrames(keyFrames2, keyFrameNode);
                        }
                    }
                }
                foreach (KeyValuePair <double, List <KeyFrameSceneNode> > keyValuePair in keyFrames2)
                {
                    PathGeometry       path = oldGeometry.Clone();
                    PathGeometryEditor pathGeometryEditor = new PathGeometryEditor(path);
                    foreach (KeyFrameSceneNode keyFrameSceneNode in keyValuePair.Value)
                    {
                        PropertyReference propertyReference6 = this.targetElement.ViewModel.DefaultView.ConvertToWpfPropertyReference(keyFrameSceneNode.TargetProperty.Subreference(1));
                        object            valueToSet         = this.targetElement.ViewModel.DefaultView.ConvertToWpfValue(keyFrameSceneNode.Value);
                        propertyReference6.SetValue((object)path, valueToSet);
                    }
                    pathGeometryEditor.SubdivideSegment(figure, pointIndex, parameter);
                    List <KeyFrameSceneNode> list;
                    if (keyFrames1.TryGetValue(keyValuePair.Key, out list))
                    {
                        foreach (KeyFrameSceneNode keyFrameSceneNode in list)
                        {
                            object obj = this.targetElement.ViewModel.DefaultView.ConvertFromWpfValue(this.targetElement.ViewModel.DefaultView.ConvertToWpfPropertyReference(keyFrameSceneNode.TargetProperty.Subreference(1)).GetCurrentValue((object)path));
                            keyFrameSceneNode.Value = obj;
                        }
                    }
                }
            }
        }