void InitializeStateChange() { state.OnPlayStateChange += OnPreviewPlayModeChanged; state.OnDirtyStampChange += OnStateChange; state.OnBeforeSequenceChange += OnBeforeSequenceChange; state.OnAfterSequenceChange += OnAfterSequenceChange; state.OnRebuildGraphChange += () => { // called when the graph is rebuild, since the UI tree isn't necessarily rebuilt. if (!state.rebuildGraph) { // send callbacks to the tacks if (treeView != null) { var allTrackGuis = treeView.allTrackGuis; if (allTrackGuis != null) { for (int i = 0; i < allTrackGuis.Count; i++) { allTrackGuis[i].OnGraphRebuilt(); } } } } }; state.OnTimeChange += () => { if (EditorApplication.isPlaying == false) { state.UpdateRecordingState(); EditorApplication.SetSceneRepaintDirty(); } if (state.ignorePreview && state.IsPlayableGraphDone()) { state.Pause(); } // the time is sync'd prior to the callback state.Evaluate(); // will do the repaint InspectorWindow.RepaintAllInspectors(); }; state.OnRecordingChange += () => { if (!state.recording) { TrackAssetRecordingExtensions.ClearRecordingState(); } }; }
private static InspectorWindow FirstInspectorWithGameObject() { foreach (var insp in InspectorWindow.GetInspectors()) { if (insp.GetInspectedObject() is GameObject) { return(insp); } } return(null); }
void OnTimeReferenceModeChanged() { m_TimeAreaDirty = true; InitTimeAreaFrameRate(); SyncTimeAreaShownRange(); foreach (var inspector in InspectorWindow.GetAllInspectorWindows()) { inspector.Repaint(); } }
static void OnVCTaskCompletedEvent(Task task, CompletionAction completionAction) { // inspector should re-calculate which VCS buttons it needs to show InspectorWindow.ClearVersionControlBarState(); var wins = Resources.FindObjectsOfTypeAll(typeof(WindowPending)) as WindowPending[]; foreach (WindowPending win in wins) { switch (completionAction) { case CompletionAction.UpdatePendingWindow: // fallthrough case CompletionAction.OnCheckoutCompleted: win.UpdateWindow(); break; case CompletionAction.OnChangeContentsPendingWindow: win.OnChangeContents(task); break; case CompletionAction.OnIncomingPendingWindow: win.OnIncoming(task); break; case CompletionAction.OnChangeSetsPendingWindow: win.OnChangeSets(task); break; case CompletionAction.OnGotLatestPendingWindow: win.OnGotLatest(task); break; } } switch (completionAction) { case CompletionAction.OnSubmittedChangeWindow: WindowChange.OnSubmitted(task); break; case CompletionAction.OnAddedChangeWindow: WindowChange.OnAdded(task); break; case CompletionAction.OnCheckoutCompleted: if (EditorUserSettings.showFailedCheckout) { WindowCheckoutFailure.OpenIfCheckoutFailed(task.assetList); } break; } task.Dispose(); }
void OnCurveModified(AnimationClip clip, EditorCurveBinding binding, AnimationUtility.CurveModifiedType type) { InspectorWindow.RepaintAllInspectors(); if (state == null || state.rebuildGraph) { return; } //Force refresh of curve when modified by another editor. Repaint(); if (state.previewMode == false) { return; } bool hasPlayable = m_PlayableLookup.GetPlayableFromAnimClip(clip, out Playable playable); // mark the timeline clip as dirty TimelineClip timelineClip = m_PlayableLookup.GetTimelineClipFromCurves(clip); if (timelineClip != null) { timelineClip.MarkDirty(); } if (type == AnimationUtility.CurveModifiedType.CurveModified) { if (hasPlayable) { playable.SetAnimatedProperties(clip); } // updates the duration of the graph without rebuilding AnimationUtility.SyncEditorCurves(clip); // deleted keys are not synced when this is sent out, so duration could be incorrect state.UpdateRootPlayableDuration(state.editSequence.duration); bool isRecording = TimelineRecording.IsRecordingAnimationTrack; PlayableDirector masterDirector = TimelineEditor.masterDirector; bool isGraphValid = masterDirector != null && masterDirector.playableGraph.IsValid(); // don't evaluate if this is caused by recording on an animation track, the extra evaluation can cause hiccups // Prevent graphs to be resurrected by a changed clip. if (!isRecording && isGraphValid) { state.Evaluate(); } } else if (EditorUtility.IsDirty(clip)) // curve added/removed, or clip added/removed { state.rebuildGraph |= timelineClip != null || hasPlayable; } }
public static void UpdateAllWindows() { // inspector should re-calculate which VCS buttons it needs to show InspectorWindow.ClearVersionControlBarState(); var wins = Resources.FindObjectsOfTypeAll(typeof(WindowPending)) as WindowPending[]; foreach (WindowPending win in wins) { win.UpdateWindow(); } }
public void Repaint(RepaintFlags flags) { if ((flags & RepaintFlags.UI) != 0) { InspectorWindow.RepaintAllInspectors(); } if ((flags & RepaintFlags.Scene) != 0) { EditorApplication.SetSceneRepaintDirty(); } }
public static void Inject() { AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; var inspectorWinow = new InspectorWindow(); ServiceLocator.RegisterInstance <InspectorWindow>(inspectorWinow); if (Application.Current != null && Application.Current.MainWindow != null) { inspectorWinow.Owner = Application.Current.MainWindow; } inspectorWinow.Show(); }
/// <summary> /// Inspector menu item clicked - open the inspector window /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void _InspectorClick(object sender, RoutedEventArgs e) { Window win = new InspectorWindow() { DataContext = new InspectorWindowVM(_VM.Settings) }; // open it with show to allow for both appium and inspector windows to be moveable and clickable win.Show(); _VM.IsInspectorWindowOpen = true; win.Closed += _VM.OnInspectorWindowClosed; }
// Token: 0x06001132 RID: 4402 RVA: 0x00070FEC File Offset: 0x0006F3EC protected void handleItemButtonClicked(Sleek2ImageButton button) { IDevkitHierarchyItem item = (button as HierarchyItemButton).item; InspectorWindow.inspect(item); Component component = item as Component; if (component != null) { DevkitSelectionManager.select(new DevkitSelection(component.gameObject, component.GetComponent <Collider>())); } }
public static void SetLockState(IEnumerable <TrackAsset> tracks, bool shouldLock) { if (!tracks.Any()) { return; } foreach (var track in tracks) { if (TimelineUtility.IsLockedFromGroup(track)) { continue; } if (track as GroupTrack == null) { SetLockState(track.GetChildTracks().ToArray(), shouldLock); } TimelineUndo.PushUndo(track, L10n.Tr("Lock Tracks")); track.locked = shouldLock; } // find the tracks we've locked. unselect anything locked and remove recording. foreach (var track in tracks) { if (TimelineUtility.IsLockedFromGroup(track) || !track.locked) { continue; } var flattenedChildTracks = track.GetFlattenedChildTracks(); foreach (var i in track.clips) { SelectionManager.Remove(i); } track.UnarmForRecord(); foreach (var child in flattenedChildTracks) { SelectionManager.Remove(child); child.UnarmForRecord(); foreach (var clip in child.GetClips()) { SelectionManager.Remove(clip); } } } // no need to rebuild, just repaint (including inspectors) InspectorWindow.RepaintAllInspectors(); TimelineEditor.Refresh(RefreshReason.WindowNeedsRedraw); }
public void ShowViewInspector(object e) { InspectorWindow inspectorWindow = new InspectorWindow(); InspectorViewModel inspectorViewModel = new InspectorViewModel(); inspectorViewModel.Inspectors = Inspectors; inspectorViewModel.InspectorWindow = inspectorWindow; inspectorWindow.DataContext = inspectorViewModel; if (inspectorWindow.ShowDialog() != true) { Init(); } }
public override void OnSelectionChanged(Preset selection) { if (selection == null) { RevertValues(); } else { ApplyValues(selection); } InspectorWindow.RepaintAllInspectors(); SettingsService.RepaintAllSettingsWindow(); }
private void UpdateStateMachineSelection() { AnimatorStateMachine activeStateMachine = this.stateMachineGraph.activeStateMachine; AnimatorStateMachine animatorStateMachine = this.m_BreadCrumbs.Last <AnimatorControllerTool.BreadCrumbElement>().target as AnimatorStateMachine; if (animatorStateMachine != activeStateMachine && animatorStateMachine != null) { this.stateMachineGraph.SetStateMachines(animatorStateMachine, this.GetParentStateMachine(), this.m_BreadCrumbs.First <AnimatorControllerTool.BreadCrumbElement>().target as AnimatorStateMachine); this.stateMachineGraphGUI.ClearSelection(); this.blendTreeGraphGUI.ClearSelection(); InspectorWindow.RepaintAllInspectors(); } }
internal static void SaveUnappliedTextureImporterSettings() { foreach (InspectorWindow allInspectorWindow in InspectorWindow.GetAllInspectorWindows()) { foreach (Editor activeEditor in allInspectorWindow.GetTracker().activeEditors) { TextureImporterInspector importerInspector = activeEditor as TextureImporterInspector; if (!((UnityEngine.Object)importerInspector == (UnityEngine.Object)null) && importerInspector.HasModified() && EditorUtility.DisplayDialog("Unapplied import settings", "Unapplied import settings for '" + (importerInspector.target as TextureImporter).assetPath + "'", "Apply", "Revert")) { importerInspector.ApplyAndImport(); } } } }
public static void SetLockState(TrackAsset[] tracks, bool shouldLock, WindowState state = null) { if (tracks.Length == 0) { return; } foreach (var track in tracks) { if (track.parentLocked) { continue; } TimelineUndo.PushUndo(track, "Lock Tracks"); track.locked = shouldLock; } if (state != null) { // find the tracks we've locked. unselect anything locked and remove recording. foreach (var track in tracks) { if (track.parentLocked || !track.locked) { continue; } var flattenedChildTracks = track.GetFlattenedChildTracks(); foreach (var i in track.clips) { SelectionManager.Remove(i); } state.UnarmForRecord(track); foreach (var child in flattenedChildTracks) { SelectionManager.Remove(child); state.UnarmForRecord(child); foreach (var clip in child.GetClips()) { SelectionManager.Remove(clip); } } } // no need to rebuild, just repaint (including inspectors) InspectorWindow.RepaintAllInspectors(); state.editorWindow.Repaint(); } }
public static void ResetClipOffsets(TimelineClip[] clips) { foreach (var clip in clips) { var asset = clip.asset as AnimationPlayableAsset; if (asset != null) { asset.ResetOffsets(); } } InspectorWindow.RepaintAllInspectors(); TimelineEditor.Refresh(RefreshReason.ContentsModified); }
static void ResetClipOffsets(WindowState state, TimelineClip[] clips) { foreach (var clip in clips) { if (clip.asset is AnimationPlayableAsset) { var playableAsset = (AnimationPlayableAsset)clip.asset; playableAsset.ResetOffsets(); } } state.rebuildGraph = true; InspectorWindow.RepaintAllInspectors(); TimelineEditor.Refresh(RefreshReason.SceneNeedsUpdate); }
internal static void EditModeToolStateChanged(IToolModeOwner owner, SceneViewEditMode mode) { // In cases of domain reloads the EditorTool can be deserialized prior to the target Inspector being // created. The EditMode tools do not expect an editModeStarted callback on reloads. if (owner == null && mode != SceneViewEditMode.None) { editMode = mode; return; } IToolModeOwner oldOwner = InternalEditorUtility.GetObjectFromInstanceID(ownerID) as IToolModeOwner; editMode = mode; if (oldOwner != null) { if (onEditModeEndDelegate != null && oldOwner is Editor) { onEditModeEndDelegate(oldOwner as Editor); } if (editModeEnded != null) { editModeEnded(oldOwner); } } ownerID = mode != SceneViewEditMode.None ? owner.GetInstanceID() : k_OwnerIdNone; if (editMode != SceneViewEditMode.None) { if (onEditModeStartDelegate != null && owner is Editor) { onEditModeStartDelegate(owner as Editor, editMode); } if (editModeStarted != null) { editModeStarted(owner, editMode); } } FocusEditModeToolTarget((mode != SceneViewEditMode.None && owner != null) ? owner.GetWorldBoundsOfTargets() : new Bounds(Vector3.zero, Vector3.positiveInfinity)); InspectorWindow.RepaintAllInspectors(); }
public override void OnSelectionChanged(Preset selection) { if (selection == null) { RevertValues(); } else { Undo.RecordObjects(m_Targets, "Apply Preset " + selection.name); foreach (var target in m_Targets) { selection.ApplyTo(target); } } InspectorWindow.RepaintAllInspectors(); }
void OnCurveModified(AnimationClip clip, EditorCurveBinding binding, AnimationUtility.CurveModifiedType type) { InspectorWindow.RepaintAllInspectors(); if (state == null || state.rebuildGraph) { return; } //Force refresh of curve when modified by another editor. Repaint(); if (state.previewMode == false) { return; } if (type == AnimationUtility.CurveModifiedType.CurveModified) { Playable playable; if (m_PlayableLookup.GetPlayableFromAnimClip(clip, out playable)) { playable.SetAnimatedProperties(clip); } // mark the timeline clip as dirty TimelineClip timelineClip = m_PlayableLookup.GetTimelineClipFromCurves(clip); if (timelineClip != null) { timelineClip.MarkDirty(); } // updates the duration of the graph without rebuilding AnimationUtility.SyncEditorCurves(clip); // deleted keys are not synced when this is sent out, so duration could be incorrect state.UpdateRootPlayableDuration(state.editSequence.duration); // don't evaluate if this is caused by recording on an animation track, the extra evaluation can cause hiccups if (!TimelineRecording.IsRecordingAnimationTrack) { state.Evaluate(); } } else // curve added/removed, or clip added/removed { state.rebuildGraph = true; } }
private static void ChangeEditMode(SceneViewEditMode mode, Bounds bounds, Editor caller) { Editor objectFromInstanceID = InternalEditorUtility.GetObjectFromInstanceID(ownerID) as Editor; editMode = mode; ownerID = (mode == SceneViewEditMode.None) ? 0 : caller.GetInstanceID(); if (onEditModeEndDelegate != null) { onEditModeEndDelegate(objectFromInstanceID); } if ((editMode != SceneViewEditMode.None) && (onEditModeStartDelegate != null)) { onEditModeStartDelegate(caller, editMode); } EditModeChanged(bounds); InspectorWindow.RepaintAllInspectors(); }
private static void ChangeEditMode(EditMode.SceneViewEditMode mode, Bounds bounds, Editor caller) { Editor editor = InternalEditorUtility.GetObjectFromInstanceID(EditMode.ownerID) as Editor; EditMode.editMode = mode; EditMode.ownerID = ((mode == EditMode.SceneViewEditMode.None) ? 0 : caller.GetInstanceID()); if (EditMode.onEditModeEndDelegate != null) { EditMode.onEditModeEndDelegate(editor); } if (EditMode.editMode != EditMode.SceneViewEditMode.None && EditMode.onEditModeStartDelegate != null) { EditMode.onEditModeStartDelegate(caller, EditMode.editMode); } EditMode.EditModeChanged(bounds); InspectorWindow.RepaintAllInspectors(); }
internal EditorElement(int editorIndex, InspectorWindow iw) { m_EditorIndex = editorIndex; inspectorWindow = iw; Init(); Add(m_Header); // If the editor targets contain many target and the multi editing is not supported, we should not add this inspector. // However, the header and footer are kept since these are showing information regarding this state. if ((editor.targets.Length <= 1) || (iw.IsMultiEditingSupported(editor, editor.target))) { Add(m_InspectorElement); } Add(m_Footer); }
bool DrawEditorLargeHeader(ref bool wasVisible) { if (!IsEditorValid()) { return(true); } bool largeHeader = InspectorWindow.EditorHasLargeHeader(m_EditorIndex, m_Editors); // Draw large headers before we do the culling of unsupported editors below, // so the large header is always shown even when the editor can't be. if (largeHeader) { String message = String.Empty; bool IsOpenForEdit = editor.IsOpenForEdit(out message); wasVisible = true; if (inspectorWindow.editorsWithImportedObjectLabel.Contains(m_EditorIndex)) { var importedObjectBarRect = GUILayoutUtility.GetRect(16, 20); importedObjectBarRect.height = 21; var headerText = "Imported Object"; if (m_Editors.Length > 1) { if (m_Editors[0] is PrefabImporterEditor && m_Editors[1] is GameObjectInspector) { headerText = "Root in Prefab Asset"; } } GUILayout.Label(headerText, Styles.importedObjectsHeaderStyle, GUILayout.ExpandWidth(true)); GUILayout.Space(-7f); // Ensures no spacing between this header and the next header } // Header using (new EditorGUI.DisabledScope(!IsOpenForEdit)) // Only disable the entire header if the asset is locked by VCS { editor.DrawHeader(); } } return(largeHeader); }
public static bool beginSelection(DevkitSelection select) { if (select.gameObject == null) { return(false); } DevkitSelectionManager.data.collider = select.collider; DevkitSelectionManager.beginSelectionHandlers.Clear(); select.gameObject.GetComponentsInChildren <IDevkitInteractableBeginSelectionHandler>(DevkitSelectionManager.beginSelectionHandlers); foreach (IDevkitInteractableBeginSelectionHandler devkitInteractableBeginSelectionHandler in DevkitSelectionManager.beginSelectionHandlers) { devkitInteractableBeginSelectionHandler.beginSelection(DevkitSelectionManager.data); } if (DevkitSelectionManager.beginSelectionHandlers.Count > 0) { InspectorWindow.inspect(DevkitSelectionManager.beginSelectionHandlers[0]); } return(DevkitSelectionManager.beginSelectionHandlers.Count > 0); }
private void HandleSelectTool() { Event evt = Event.current; if (evt.type == EventType.MouseDown && evt.button == 0 && !evt.alt && (TilemapEditorTool.IsActive(typeof(SelectTool)) || (TilemapEditorTool.IsActive(typeof(MoveTool)) && evt.control))) { if (TilemapEditorTool.IsActive(typeof(MoveTool)) && evt.control) { TilemapEditorTool.SetActiveEditorTool(typeof(SelectTool)); } m_PreviousMove = null; m_MarqueeStart = mouseGridPosition; m_MarqueeType = MarqueeType.Select; s_LastActivePaintableGrid = this; GUIUtility.hotControl = m_PermanentControlID; Event.current.Use(); } if (evt.rawType == EventType.MouseUp && evt.button == 0 && !evt.alt && m_MarqueeStart.HasValue && isHotControl && TilemapEditorTool.IsActive(typeof(SelectTool))) { // Check if event only occurred in the PaintableGrid window as evt.type will filter for this if (evt.type == EventType.MouseUp && m_MarqueeType == MarqueeType.Select) { RectInt rect = GridEditorUtility.GetMarqueeRect(m_MarqueeStart.Value, mouseGridPosition); Select(new BoundsInt(new Vector3Int(rect.xMin, rect.yMin, zPosition), new Vector3Int(rect.size.x, rect.size.y, 1))); Event.current.Use(); } if (evt.control) { TilemapEditorTool.SetActiveEditorTool(typeof(MoveTool)); } m_MarqueeStart = null; m_MarqueeType = MarqueeType.None; InspectorWindow.RepaintAllInspectors(); GUIUtility.hotControl = 0; } if (evt.type == EventType.KeyDown && evt.keyCode == KeyCode.Escape && !m_MarqueeStart.HasValue && !m_PreviousMove.HasValue) { ClearGridSelection(); Event.current.Use(); } }
// Revert a list of files static public void Open(AssetList assets) { InspectorWindow.ApplyChanges(); Task task = Provider.Status(assets); task.Wait(); const bool includeFolders = true; AssetList revert = task.assetList.Filter(includeFolders, Asset.States.CheckedOutLocal, Asset.States.DeletedLocal, Asset.States.AddedLocal, //Asset.States.Branch, //Asset.States.Integrate, Asset.States.Missing); GetWindow().DoOpen(revert); }
internal static void MatchClipsToNext(TimelineClip[] clips) { if (!EnforcePreviewMode()) { return; } clips = clips.OrderByDescending(x => x.start).ToArray(); foreach (var clip in clips) { var sceneObject = TimelineUtility.GetSceneGameObject(TimelineEditor.inspectedDirector, clip.GetParentTrack()); if (sceneObject != null) { TimelineAnimationUtilities.MatchNext(clip, sceneObject.transform, TimelineEditor.inspectedDirector); } } InspectorWindow.RepaintAllInspectors(); TimelineEditor.Refresh(RefreshReason.ContentsModified); }
private UndoPropertyModification[] RegisterCandidates(UndoPropertyModification[] modifications) { bool flag = this.m_CandidateClip == null; if (flag) { this.m_CandidateClip = new AnimationClip(); this.m_CandidateClip.legacy = this.state.activeAnimationClip.legacy; this.m_CandidateClip.name = "CandidateClip"; this.StartCandidateRecording(); } AnimationWindowControl.CandidateRecordingState candidateRecordingState = new AnimationWindowControl.CandidateRecordingState(this.state, this.m_CandidateClip); UndoPropertyModification[] array = AnimationRecording.Process(candidateRecordingState, modifications); if (flag && array.Length == modifications.Length) { this.ClearCandidates(); } InspectorWindow.RepaintAllInspectors(); return(array); }