void SetSelectModel(string modelPath) { try { BindingFlags flags = BindingFlags.NonPublic | BindingFlags.Instance; Type inspectorWindowType = typeof(EditorWindow).Assembly.GetType("UnityEditor.InspectorWindow"); EditorWindow inspectorWindow = EditorWindow.GetWindow(inspectorWindowType); var getEditorsWithPreviews = inspectorWindowType.GetMethod("GetEditorsWithPreviews", flags); ActiveEditorTracker tracker = inspectorWindowType.GetMethod("get_tracker", flags).Invoke(inspectorWindow, new System.Object[] { }) as ActiveEditorTracker; if (getEditorsWithPreviews == null || tracker == null) { return; } var editorsWithPreviews = getEditorsWithPreviews.Invoke(inspectorWindow, new System.Object[] { tracker.activeEditors }); var getEditorThatControlsPreview = inspectorWindowType.GetMethod("GetEditorThatControlsPreview", flags); var editor = getEditorThatControlsPreview.Invoke(inspectorWindow, new System.Object[] { editorsWithPreviews }); Type animationClipEditorType = typeof(EditorWindow).Assembly.GetType("UnityEditor.AnimationClipEditor"); var avatarPreview = animationClipEditorType.GetField("m_AvatarPreview", flags).GetValue(editor); GameObject prefab = AssetDatabase.LoadAssetAtPath <GameObject>(modelPath); Type avatarPreviewType = typeof(EditorWindow).Assembly.GetType("UnityEditor.AvatarPreview"); var setPreviewFunc = avatarPreviewType.GetMethod("SetPreview", flags); setPreviewFunc.Invoke(avatarPreview, new System.Object[] { prefab }); } catch (Exception exception) { Debug.LogError(exception); } }
void CompleteRectSelection() { EditorApplication.modifierKeysChanged -= SendCommandsOnModifierKeys; m_RectSelecting = false; ActiveEditorTracker.delayFlushDirtyRebuild = false; ActiveEditorTracker.RebuildAllIfNecessary(); m_SelectionStart = new Object[0]; rectSelectionFinished(); }
public void HandleDraggingToBottomArea(Rect bottomRect, ActiveEditorTracker tracker) { int lastIndex = this.m_LastIndex; if (lastIndex >= 0 && lastIndex < tracker.activeEditors.Length) { this.HandleEditorDragging(lastIndex, bottomRect, this.m_LastMarkerY, true, tracker); } }
public void HandleDraggingToBottomArea(Rect bottomRect, ActiveEditorTracker tracker) { var editorIndex = m_LastIndex; if (editorIndex >= 0 && editorIndex < tracker.activeEditors.Length) { HandleEditorDragging(editorIndex, bottomRect, m_LastMarkerY, true, tracker); } }
bool IsPartOfLockedInspector() { foreach (InspectorWindow i in InspectorWindow.GetAllInspectorWindows()) { ActiveEditorTracker activeEditor = i.tracker; foreach (Editor e in activeEditor.activeEditors) { if (e == this && i.isLocked) { return(true); } } } return(false); }
private void ChangeInspectorLock(bool locked) { foreach (InspectorWindow window in InspectorWindow.GetAllInspectorWindows()) { ActiveEditorTracker tracker = window.tracker; foreach (Editor editor in tracker.activeEditors) { if (editor == this) { this.m_InspectorLocked = window.isLocked; window.isLocked = locked; } } } }
void ChangeInspectorLock(bool locked) { foreach (InspectorWindow i in InspectorWindow.GetAllInspectorWindows()) { ActiveEditorTracker activeEditor = i.tracker; foreach (Editor e in activeEditor.activeEditors) { if (e == this) { m_InspectorLocked = i.isLocked; i.isLocked = locked; } } } }
private void ChangeInspectorLock(bool locked) { InspectorWindow[] allInspectorWindows = InspectorWindow.GetAllInspectorWindows(); for (int i = 0; i < allInspectorWindows.Length; i++) { InspectorWindow inspectorWindow = allInspectorWindows[i]; ActiveEditorTracker tracker = inspectorWindow.tracker; Editor[] activeEditors = tracker.activeEditors; for (int j = 0; j < activeEditors.Length; j++) { Editor x = activeEditors[j]; if (x == this) { this.m_InspectorLocked = inspectorWindow.isLocked; inspectorWindow.isLocked = locked; } } } }
internal static void DirtyLivePropertyChanges(ActiveEditorTracker tracker) { if (!EditorApplication.isPlaying || s_LivePropertyOverrideCallbacks.Count <= 0) { return; } var editors = tracker.activeEditors; for (var i = 0; i != editors.Length; i++) { if (tracker.GetVisible(i) == 0) { continue; } // Callback var editor = editors[i]; if (IsLivePropertyChanged(editor)) { editor.isInspectorDirty = true; } } }
private static extern void SetupSharedTracker(ActiveEditorTracker sharedTracker);
static extern void Internal_ClearDirty(ActiveEditorTracker self);
static extern void Internal_SetVisible(ActiveEditorTracker self, int index, int visible);
static extern int Internal_GetVisible(ActiveEditorTracker self, int index);
static extern bool Internal_GetIsDirty(ActiveEditorTracker self);
static extern void Internal_SetObjectsLockedByThisTrackerInternal(ActiveEditorTracker self, object toBeLocked);
static extern void Internal_SetInspectorMode(ActiveEditorTracker self, InspectorMode value);
internal static extern void Internal_GetActiveEditorsNonAlloc(ActiveEditorTracker self, Editor[] editors);
static extern Array Internal_GetActiveEditors(ActiveEditorTracker self);
static extern bool Internal_GetHasComponentsWhichCannotBeMultiEdited(ActiveEditorTracker self);
static extern void Internal_Dispose(ActiveEditorTracker self);
static extern void Internal_Destroy(ActiveEditorTracker self);
static extern void SetupSharedTracker(ActiveEditorTracker sharedTracker);
static extern void Internal_Create(ActiveEditorTracker self);
static extern void Internal_ForceRebuild(ActiveEditorTracker self);
static extern void Internal_VerifyModifiedMonoBehaviours(ActiveEditorTracker self);
public override bool Equals(object o) { ActiveEditorTracker activeEditorTracker = o as ActiveEditorTracker; return(this.m_Property.m_IntPtr == activeEditorTracker.m_Property.m_IntPtr); }
static extern void Internal_RebuildIfNecessary(ActiveEditorTracker self);
static extern void Internal_GetObjectsLockedByThisTrackerInternal(ActiveEditorTracker self, [NotNull] object lockedObjects);
static extern InspectorMode Internal_GetInspectorMode(ActiveEditorTracker self);
static extern void Internal_SetIsLocked(ActiveEditorTracker self, bool value);
static extern bool Internal_GetIsLocked(ActiveEditorTracker self);
private Editor[] GetActiveEditors() { if (this.m_Tracker == null) { this.m_Tracker = ActiveEditorTracker.sharedTracker; } return this.m_Tracker.activeEditors; }
protected virtual void CreateTracker() { if (this.m_Tracker != null) { this.m_Tracker.inspectorMode = this.m_InspectorMode; return; } ActiveEditorTracker sharedTracker = ActiveEditorTracker.sharedTracker; bool flag = InspectorWindow.m_AllInspectors.Any((InspectorWindow i) => i.m_Tracker != null && i.m_Tracker.Equals(sharedTracker)); this.m_Tracker = ((!flag) ? ActiveEditorTracker.sharedTracker : new ActiveEditorTracker()); this.m_Tracker.inspectorMode = this.m_InspectorMode; this.m_Tracker.RebuildIfNecessary(); }
protected virtual void CreateTracker() { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type InspectorWindow.\u003CCreateTracker\u003Ec__AnonStorey91 trackerCAnonStorey91 = new InspectorWindow.\u003CCreateTracker\u003Ec__AnonStorey91(); if (this.m_Tracker != null) { this.m_Tracker.inspectorMode = this.m_InspectorMode; } else { // ISSUE: reference to a compiler-generated field trackerCAnonStorey91.sharedTracker = ActiveEditorTracker.sharedTracker; // ISSUE: reference to a compiler-generated method this.m_Tracker = !InspectorWindow.m_AllInspectors.Any<InspectorWindow>(new Func<InspectorWindow, bool>(trackerCAnonStorey91.\u003C\u003Em__160)) ? ActiveEditorTracker.sharedTracker : new ActiveEditorTracker(); this.m_Tracker.inspectorMode = this.m_InspectorMode; this.m_Tracker.RebuildIfNecessary(); } }