private void Init() { if (BlendTreeInspector.styles == null) BlendTreeInspector.styles = new BlendTreeInspector.Styles(); if ((UnityEngine.Object) this.m_BlendTree == (UnityEngine.Object) null) this.m_BlendTree = this.target as UnityEditor.Animations.BlendTree; if (BlendTreeInspector.styles == null) BlendTreeInspector.styles = new BlendTreeInspector.Styles(); if (this.m_PreviewBlendTree == null) this.m_PreviewBlendTree = new PreviewBlendTree(); if (this.m_VisBlendTree == null) this.m_VisBlendTree = new VisualizationBlendTree(); if (this.m_Childs == null) { this.m_Childs = this.serializedObject.FindProperty("m_Childs"); this.m_ReorderableList = new ReorderableList(this.serializedObject, this.m_Childs); this.m_ReorderableList.drawHeaderCallback = new ReorderableList.HeaderCallbackDelegate(this.DrawHeader); this.m_ReorderableList.drawElementCallback = new ReorderableList.ElementCallbackDelegate(this.DrawChild); this.m_ReorderableList.onReorderCallback = new ReorderableList.ReorderCallbackDelegate(this.EndDragChild); this.m_ReorderableList.onAddDropdownCallback = new ReorderableList.AddDropdownCallbackDelegate(this.AddButton); this.m_ReorderableList.onRemoveCallback = new ReorderableList.RemoveCallbackDelegate(this.RemoveButton); if (this.m_BlendType.intValue == 0) this.SortByThreshold(); this.m_ShowGraphValue = this.m_BlendType.intValue != 4 ? this.m_Childs.arraySize >= 2 : this.m_Childs.arraySize >= 1; this.m_ShowGraph.value = this.m_ShowGraphValue; this.m_ShowAdjust.value = this.AllMotions(); this.m_ShowCompute.value = !this.m_UseAutomaticThresholds.boolValue; this.m_ShowGraph.valueChanged.AddListener(new UnityAction(((Editor) this).Repaint)); this.m_ShowAdjust.valueChanged.AddListener(new UnityAction(((Editor) this).Repaint)); this.m_ShowCompute.valueChanged.AddListener(new UnityAction(((Editor) this).Repaint)); } this.m_PreviewBlendTree.Init(this.m_BlendTree, BlendTreeInspector.currentAnimator); bool flag = false; if ((UnityEngine.Object) this.m_VisInstance == (UnityEngine.Object) null) { this.m_VisInstance = EditorUtility.InstantiateForAnimatorPreview(EditorGUIUtility.Load("Avatar/DefaultAvatar.fbx")); foreach (Renderer componentsInChild in this.m_VisInstance.GetComponentsInChildren<Renderer>()) componentsInChild.enabled = false; flag = true; } this.m_VisBlendTree.Init(this.m_BlendTree, this.m_VisInstance.GetComponent<Animator>()); if (!flag || this.m_BlendType.intValue != 1 && this.m_BlendType.intValue != 2 && this.m_BlendType.intValue != 3) return; this.UpdateBlendVisualization(); this.ValidatePositions(); }
private void Init() { if (BlendTreeInspector.styles == null) { BlendTreeInspector.styles = new BlendTreeInspector.Styles(); } if (this.m_BlendTree == null) { this.m_BlendTree = (this.target as UnityEditor.Animations.BlendTree); } if (BlendTreeInspector.styles == null) { BlendTreeInspector.styles = new BlendTreeInspector.Styles(); } if (this.m_PreviewBlendTree == null) { this.m_PreviewBlendTree = new PreviewBlendTree(); } if (this.m_VisBlendTree == null) { this.m_VisBlendTree = new VisualizationBlendTree(); } if (this.m_Childs == null) { this.m_Childs = base.serializedObject.FindProperty("m_Childs"); this.m_ReorderableList = new ReorderableList(base.serializedObject, this.m_Childs); this.m_ReorderableList.drawHeaderCallback = new ReorderableList.HeaderCallbackDelegate(this.DrawHeader); this.m_ReorderableList.drawElementCallback = new ReorderableList.ElementCallbackDelegate(this.DrawChild); this.m_ReorderableList.onReorderCallback = new ReorderableList.ReorderCallbackDelegate(this.EndDragChild); this.m_ReorderableList.onAddDropdownCallback = new ReorderableList.AddDropdownCallbackDelegate(this.AddButton); this.m_ReorderableList.onRemoveCallback = new ReorderableList.RemoveCallbackDelegate(this.RemoveButton); if (this.m_BlendType.intValue == 0) { this.SortByThreshold(); } this.m_ShowGraphValue = ((this.m_BlendType.intValue != 4) ? (this.m_Childs.arraySize >= 2) : (this.m_Childs.arraySize >= 1)); this.m_ShowGraph.value = this.m_ShowGraphValue; this.m_ShowAdjust.value = this.AllMotions(); this.m_ShowCompute.value = !this.m_UseAutomaticThresholds.boolValue; this.m_ShowGraph.valueChanged.AddListener(new UnityAction(base.Repaint)); this.m_ShowAdjust.valueChanged.AddListener(new UnityAction(base.Repaint)); this.m_ShowCompute.valueChanged.AddListener(new UnityAction(base.Repaint)); } this.m_PreviewBlendTree.Init(this.m_BlendTree, BlendTreeInspector.currentAnimator); bool flag = false; if (this.m_VisInstance == null) { GameObject original = (GameObject)EditorGUIUtility.Load("Avatar/DefaultAvatar.fbx"); this.m_VisInstance = EditorUtility.InstantiateForAnimatorPreview(original); Renderer[] componentsInChildren = this.m_VisInstance.GetComponentsInChildren<Renderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { Renderer renderer = componentsInChildren[i]; renderer.enabled = false; } flag = true; } this.m_VisBlendTree.Init(this.m_BlendTree, this.m_VisInstance.GetComponent<Animator>()); if (flag && (this.m_BlendType.intValue == 1 || this.m_BlendType.intValue == 2 || this.m_BlendType.intValue == 3)) { this.UpdateBlendVisualization(); this.ValidatePositions(); } }