mirror of
https://github.com/codewriter-packages/Tri-Inspector.git
synced 2025-01-22 08:18:49 -05:00
Remove default inspector
This commit is contained in:
parent
b84d4f6060
commit
7126386a43
@ -1,13 +1,11 @@
|
|||||||
using TriInspector.Utilities;
|
using TriInspector.Utilities;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.Profiling;
|
using UnityEngine.Profiling;
|
||||||
|
|
||||||
namespace TriInspector
|
namespace TriInspector
|
||||||
{
|
{
|
||||||
public abstract class TriEditor : Editor
|
public abstract class TriEditor : Editor
|
||||||
{
|
{
|
||||||
private bool _drawDefaultInspector;
|
|
||||||
private TriPropertyTree _inspector;
|
private TriPropertyTree _inspector;
|
||||||
|
|
||||||
private void OnEnable()
|
private void OnEnable()
|
||||||
@ -33,64 +31,29 @@ namespace TriInspector
|
|||||||
|
|
||||||
serializedObject.UpdateIfRequiredOrScript();
|
serializedObject.UpdateIfRequiredOrScript();
|
||||||
|
|
||||||
DrawInspectorModeHeader();
|
Profiler.BeginSample("TriInspector.Update()");
|
||||||
|
try
|
||||||
if (_drawDefaultInspector)
|
|
||||||
{
|
{
|
||||||
DrawDefaultInspector();
|
_inspector.Update();
|
||||||
}
|
}
|
||||||
else
|
finally
|
||||||
{
|
{
|
||||||
Profiler.BeginSample("TriInspector.Update()");
|
Profiler.EndSample();
|
||||||
try
|
}
|
||||||
{
|
|
||||||
_inspector.Update();
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Profiler.EndSample();
|
|
||||||
}
|
|
||||||
|
|
||||||
TriGuiHelper.PushEditor(this);
|
TriGuiHelper.PushEditor(this);
|
||||||
Profiler.BeginSample("TriInspector.DoLayout()");
|
Profiler.BeginSample("TriInspector.DoLayout()");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_inspector.DoLayout();
|
_inspector.DoLayout();
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Profiler.EndSample();
|
Profiler.EndSample();
|
||||||
TriGuiHelper.PopEditor(this);
|
TriGuiHelper.PopEditor(this);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
serializedObject.ApplyModifiedProperties();
|
serializedObject.ApplyModifiedProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawInspectorModeHeader()
|
|
||||||
{
|
|
||||||
GUILayout.Space(5);
|
|
||||||
|
|
||||||
GUILayout.BeginHorizontal();
|
|
||||||
GUILayout.FlexibleSpace();
|
|
||||||
if (GUILayout.Toggle(!_drawDefaultInspector, "Tri Inspector", EditorStyles.miniButtonLeft))
|
|
||||||
{
|
|
||||||
_drawDefaultInspector = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GUILayout.Toggle(_drawDefaultInspector, "Default Inspector", EditorStyles.miniButtonRight))
|
|
||||||
{
|
|
||||||
_drawDefaultInspector = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
GUILayout.FlexibleSpace();
|
|
||||||
GUILayout.EndHorizontal();
|
|
||||||
|
|
||||||
GUILayout.Space(5);
|
|
||||||
|
|
||||||
var rect = EditorGUILayout.GetControlRect(false, 1);
|
|
||||||
EditorGUI.DrawRect(rect, Color.gray);
|
|
||||||
GUILayout.Space(10);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user