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);
            }
        }
Ejemplo n.º 2
0
 void CompleteRectSelection()
 {
     EditorApplication.modifierKeysChanged -= SendCommandsOnModifierKeys;
     m_RectSelecting = false;
     ActiveEditorTracker.delayFlushDirtyRebuild = false;
     ActiveEditorTracker.RebuildAllIfNecessary();
     m_SelectionStart = new Object[0];
     rectSelectionFinished();
 }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 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;
             }
         }
     }
 }
Ejemplo n.º 7
0
 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;
             }
         }
     }
 }
Ejemplo n.º 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);
Ejemplo n.º 11
0
 static extern void Internal_ClearDirty(ActiveEditorTracker self);
Ejemplo n.º 12
0
 static extern void Internal_SetVisible(ActiveEditorTracker self, int index, int visible);
Ejemplo n.º 13
0
 static extern int Internal_GetVisible(ActiveEditorTracker self, int index);
Ejemplo n.º 14
0
 static extern bool Internal_GetIsDirty(ActiveEditorTracker self);
Ejemplo n.º 15
0
 static extern void Internal_SetObjectsLockedByThisTrackerInternal(ActiveEditorTracker self, object toBeLocked);
Ejemplo n.º 16
0
 static extern void Internal_SetInspectorMode(ActiveEditorTracker self, InspectorMode value);
Ejemplo n.º 17
0
 internal static extern void Internal_GetActiveEditorsNonAlloc(ActiveEditorTracker self, Editor[] editors);
Ejemplo n.º 18
0
 static extern Array Internal_GetActiveEditors(ActiveEditorTracker self);
Ejemplo n.º 19
0
 static extern bool Internal_GetHasComponentsWhichCannotBeMultiEdited(ActiveEditorTracker self);
Ejemplo n.º 20
0
 static extern void Internal_Dispose(ActiveEditorTracker self);
Ejemplo n.º 21
0
 static extern void Internal_Destroy(ActiveEditorTracker self);
Ejemplo n.º 22
0
 static extern void SetupSharedTracker(ActiveEditorTracker sharedTracker);
Ejemplo n.º 23
0
 static extern void Internal_Create(ActiveEditorTracker self);
Ejemplo n.º 24
0
 static extern void Internal_ForceRebuild(ActiveEditorTracker self);
Ejemplo n.º 25
0
 static extern void Internal_VerifyModifiedMonoBehaviours(ActiveEditorTracker self);
Ejemplo n.º 26
0
        public override bool Equals(object o)
        {
            ActiveEditorTracker activeEditorTracker = o as ActiveEditorTracker;

            return(this.m_Property.m_IntPtr == activeEditorTracker.m_Property.m_IntPtr);
        }
Ejemplo n.º 27
0
 static extern void Internal_RebuildIfNecessary(ActiveEditorTracker self);
Ejemplo n.º 28
0
 static extern void Internal_GetObjectsLockedByThisTrackerInternal(ActiveEditorTracker self, [NotNull] object lockedObjects);
Ejemplo n.º 29
0
 static extern InspectorMode Internal_GetInspectorMode(ActiveEditorTracker self);
Ejemplo n.º 30
0
 static extern void Internal_SetIsLocked(ActiveEditorTracker self, bool value);
Ejemplo n.º 31
0
 static extern bool Internal_GetIsLocked(ActiveEditorTracker self);
Ejemplo n.º 32
-1
 private Editor[] GetActiveEditors()
 {
     if (this.m_Tracker == null)
     {
         this.m_Tracker = ActiveEditorTracker.sharedTracker;
     }
     return this.m_Tracker.activeEditors;
 }
Ejemplo n.º 33
-1
		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();
		}
Ejemplo n.º 34
-2
 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();
   }
 }