private void RemoveProperty()
        {
            USUndoManager.RegisterCompleteObjectUndo(PropertyTimeline, "Remove Curve");
            USUndoManager.RegisterCompleteObjectUndo(this, "Remove Curve");
            foreach (var child in Children)
            {
                USUndoManager.RegisterCompleteObjectUndo(child, "Remove Curve");
            }

            var preFix       = PropertyFieldInfo.Name;
            var propertyInfo = PropertyTimeline.GetProperty(preFix, PropertyFieldInfo.Component);

            foreach (var child in Children)
            {
                ((USPropertyMemberHierarchyItem)child).Curve = null;
            }

            propertyInfo.RestoreBaseState();
            PropertyTimeline.RemoveProperty(propertyInfo);
            USUndoManager.DestroyImmediate(propertyInfo);

            IsSelected = false;
            foreach (var child in Children)
            {
                ((USPropertyMemberHierarchyItem)child).IsSelected = false;
            }
        }
Ejemplo n.º 2
0
        public void ProcessDelete(IUSHierarchyItem item)
        {
            var timelineContainerItem = item as USTimelineContainerHierarchyItem;
            var timelineHierarchyItem = item as IUSTimelineHierarchyItem;

            if (timelineContainerItem)
            {
                foreach (var child in timelineContainerItem.Children.ToList())
                {
                    ProcessDelete(child);
                }

                USUndoManager.RegisterCompleteObjectUndo(this, "Remove Timeline Container");
                USUndoManager.RegisterCompleteObjectUndo(USHierarchy, "Remove Timeline Container");
                USHierarchy.RootItems.Remove(timelineContainerItem);

                var gameObjectToDestroy = timelineContainerItem.TimelineContainer.gameObject;
                USUndoManager.DestroyImmediate(timelineContainerItem);
                USUndoManager.DestroyImmediate(gameObjectToDestroy);
            }
            else if (timelineHierarchyItem)
            {
                var parent = USHierarchy.GetParentOf(timelineHierarchyItem);

                timelineHierarchyItem.RestoreBaseState();

                USUndoManager.RegisterCompleteObjectUndo(parent, "Remove Timeline");
                parent.RemoveChild(timelineHierarchyItem);

                var gameObjectToDestroy = timelineHierarchyItem.TimelineToDestroy().gameObject;
                USUndoManager.DestroyImmediate(timelineHierarchyItem);
                USUndoManager.DestroyImmediate(gameObjectToDestroy);
            }
        }
        public void RemoveAnimationTrack(AnimationTrack track)
        {
            USUndoManager.RegisterCompleteObjectUndo(AnimationTimeline, "Add New Track");
            AnimationTimeline.RemoveTrack(track);

            USUndoManager.RegisterCompleteObjectUndo(USHierarchy, "Add New Track");
            USHierarchy.RootItems.Remove(USHierarchy.RootItems.Where(item => ((USAnimationTimelineTrackHierarchyItem)item).AnimationTrack == track).First());

            USUndoManager.DestroyImmediate(track);
        }
Ejemplo n.º 4
0
        private void RemoveKeyframeAtIndex(int index)
        {
            if (index >= ObjectPathTimeline.Keyframes.Count || index < 0)
            {
                return;
            }

            var keyframe = ObjectPathTimeline.Keyframes[index];

            ObjectPathTimeline.RemoveKeyframe(keyframe);
            GUI.changed = true;

            USUndoManager.DestroyImmediate(keyframe);
        }
        private void RemoveKeyframe(USObserverKeyframe keyframe)
        {
            USUndoManager.RegisterCompleteObjectUndo(this, "Remove Keyframe");

            var data = cachedObserverRenderData.Where(element => element.Keyframe == keyframe).First();

            cachedObserverRenderData.Remove(data);

            USUndoManager.PropertyChange(ObserverTimeline, "Remove Keyframe");
            ObserverTimeline.RemoveKeyframe(keyframe);

            ObserverTimeline.Process(ObserverTimeline.Sequence.RunningTime, ObserverTimeline.Sequence.PlaybackRate);

            USUndoManager.DestroyImmediate(data);
            USUndoManager.DestroyImmediate(keyframe);
        }
Ejemplo n.º 6
0
        private void RemoveProperty(PropertyBox propertyBox)
        {
            Debug.Log("Removing Property " + propertyBox);
            USUndoManager.RegisterCompleteObjectUndo(PropertyTimeline, "Remove Curve");
            USUndoManager.RegisterCompleteObjectUndo(this, "Remove Curve");
            USUndoManager.PropertyChange(CurveEditor, "Add Curve");

            propertyBoxes.Remove(propertyBox);

            var preFix       = propertyBox.PropertyName;
            var propertyInfo = PropertyTimeline.GetProperty(preFix, propertyBox.Component);

            propertyInfo.curves.ForEach(curve => CurveEditor.Curves.Remove(curve));

            propertyInfo.RestoreBaseState();
            PropertyTimeline.RemoveProperty(propertyInfo);
            USUndoManager.DestroyImmediate(propertyInfo);
        }
Ejemplo n.º 7
0
        private void RemoveEvent(USEventBase baseEvent)
        {
            USUndoManager.RegisterCompleteObjectUndo(this, "Remove Event");

            EventRenderData foundEventData = null;

            foreach (var cachedRenderData in cachedEventRenderData)
            {
                if (cachedRenderData.Event == baseEvent)
                {
                    foundEventData = cachedRenderData;
                }
            }

            cachedEventRenderData.Remove(foundEventData);

            var removedGameObject = foundEventData.Event.gameObject;

            USUndoManager.DestroyImmediate(foundEventData);
            USUndoManager.DestroyImmediate(removedGameObject);
        }
        private void RemoveClip(AnimationClipData clip)
        {
            var undoName               = "RemoveClip";
            var animationTracks        = AnimationTimeline.AnimationTracks;
            var cachedClipDataToRemove = cachedClipRenderData.Where(cachedClipData => cachedClipData.animationClipData == clip).ToList();
            var tracksToRemoveClipFrom = animationTracks.Where(track => track.TrackClips.Contains(clip));

            USUndoManager.RegisterCompleteObjectUndo(this, undoName);

            foreach (var cachedClipData in cachedClipDataToRemove)
            {
                cachedClipRenderData.Remove(cachedClipData);
                USUndoManager.DestroyImmediate(cachedClipData);
            }

            foreach (var trackToRemoveClipFrom in tracksToRemoveClipFrom)
            {
                USUndoManager.RegisterCompleteObjectUndo(trackToRemoveClipFrom, undoName);
                trackToRemoveClipFrom.RemoveClip(clip);
                USUndoManager.DestroyImmediate(clip);
            }
        }