private void StartProcessingAnimationMode() { if (AnimationHelper.IsInAnimationMode) { return; } if (Application.isPlaying) { return; } var objects = new List <Component>(); // All observered objects foreach (var observedObject in CurrentSequence.ObservedObjects) { SaveObjectValueInAnimationMode(observedObject, ref objects); } USUndoManager.RegisterCompleteObjectUndo(this, "Play"); IsInAnimationMode = true; ContentRenderer.StoreBaseState(); }
private void RemoveAnimationTrack() { USUndoManager.RegisterCompleteObjectUndo(AnimationTimeline, "Remove Track"); AnimationTimeline.RemoveTrack(AnimationTrack); AnimationTimelineHierarchy.RemoveAnimationTrack(AnimationTrack); }
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; } }
private void ProcessDuplicate(IUSHierarchyItem item) { var timelineContainer = item as USTimelineContainerHierarchyItem; if (timelineContainer != null) { var newTimelineContainer = USEditor.DuplicateTimelineContainer(timelineContainer.TimelineContainer, CurrentSequence); USUndoManager.RegisterCreatedObjectUndo(newTimelineContainer.gameObject, "Duplicate Timeline"); AddNewTimelineContainer(newTimelineContainer); } var timeline = item as IUSTimelineHierarchyItem; if (timeline != null) { USUndoManager.RegisterCompleteObjectUndo(this, "Duplicate Timeline"); USUndoManager.RegisterCompleteObjectUndo(USHierarchy, "Duplicate Timeline"); var newTimeline = USEditor.DuplicateTimeline(timeline.BaseTimeline, timeline.BaseTimeline.TimelineContainer); USUndoManager.RegisterCreatedObjectUndo(newTimeline.gameObject, "Duplicate Timeline"); var parent = USHierarchy.GetParentOf(item) as USTimelineContainerHierarchyItem; USUndoManager.RegisterCompleteObjectUndo(parent, "Duplicate Timeline"); parent.AddTimeline(newTimeline); } }
private void AddNewState(float time, string stateName) { var clipData = CreateInstance <AnimationClipData>(); clipData.TargetObject = AnimationTimeline.AffectedObject.gameObject; clipData.StartTime = time; clipData.StateName = stateName; clipData.StateDuration = MecanimAnimationUtility.GetStateDuration(stateName, clipData.TargetObject); clipData.PlaybackDuration = MecanimAnimationUtility.GetStateDuration(stateName, clipData.TargetObject); clipData.Track = AnimationTrack; USUndoManager.RegisterCreatedObjectUndo(clipData, "Add New Clip"); var cachedData = CreateInstance <AnimationClipRenderData>(); cachedData.animationClipData = clipData; USUndoManager.RegisterCreatedObjectUndo(clipData, "Add New Clip"); USUndoManager.RegisterCompleteObjectUndo(AnimationTrack, "Add New Clip"); AnimationTrack.AddClip(clipData); USUndoManager.RegisterCompleteObjectUndo(this, "Add New Clip"); cachedClipRenderData.Add(cachedData); OnSelectedObjects(new List <UnityEngine.Object>() { clipData }); }
public void AddAnimationTrack(string layer) { var track = CreateInstance <AnimationTrack>(); USUndoManager.RegisterCreatedObjectUndo(track, "Add New Track"); track.Layer = MecanimAnimationUtility.LayerNameToIndex(AnimationTimeline.AffectedObject.gameObject, layer); USUndoManager.RegisterCompleteObjectUndo(AnimationTimeline, "Add New Track"); AnimationTimeline.AddTrack(track); var hierarchyItem = CreateInstance(typeof(USAnimationTimelineTrackHierarchyItem)) as USAnimationTimelineTrackHierarchyItem; USUndoManager.RegisterCreatedObjectUndo(hierarchyItem, "Add New Track"); hierarchyItem.AnimationTrack = track; hierarchyItem.AnimationTimelineHierarchy = this; hierarchyItem.AnimationTimeline = AnimationTimeline; hierarchyItem.Initialize(AnimationTimeline); USUndoManager.RegisterCompleteObjectUndo(USHierarchy, "Add New Track"); USHierarchy.RootItems.Add(hierarchyItem as IUSHierarchyItem); if (AnimationTimeline.AnimationTracks.Count == 1) { IsExpanded = true; } }
private void SetCamera(USObserverKeyframe keyframe, float time, Shared.TypeOfTransition transitionType, float transitionDuration, Camera camera) { if (AnimationHelper.IsInAnimationMode) { ObserverTimeline.StopTimeline(); ObserverTimeline.StartTimeline(); } if (keyframe != null) { USUndoManager.PropertyChange(keyframe, "Set Camera"); keyframe.KeyframeCamera = camera; } else { USUndoManager.RegisterCompleteObjectUndo(this, "Set Camera"); var newKeyframe = CreateInstance <USObserverKeyframe>(); newKeyframe.FireTime = time; newKeyframe.KeyframeCamera = camera; newKeyframe.TransitionType = transitionType; newKeyframe.TransitionDuration = transitionDuration; USUndoManager.RegisterCreatedObjectUndo(newKeyframe, "Set Camera"); USUndoManager.RegisterCompleteObjectUndo(ObserverTimeline, "Set Camera"); ObserverTimeline.AddKeyframe(newKeyframe); var cachedData = CreateInstance <ObserverRenderData>(); cachedData.Keyframe = newKeyframe; cachedObserverRenderData.Add(cachedData); } ObserverTimeline.Process(ObserverTimeline.Sequence.RunningTime, ObserverTimeline.Sequence.PlaybackRate); }
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 override void Initialize(USTimelineBase timeline) { base.Initialize(timeline); USUndoManager.RegisterCompleteObjectUndo(EventEditor, "Add New Timeline"); EventEditor.InitializeWithEvents(EventTimeline.Events); EventEditor.EventTimeline = EventTimeline; }
public void HideAll() { USUndoManager.RegisterCompleteObjectUndo(this, "Hide All"); for (var i = 0; i < RootItems.Count; i++) { RootItems[i].HideAll(); } }
public void AddKeyframeAtTimeUsingCurrentValue(USPropertyInfo propertyInfo, float time) { USUndoManager.RegisterCompleteObjectUndo(propertyInfo, "Add Keyframe"); propertyInfo.AddKeyframe(time, AutoTangentMode); USUndoManager.RegisterCompleteObjectUndo(this, "Add Keyframe"); RebuildCurvesOnNextGUI = true; AreCurvesDirty = true; EditorWindow.Repaint(); }
public virtual void HideAll() { USUndoManager.RegisterCompleteObjectUndo(this, "Hide All"); IsExpanded = false; foreach (var child in Children) { child.HideAll(); } }
public virtual void Expand() { USUndoManager.RegisterCompleteObjectUndo(this, "Expand All"); IsExpanded = true; foreach (var child in Children) { child.Expand(); } }
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); }
public void DeleteSelection() { USUndoManager.RegisterCompleteObjectUndo(this, "RemoveClip"); foreach (var selectedObject in SelectedObjects) { RemoveClip(selectedObject as AnimationClipData); } SelectedObjects.Clear(); }
private void SequenceSwitch(USSequencer nextSequence) { USUndoManager.RegisterCompleteObjectUndo(this, "Select new sequence"); CurrentSequence = nextSequence; USUndoManager.RegisterCompleteObjectUndo(ContentRenderer, "Select new sequence"); ContentRenderer.OnSequenceChange(CurrentSequence); TryToFixPropertyTimelines(CurrentSequence); TryToFixObserverTimelines(CurrentSequence); }
public void AddNewTimelineContainer(USTimelineContainer timelineContainer) { var newHierarchyItem = CreateInstance(typeof(USTimelineContainerHierarchyItem)) as USTimelineContainerHierarchyItem; USUndoManager.RegisterCreatedObjectUndo(newHierarchyItem, "Add New Timeline Container"); USUndoManager.RegisterCompleteObjectUndo(newHierarchyItem, "Add New Timeline Container"); newHierarchyItem.SetupWithTimelineContainer(timelineContainer); USUndoManager.RegisterCompleteObjectUndo(USHierarchy, "Add New Timeline Container"); USHierarchy.AddHierarchyItemToRoot(newHierarchyItem as IUSHierarchyItem); }
public void DuplicateSelection() { USUndoManager.RegisterCompleteObjectUndo(this, "Duplicate"); foreach (var selectedObject in SelectedObjects) { var keyframe = selectedObject as USInternalKeyframe; var newKeyframe = Instantiate(keyframe) as USInternalKeyframe; newKeyframe.name = keyframe.name; AddKeyframe(newKeyframe, newKeyframe.curve); USUndoManager.RegisterCreatedObjectUndo(newKeyframe, "Duplicate"); } }
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); }
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); }
private void AddProperty(PropertyBox propertyBox) { Debug.Log("Adding Property " + propertyBox); var usPropertyInfo = CreateInstance <USPropertyInfo>(); USUndoManager.RegisterCreatedObjectUndo(usPropertyInfo, "Add Curve"); USUndoManager.RegisterCompleteObjectUndo(PropertyTimeline, "Add Curve"); USUndoManager.RegisterCompleteObjectUndo(this, "Add Curve"); USUndoManager.RegisterCompleteObjectUndo(CurveEditor, "Add Curve"); object propertyValue = null; usPropertyInfo.Component = propertyBox.PropertyFieldInfo.Component; if (propertyBox.PropertyFieldInfo.Property != null) { usPropertyInfo.propertyInfo = propertyBox.PropertyFieldInfo.Property; propertyValue = propertyBox.PropertyFieldInfo.Property.GetValue(propertyBox.PropertyFieldInfo.Component, null); } else if (propertyBox.PropertyFieldInfo.Field != null) { usPropertyInfo.fieldInfo = propertyBox.PropertyFieldInfo.Field; propertyValue = propertyBox.PropertyFieldInfo.Field.GetValue(propertyBox.PropertyFieldInfo.Component); } usPropertyInfo.InternalName = propertyBox.PropertyFieldInfo.MappedType; usPropertyInfo.CreatePropertyInfo(USPropertyInfo.GetMappedType(propertyValue.GetType())); usPropertyInfo.AddKeyframe(propertyValue, 0.0f, CurveAutoTangentModes.None); usPropertyInfo.AddKeyframe(propertyValue, PropertyTimeline.Sequence.Duration, CurveAutoTangentModes.None); PropertyTimeline.AddProperty(usPropertyInfo); usPropertyInfo.StoreBaseState(); var newCurves = CurveEditor.Curves; newCurves.AddRange(usPropertyInfo.curves); CurveEditor.Curves = newCurves; propertyBox.ShouldShowFavouriteButton = false; propertyBox.ShouldShowAddRemove = false; propertyBoxes.Add(propertyBox); }
public void DuplicateSelection() { USUndoManager.RegisterCompleteObjectUndo(this, "Duplicate"); foreach (var selectedObject in SelectedObjects) { var originalEventBase = selectedObject as USEventBase; var duplicatedEventBase = Instantiate(originalEventBase.gameObject) as GameObject; duplicatedEventBase.name = originalEventBase.gameObject.name; duplicatedEventBase.transform.parent = originalEventBase.transform.parent; var cachedData = CreateInstance <EventRenderData>(); cachedData.Initialize(duplicatedEventBase.GetComponent <USEventBase>()); cachedEventRenderData.Add(cachedData); USUndoManager.RegisterCreatedObjectUndo(duplicatedEventBase, "Duplicate"); USUndoManager.RegisterCreatedObjectUndo(cachedData, "Duplicate"); } }
public void AddNewTimeline(USTimelineContainerHierarchyItem hierarchyItem, USCustomTimelineHierarchyItem timelineAttribute) { var timelineObject = new GameObject(timelineAttribute.FriendlyName); USUndoManager.RegisterCreatedObjectUndo(timelineObject, "Add New Timeline"); timelineObject.transform.parent = hierarchyItem.TimelineContainer.transform; timelineObject.transform.position = Vector3.zero; timelineObject.transform.rotation = Quaternion.identity; var timeline = timelineObject.AddComponent(timelineAttribute.InspectedType) as USTimelineBase; USUndoManager.RegisterCreatedObjectUndo(timeline, "Add New Timeline"); USUndoManager.PropertyChange(hierarchyItem.TimelineContainer.Sequence, "Add New Timeline"); hierarchyItem.TimelineContainer.Sequence.ResetCachedData(); USUndoManager.RegisterCompleteObjectUndo(hierarchyItem, "Add New Timeline"); hierarchyItem.AddTimeline(timeline); }
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 StopProcessingAnimationMode() { if (CurrentSequence) { CurrentSequence.Stop(); } if (!AnimationHelper.IsInAnimationMode) { return; } if (Application.isPlaying) { return; } USUndoManager.RegisterCompleteObjectUndo(this, "Play"); IsInAnimationMode = false; ContentRenderer.RestoreBaseState(); }
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); } }
private void AddEvent(float time, Type type) { var eventGO = new GameObject(type.Name); eventGO.transform.parent = EventTimeline.transform; eventGO.transform.position = Vector3.zero; eventGO.transform.rotation = Quaternion.identity; USUndoManager.RegisterCreatedObjectUndo(eventGO, "Add Event"); var eventComponent = eventGO.AddComponent(type) as USEventBase; eventComponent.FireTime = time; var cachedData = CreateInstance <EventRenderData>(); cachedData.Initialize(eventComponent); USUndoManager.RegisterCreatedObjectUndo(cachedData, "Add Event"); USUndoManager.RegisterCompleteObjectUndo(this, "Add Event"); cachedEventRenderData.Add(cachedData); }
public void SetupWithTimelineContainer(USTimelineContainer timelineContainer) { TimelineContainer = timelineContainer; var timelines = TimelineContainer.Timelines; if (TimelineContainer.Timelines.Count() > Children.Count) { var notInBoth = timelines.Where( (timeline) => !Children.Any( (item) => ((item is IUSTimelineHierarchyItem) && (item as IUSTimelineHierarchyItem).IsForThisTimeline(timeline)) ) ); foreach (var extraTimeline in notInBoth) { IUSHierarchyItem hierarchyItem = null; var customKeyValuePairs = USEditorUtility.CustomTimelineAttributes; foreach (var customKeyValuePair in customKeyValuePairs) { if (extraTimeline.GetType() == customKeyValuePair.Key.InspectedType) { hierarchyItem = CreateInstance(customKeyValuePair.Value) as IUSHierarchyItem; // This is here to capture the change in USTimelineBase BaseTimeline on the IUSTimelineHierarchyItem that occurse during initialize USUndoManager.RegisterCompleteObjectUndo(hierarchyItem, "Add New Timeline"); hierarchyItem.Initialize(extraTimeline); } } AddChild(hierarchyItem); } } }
private USInternalKeyframe AddKeyframe(USInternalCurve curve, float time, float value) { // If a keyframe already exists at this time, use that one. USInternalKeyframe internalKeyframe = null; foreach (var keyframe in curve.Keys) { if (Mathf.Approximately(keyframe.Time, time)) { internalKeyframe = keyframe; } if (internalKeyframe != null) { break; } } // Didn't find a keyframe create a new one. if (!internalKeyframe) { internalKeyframe = CreateInstance <USInternalKeyframe>(); USUndoManager.RegisterCreatedObjectUndo(internalKeyframe, "Add New Keyframe"); USUndoManager.RegisterCompleteObjectUndo(curve, "Add Keyframe"); curve.Keys.Add(internalKeyframe); } USUndoManager.RegisterCompleteObjectUndo(internalKeyframe, "Add Keyframe"); internalKeyframe.curve = curve; internalKeyframe.Time = time; internalKeyframe.Value = value; internalKeyframe.InTangent = 0.0f; internalKeyframe.OutTangent = 0.0f; if (AutoTangentMode == CurveAutoTangentModes.Smooth) { internalKeyframe.Smooth(); } else if (AutoTangentMode == CurveAutoTangentModes.Flatten) { internalKeyframe.Flatten(); } else if (AutoTangentMode == CurveAutoTangentModes.RightLinear) { internalKeyframe.RightTangentLinear(); } else if (AutoTangentMode == CurveAutoTangentModes.RightConstant) { internalKeyframe.RightTangentConstant(); } else if (AutoTangentMode == CurveAutoTangentModes.LeftLinear) { internalKeyframe.LeftTangentLinear(); } else if (AutoTangentMode == CurveAutoTangentModes.LeftConstant) { internalKeyframe.LeftTangentConstant(); } else if (AutoTangentMode == CurveAutoTangentModes.BothLinear) { internalKeyframe.BothTangentLinear(); } else if (AutoTangentMode == CurveAutoTangentModes.BothConstant) { internalKeyframe.BothTangentConstant(); } curve.Keys.Sort(USInternalCurve.KeyframeComparer); curve.BuildAnimationCurveFromInternalCurve(); return(internalKeyframe); }
public void OnSceneGUI() { if (ObjectPathTimeline == null || ObjectPathTimeline.Keyframes == null) { return; } if (SelectedNodeIndex >= 0) { if (Event.current.isKey && (Event.current.keyCode == KeyCode.Delete || Event.current.keyCode == KeyCode.Backspace)) { USUndoManager.RegisterCompleteObjectUndo(this, "Remove Keyframe"); USUndoManager.RegisterCompleteObjectUndo(ObjectPathTimeline, "Remove Keyframe"); Event.current.Use(); RemoveKeyframeAtIndex(SelectedNodeIndex); SelectedNodeIndex = -1; } } if (Event.current.type == EventType.MouseDown) { var nearestIndex = GetNearestNodeForMousePosition(Event.current.mousePosition); if (nearestIndex != -1) { SelectedNodeIndex = nearestIndex; if (Event.current.clickCount > 1) { USUndoManager.PropertyChange(ObjectPathTimeline, "Add Keyframe"); var cameraTransform = SceneView.currentDrawingSceneView.camera.transform; var keyframe = GetKeyframeAtIndex(SelectedNodeIndex); var nextKeyframe = GetKeyframeAtIndex(SelectedNodeIndex + 1); var newKeyframePosition = Vector3.zero; if (keyframe == null) { newKeyframePosition = cameraTransform.position + (cameraTransform.forward * 1.0f); } else { if (SelectedNodeIndex == ObjectPathTimeline.Keyframes.Count - 1) { newKeyframePosition = keyframe.Position + (cameraTransform.up * Vector3.Magnitude(keyframe.Position - cameraTransform.position) * 0.1f); } else { var directionVector = nextKeyframe.Position - keyframe.Position; var halfDistance = Vector3.Magnitude(directionVector) * 0.5f; directionVector.Normalize(); newKeyframePosition = keyframe.Position + (directionVector * halfDistance); } } var translatedKeyframe = CreateInstance <SplineKeyframe>(); USUndoManager.RegisterCreatedObjectUndo(translatedKeyframe, "Add Keyframe"); translatedKeyframe.Position = newKeyframePosition; ObjectPathTimeline.AddAfterKeyframe(translatedKeyframe, SelectedNodeIndex); GUI.changed = true; } } } if (Vector3.Distance(ObjectPathTimeline.Keyframes[0].Position, ObjectPathTimeline.Keyframes[ObjectPathTimeline.Keyframes.Count - 1].Position) == 0) { Handles.Label(ObjectPathTimeline.Keyframes[0].Position, "Start and End"); } else { Handles.Label(ObjectPathTimeline.Keyframes[0].Position, "Start"); Handles.Label(ObjectPathTimeline.Keyframes[ObjectPathTimeline.Keyframes.Count - 1].Position, "End"); } for (var nodeIndex = 0; nodeIndex < ObjectPathTimeline.Keyframes.Count; nodeIndex++) { var node = ObjectPathTimeline.Keyframes[nodeIndex]; if (node && nodeIndex > 0 && nodeIndex < ObjectPathTimeline.Keyframes.Count - 1) { var handleSize = HandlesUtility.GetHandleSize(node.Position); Handles.Label(node.Position + new Vector3(0.25f * handleSize, 0.0f * handleSize, 0.0f * handleSize), nodeIndex.ToString()); } using (new HandlesChangeColor(ObjectPathTimeline.PathColor)) { USUndoManager.BeginChangeCheck(); var existingKeyframe = ObjectPathTimeline.Keyframes[nodeIndex]; var newPosition = HandlesUtility.PositionHandle(existingKeyframe.Position, Quaternion.identity); if (USUndoManager.EndChangeCheck()) { USUndoManager.PropertyChange(ObjectPathTimeline, "Modify Keyframe"); foreach (var keyframe in ObjectPathTimeline.Keyframes) { USUndoManager.PropertyChange(keyframe, "Modify Keyframe"); } ObjectPathTimeline.AlterKeyframe(newPosition, nodeIndex); EditorUtility.SetDirty(ObjectPathTimeline); } } } }