|
|
|
|
|
|
|
|
|
|
using (new EditorGUILayout.HorizontalScope()) |
|
|
|
{ |
|
|
|
GUILayout.Label(Contents.star, EditorStyles.miniLabel, GUILayout.Width(24)); |
|
|
|
var b = GUI.color; |
|
|
|
GUI.color = Color.yellow * 3; |
|
|
|
if (GUILayout.Button(Contents.star, Styles.icon, GUILayout.Width(24))) |
|
|
|
{ |
|
|
|
toRemove = i; |
|
|
|
} |
|
|
|
|
|
|
|
GUI.color = b; |
|
|
|
|
|
|
|
string label = obj.name; |
|
|
|
|
|
|
|
if (GUILayout.Button(label, EditorStyles.foldout)) |
|
|
|
|
|
|
ignoreNextSelection = true; |
|
|
|
Selection.activeObject = obj; |
|
|
|
SceneView.lastActiveSceneView.FrameSelected(); |
|
|
|
} |
|
|
|
if (GUILayout.Button("X", EditorStyles.miniButton, GUILayout.Width(24))) |
|
|
|
{ |
|
|
|
toRemove = i; |
|
|
|
var rect = GUILayoutUtility.GetLastRect(); |
|
|
|
EditorGUI.DrawRect(rect, new Color(0.2f, 0.2f, 0.2f, 0.5f)); |
|
|
|
|
|
|
|
GUI.color = backup; |
|
|
|
} |
|
|
|
|
|
|
{ |
|
|
|
GUILayout.Label("History", EditorStyles.boldLabel); |
|
|
|
GUILayout.FlexibleSpace(); |
|
|
|
if (GUILayout.Button("Clear")) |
|
|
|
if (GUILayout.Button("Clear", EditorStyles.miniButton)) |
|
|
|
{ |
|
|
|
selectionHistory.Clear(); |
|
|
|
Repaint(); |
|
|
|
|
|
|
var reversedHistory = selectionHistory.Reverse<GameObject>().ToArray(); |
|
|
|
foreach (var obj in reversedHistory) |
|
|
|
{ |
|
|
|
if (obj == null) |
|
|
|
{ |
|
|
|
using (new EditorGUILayout.HorizontalScope()) |
|
|
|
{ |
|
|
|
GUILayout.Label("(object is either null or has been deleted)"); |
|
|
|
if (GUILayout.Button("X", GUILayout.Width(24))) |
|
|
|
{ |
|
|
|
toRemove = i; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
if (obj != null) |
|
|
|
{ |
|
|
|
bool highlight = Selection.gameObjects.Contains(obj); |
|
|
|
Color backup = GUI.color; |
|
|
|
|
|
|
|
|
|
|
using (new EditorGUILayout.HorizontalScope()) |
|
|
|
{ |
|
|
|
|
|
|
|
GUILayout.Space(16); |
|
|
|
|
|
|
|
if (GUILayout.Button(Contents.starDisabled, Styles.icon, GUILayout.Width(24))) |
|
|
|
{ |
|
|
|
toAdd = i; |
|
|
|
} |
|
|
|
|
|
|
|
string label = obj.name; |
|
|
|
if (GUILayout.Button(label, EditorStyles.foldout)) |
|
|
|
{ |
|
|
|
|
|
|
Selection.activeObject = obj; |
|
|
|
SceneView.lastActiveSceneView.FrameSelected(); |
|
|
|
} |
|
|
|
if (GUILayout.Button(Contents.star, Styles.historyButton, GUILayout.Width(24))) |
|
|
|
{ |
|
|
|
toAdd = i; |
|
|
|
} |
|
|
|
} |
|
|
|
var rect = GUILayoutUtility.GetLastRect(); |
|
|
|
EditorGUI.DrawRect(rect, new Color(0.2f,0.2f,0.2f,0.5f)); |
|
|
|
|
|
|
public static GUIStyle highlight; |
|
|
|
public static Color highlightColor = new Color(2.0f, 2.0f, 2.0f); |
|
|
|
|
|
|
|
public static GUIStyle icon; |
|
|
|
|
|
|
|
static Styles() |
|
|
|
{ |
|
|
|
historyButton = new GUIStyle(EditorStyles.miniButton); |
|
|
|
|
|
|
highlight.onActive.background = Texture2D.whiteTexture; |
|
|
|
highlight.onFocused.background = Texture2D.whiteTexture; |
|
|
|
|
|
|
|
icon = new GUIStyle(EditorStyles.label); |
|
|
|
icon.fixedHeight = 16; |
|
|
|
icon.padding = new RectOffset(8,2,2,0); |
|
|
|
icon.margin = new RectOffset(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
public static GUIContent star = EditorGUIUtility.IconContent("CustomSorting"); |
|
|
|
public static GUIContent star = new GUIContent(EditorGUIUtility.IconContent("Favorite Icon").image); |
|
|
|
public static GUIContent starDisabled = new GUIContent(EditorGUIUtility.IconContent("Favorite").image); |
|
|
|
} |
|
|
|
} |