1.8.4: History received a fix for startup issue, increased entry size, and context menu options
- Set selection active in history is now a toggleable feature in the context menu - Increased number of entries in history from 32 to 64 - Clear entries moved to context menu in history - Fixed issue, where history didn't work on first startup
This commit is contained in:
parent
305aa13317
commit
5a2dcf3619
17 changed files with 141 additions and 86 deletions
|
|
@ -5,7 +5,7 @@ using Object = UnityEngine.Object;
|
|||
|
||||
namespace Module.NavigationTool.Editor.History
|
||||
{
|
||||
internal sealed class EditorHistoryWindow : EditorWindow
|
||||
internal sealed class EditorHistoryWindow : EditorWindow, IHasCustomMenu
|
||||
{
|
||||
[NonSerialized]
|
||||
private Styles styles;
|
||||
|
|
@ -38,8 +38,8 @@ namespace Module.NavigationTool.Editor.History
|
|||
return;
|
||||
|
||||
styles.Initialize(GUI.skin);
|
||||
var rectTools = new Rect(0.0f, 0.0f, position.width, EditorGUIUtility.singleLineHeight);
|
||||
var rectList = new Rect(0.0f, rectTools.yMax, position.width, position.height - rectTools.height);
|
||||
var rectTools = new Rect(0.0f, 4.0f, position.width, EditorGUIUtility.singleLineHeight);
|
||||
var rectList = new Rect(0.0f, rectTools.yMax + 4.0f, position.width, position.height - rectTools.height - 8.0f);
|
||||
|
||||
viewTools.Initialize();
|
||||
viewTools.Draw(this, rectTools, styles);
|
||||
|
|
@ -52,27 +52,43 @@ namespace Module.NavigationTool.Editor.History
|
|||
|
||||
private void HandleClickEvent()
|
||||
{
|
||||
if (!HistoryGUIUtility.isClicked)
|
||||
if (!EditorHistoryGUIUtility.isClicked)
|
||||
return;
|
||||
|
||||
HistoryList historyList = HistoryUtility.GetHistoryList();
|
||||
Object obj = historyList.GetObject(HistoryGUIUtility.currentEntry);
|
||||
EditorHistoryList editorHistoryList = EditorHistoryUtility.GetHistoryList();
|
||||
Object obj = editorHistoryList.GetObject(EditorHistoryGUIUtility.currentEntry);
|
||||
|
||||
if (obj != null)
|
||||
{
|
||||
if (HistoryGUIUtility.isDoubleClick)
|
||||
if (EditorHistoryGUIUtility.isDoubleClick)
|
||||
{
|
||||
AssetDatabase.OpenAsset(obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
HistoryListPostProcess.IgnoreNextSelectionChange();
|
||||
Selection.activeObject = obj;
|
||||
EditorHistoryListPostProcess.IgnoreNextSelectionChange();
|
||||
|
||||
if (EditorHistoryPrefs.IsSetAsActiveObjectEnabled)
|
||||
Selection.activeObject = obj;
|
||||
|
||||
EditorGUIUtility.PingObject(obj);
|
||||
}
|
||||
}
|
||||
|
||||
HistoryGUIUtility.Used();
|
||||
EditorHistoryGUIUtility.Used();
|
||||
}
|
||||
|
||||
void IHasCustomMenu.AddItemsToMenu(GenericMenu menu)
|
||||
{
|
||||
menu.AddItem(new GUIContent("Clear"),
|
||||
false,
|
||||
() => EditorHistoryUtility.GetHistoryList()?.Clear());
|
||||
|
||||
menu.AddSeparator("");
|
||||
|
||||
menu.AddItem(new GUIContent("Active object in selection"),
|
||||
EditorHistoryPrefs.IsSetAsActiveObjectEnabled,
|
||||
() => EditorHistoryPrefs.IsSetAsActiveObjectEnabled = !EditorHistoryPrefs.IsSetAsActiveObjectEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue