I use this code to toggle off treeview animation, it works for most of the editor but there are a few stragglers, physics2d/gizmos is one of them - nuke them bugs!
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
static class TreeViewUtils
{
[MenuItem("TreeViewUtility/Toggle Animation")]
static void ToggleAnimation()
{
const string prefKey = "TreeViewExpansionAnimation";
bool newValue = !EditorPrefs.GetBool(prefKey, true);
EditorPrefs.SetBool(prefKey, newValue);
InternalEditorUtility.RequestScriptReload();
Debug.Log("TreeView animation is now " + (newValue ? "enabled" : "disabled"));
}
}