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);
            }
        }
Exemple #2
0
 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);
            }
        }
Exemple #4
0
        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);
            }
        }
Exemple #5
0
 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);
 }
Exemple #6
0
 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;
             }
         }
     }
 }
Exemple #8
0
 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);
Exemple #11
0
 static extern void Internal_ClearDirty(ActiveEditorTracker self);
Exemple #12
0
 static extern void Internal_SetVisible(ActiveEditorTracker self, int index, int visible);
Exemple #13
0
 static extern int Internal_GetVisible(ActiveEditorTracker self, int index);
Exemple #14
0
 static extern bool Internal_GetIsDirty(ActiveEditorTracker self);
Exemple #15
0
 static extern void Internal_SetObjectsLockedByThisTrackerInternal(ActiveEditorTracker self, object toBeLocked);
Exemple #16
0
 static extern void Internal_SetInspectorMode(ActiveEditorTracker self, InspectorMode value);
Exemple #17
0
 internal static extern void Internal_GetActiveEditorsNonAlloc(ActiveEditorTracker self, Editor[] editors);
Exemple #18
0
 static extern Array Internal_GetActiveEditors(ActiveEditorTracker self);
Exemple #19
0
 static extern bool Internal_GetHasComponentsWhichCannotBeMultiEdited(ActiveEditorTracker self);
Exemple #20
0
 static extern void Internal_Dispose(ActiveEditorTracker self);
Exemple #21
0
 static extern void Internal_Destroy(ActiveEditorTracker self);
Exemple #22
0
 static extern void SetupSharedTracker(ActiveEditorTracker sharedTracker);
Exemple #23
0
 static extern void Internal_Create(ActiveEditorTracker self);
Exemple #24
0
 static extern void Internal_ForceRebuild(ActiveEditorTracker self);
Exemple #25
0
 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);
        }
Exemple #27
0
 static extern void Internal_RebuildIfNecessary(ActiveEditorTracker self);
Exemple #28
0
 static extern void Internal_GetObjectsLockedByThisTrackerInternal(ActiveEditorTracker self, [NotNull] object lockedObjects);
Exemple #29
0
 static extern InspectorMode Internal_GetInspectorMode(ActiveEditorTracker self);
Exemple #30
0
 static extern void Internal_SetIsLocked(ActiveEditorTracker self, bool value);
Exemple #31
0
 static extern bool Internal_GetIsLocked(ActiveEditorTracker self);
Exemple #32
-1
 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();
   }
 }