浏览代码

Fixed huge performance drop because of string filters.

/main
Thomas ICHÉ 5 年前
当前提交
ced89356
共有 1 个文件被更改,包括 20 次插入8 次删除
  1. 28
      Editor/CallTree/CallTreeWindow.cs

28
Editor/CallTree/CallTreeWindow.cs


ReloadCallHierarchy();
}
GUILayout.FlexibleSpace();
m_TreeView.stringFilter = EditorGUILayout.DelayedTextField(m_TreeView.stringFilter, EditorStyles.toolbarSearchField);
EditorGUI.BeginChangeCheck();
string filter = EditorGUILayout.DelayedTextField(m_TreeView.stringFilter, EditorStyles.toolbarSearchField);
if(EditorGUI.EndChangeCheck())
{
m_TreeView.SetStringFilter(filter);
}
Rect buttonRect = GUILayoutUtility.GetRect(52, 16);
if (GUI.Button(buttonRect, "Filter", EditorStyles.toolbarDropDown))

m_TreeView.SetAutoFilter(false);
m_TreeView.SetFilter(Selection.activeGameObject);
m_TreeView.SetObjectFilter(Selection.activeGameObject);
m_TreeView.SetFilter(null);
m_TreeView.stringFilter = string.Empty;
m_TreeView.SetObjectFilter(null);
m_TreeView.SetStringFilter(string.Empty);
});
menu.AddSeparator("");
menu.AddItem(new GUIContent("Automatic Filter"), m_TreeView.AutoFilter, () => {

m_Bindings = new Dictionary<int, CallTreeNode>();
}
public string stringFilter { get { return m_StringFilter; } set { m_StringFilter = value; this.Reload(); } }
public string stringFilter { get { return m_StringFilter; } }
[SerializeField]
GameObject m_filter = null;

Selection.selectionChanged += UpdateAutoFilter;
if(this.HasSelection())
{
SetFilter(m_Bindings[this.GetSelection()[0]].Target.gameObject);
SetObjectFilter(m_Bindings[this.GetSelection()[0]].Target.gameObject);
}
}
else

void UpdateAutoFilter()
{
if (Selection.activeGameObject != null)
SetFilter(Selection.activeGameObject);
SetObjectFilter(Selection.activeGameObject);
public void SetFilter(GameObject filter = null)
public void SetObjectFilter(GameObject filter = null)
Reload();
}
public void SetStringFilter(string stringFilter)
{
m_StringFilter = stringFilter;
Reload();
}

正在加载...
取消
保存