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); } }
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 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 }); }
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 static void DuplicateSequence(USSequencer currentSequence) { var duplicateObject = Object.Instantiate(currentSequence.gameObject) as GameObject; USDetachScriptableObjects.ProcessSequence(duplicateObject.GetComponent <USSequencer>()); Selection.activeGameObject = duplicateObject; USUndoManager.RegisterCreatedObjectUndo(duplicateObject, "Duplicate Sequence"); }
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 AddProperty() { var usPropertyInfo = CreateInstance <USPropertyInfo>(); USUndoManager.RegisterCreatedObjectUndo(usPropertyInfo, "Add Curve"); USUndoManager.PropertyChange(PropertyTimeline, "Add Curve"); USUndoManager.PropertyChange(this, "Add Curve"); foreach (var child in Children) { USUndoManager.PropertyChange(child, "Add Curve"); } object propertyValue = null; usPropertyInfo.Component = PropertyFieldInfo.Component; if (PropertyFieldInfo.Property != null) { usPropertyInfo.propertyInfo = PropertyFieldInfo.Property; propertyValue = PropertyFieldInfo.Property.GetValue(PropertyFieldInfo.Component, null); } else if (PropertyFieldInfo.Field != null) { usPropertyInfo.fieldInfo = PropertyFieldInfo.Field; propertyValue = PropertyFieldInfo.Field.GetValue(PropertyFieldInfo.Component); } usPropertyInfo.InternalName = 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); for (var curveIndex = 0; curveIndex < usPropertyInfo.curves.Count; curveIndex++) { ((USPropertyMemberHierarchyItem)Children[curveIndex]).Curve = usPropertyInfo.curves[curveIndex]; } usPropertyInfo.StoreBaseState(); IsSelected = true; foreach (var child in Children) { ((USPropertyMemberHierarchyItem)child).IsSelected = true; } }
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 ProcessDuplicateToSequence(IUSHierarchyItem item, USSequencer sequence) { var affectedObject = default(Transform); var timelineContainer = item as USTimelineContainerHierarchyItem; var timeline = item as IUSTimelineHierarchyItem; if (timelineContainer != null) { affectedObject = timelineContainer.TimelineContainer.AffectedObject; } if (timeline != null) { affectedObject = timeline.BaseTimeline.AffectedObject; } if (timelineContainer && USRuntimeUtility.HasTimelineContainerWithAffectedObject(sequence, affectedObject)) { EditorUtility.DisplayDialog("Cannot continue", string.Format("The sequence {0} already has timelines for the object {1}", sequence.name, affectedObject.name), "Ok"); return; } if (timelineContainer) { var newTimelineContainer = USEditor.DuplicateTimelineContainer(timelineContainer.TimelineContainer, sequence); USUndoManager.RegisterCreatedObjectUndo(newTimelineContainer.gameObject, "Duplicate Timeline"); } if (timeline) { var newTimelineContainer = sequence.GetTimelineContainerFor(timeline.BaseTimeline.AffectedObject); if (newTimelineContainer == null) { newTimelineContainer = sequence.CreateNewTimelineContainer(timeline.BaseTimeline.AffectedObject); USUndoManager.RegisterCreatedObjectUndo(newTimelineContainer.gameObject, "Duplicate Timeline"); } var newTimeline = USEditor.DuplicateTimeline(timeline.BaseTimeline, newTimelineContainer); USUndoManager.RegisterCreatedObjectUndo(newTimeline.gameObject, "Duplicate Timeline"); } }
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); }
private void OnGUI() { AnimationCurveEditor.AutoTangentMode = AutoTangentMode; AnimationHelper.IsInAnimationMode = IsInAnimationMode; if (!CurrentSequence) { ShowNotification(new GUIContent(USEditorUtility.SelectSequence)); } if (CurrentSequence && CurrentSequence.TimelineContainerCount <= 1) { ShowNotification(new GUIContent(USEditorUtility.NoAnimatableObjects)); } if (CurrentSequence && CurrentSequence.TimelineContainerCount > 1 && EditorApplication.timeSinceStartup - showAnimationModeTime > 3000) { RemoveNotification(); } using (new Shared.GUIBeginVertical()) { DisplayTopBar(); DisplayEdittableArea(); DisplayBottomBar(); } ProcessHotkeys(); if (Event.current.type == EventType.DragUpdated) { if (!AnimationHelper.IsInAnimationMode) { DragAndDrop.visualMode = DragAndDropVisualMode.Link; Event.current.Use(); } else { showAnimationModeTime = EditorApplication.timeSinceStartup; ShowNotification(new GUIContent(USEditorUtility.AddingNewAffectedObjectWhilstInAnimationMode)); } } if (Event.current.type == EventType.DragPerform) { if (!AnimationHelper.IsInAnimationMode) { foreach (var dragObject in DragAndDrop.objectReferences) { var GO = dragObject as GameObject; if (GO != CurrentSequence.gameObject) { DragAndDrop.AcceptDrag(); //Do we already have a timeline for this object foreach (var timelineContainer in CurrentSequence.TimelineContainers) { if (timelineContainer.AffectedObject == GO.transform) { return; } } var newTimelineContainer = CurrentSequence.CreateNewTimelineContainer(GO.transform); USUndoManager.RegisterCreatedObjectUndo(newTimelineContainer.gameObject, "Add New Timeline Container"); ContentRenderer.AddNewTimelineContainer(newTimelineContainer); } } Event.current.Use(); } } }
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); } } } }
private void DisplayTopBar() { var space = 16.0f; GUILayout.Box("", EditorStyles.toolbar, GUILayout.ExpandWidth(true), GUILayout.Height(18.0f)); if (Event.current.type == EventType.Repaint) { TopBar = GUILayoutUtility.GetLastRect(); } using (new Shared.GUIBeginArea(TopBar)) { using (new Shared.GUIBeginHorizontal()) { if (GUILayout.Button("Create New Sequence", EditorStyles.toolbarButton)) { var newSequence = new GameObject("Sequence"); USUndoManager.RegisterCreatedObjectUndo(newSequence, "Create new sequence"); var sequence = newSequence.AddComponent <USSequencer>(); sequence.Version = USUpgradePaths.CurrentVersionNumber; USUndoManager.RegisterCreatedObjectUndo(sequence, "Create new sequence"); USUndoManager.RegisterCompleteObjectUndo(newSequence, "Create new sequence"); USRuntimeUtility.CreateAndAttachObserver(sequence); if (CurrentSequence == null) { Selection.activeGameObject = newSequence; Selection.activeTransform = newSequence.transform; SequenceSwitch(sequence); } Repaint(); } var currentSequence = CurrentSequence != null ? CurrentSequence.name : ""; var label = "Select a Sequence"; if (CurrentSequence != null) { label = String.Format("Editting : {0}", currentSequence); } if (GUILayout.Button(label, EditorStyles.toolbarButton, GUILayout.Width(150.0f))) { var menu = new GenericMenu(); var sequences = FindObjectsOfType(typeof(USSequencer)) as USSequencer[]; var orderedSequences = sequences.OrderBy(sequence => sequence.name); foreach (var sequence in orderedSequences) { menu.AddItem(new GUIContent(sequence.name), currentSequence == sequence.name ? true : false, (obj) => Selection.activeGameObject = (GameObject)obj, sequence.gameObject); } menu.ShowAsContext(); } GUILayout.Space(space); GUILayout.Box("", USEditorUtility.SeperatorStyle, GUILayout.Height(18.0f)); GUILayout.Space(space); if (CurrentSequence != null) { using (new Shared.GUIChangeColor((AnimationHelper.IsInAnimationMode || IsArmed) ? Color.red : GUI.color)) { if (GUILayout.Button(new GUIContent(!CurrentSequence.IsPlaying ? USEditorUtility.PlayButton : USEditorUtility.PauseButton, "Toggle Play Mode (P)"), USEditorUtility.ToolbarButtonSmall)) { PlayOrPause(); } if (GUILayout.Button(USEditorUtility.StopButton, USEditorUtility.ToolbarButtonSmall)) { Stop(); } } using (new Shared.GUIEnable(EditorApplication.isPlaying)) { var buttonContent = new GUIContent(USEditorUtility.RecordButton, !EditorApplication.isPlaying ? "You must be in Play Mode to enable this button" : "Start g"); if (GUILayout.Button(buttonContent, USEditorUtility.ToolbarButtonSmall)) { Record(); } } GUILayout.Space(space); USUndoManager.BeginChangeCheck(); GUILayout.Button(new GUIContent(USEditorUtility.PrevKeyframeButton, "Prev Keyframe (Alt + ,)"), USEditorUtility.ToolbarButtonSmall); if (USUndoManager.EndChangeCheck()) { USUndoManager.PropertyChange(this, "Previous Keyframe"); GoToPrevKeyframe(); } USUndoManager.BeginChangeCheck(); GUILayout.Button(new GUIContent(USEditorUtility.NextKeyframeButton, "Next Keyframe (Alt + .)"), USEditorUtility.ToolbarButtonSmall); if (USUndoManager.EndChangeCheck()) { USUndoManager.PropertyChange(this, "Next Keyframe"); GoToNextKeyframe(); } GUILayout.Space(space); GUILayout.Box("", USEditorUtility.SeperatorStyle, GUILayout.Height(18.0f)); GUILayout.Space(space); EditorGUILayout.LabelField(new GUIContent("Keyframe Snap", "The amount keyframes will snap to when dragged in the uSequencer window. (Left Shift to activate)"), GUILayout.MaxWidth(100.0f)); USUndoManager.BeginChangeCheck(); var snapAmount = EditorGUILayout.FloatField(new GUIContent("", "The amount keyframes will snap to when dragged in the uSequencer window. (Left Shift to activate)"), ContentRenderer.SnapAmount, GUILayout.MaxWidth(40.0f)); if (USUndoManager.EndChangeCheck()) { USUndoManager.PropertyChange(this, "Snap Amount"); ContentRenderer.SnapAmount = snapAmount; } GUILayout.Space(space); GUILayout.Box("", USEditorUtility.SeperatorStyle, GUILayout.Height(18.0f)); GUILayout.Space(space); } GUILayout.FlexibleSpace(); if (CurrentSequence && GUILayout.Button("Duplicate Sequence", EditorStyles.toolbarButton)) { USEditorUtility.DuplicateSequence(CurrentSequence); } if (CurrentSequence && GUILayout.Button(PrefabUtility.GetPrefabObject(CurrentSequence.gameObject) ? "Update Prefab" : "Create Prefab", EditorStyles.toolbarButton)) { CurrentSequence.Stop(); StopProcessingAnimationMode(); USEditorUtility.CreatePrefabFrom(CurrentSequence, false); } } } }