// Recreate the control variables window public void RefreshVariablesWindow() { if (m_editorWindow == null) { return; } Rect winPos = m_editorWindow.position; Rect rect = new Rect(-5, winPos.height - 200, 230, 115); if (m_selectedAnimationTree != null) { bool selected = false; if ( ActiveWindow == m_controlVarsWindow && ActiveWindow != null ) { selected = true; } m_controlVarsWindow = new ControlVariablesWindow(rect, m_selectedAnimationTree.m_controlVarsNode); m_Windows.Add(m_controlVarsWindow); if (selected) { m_controlVarsWindow.Active = true; } } }
// Draw the GUI used for selecting animation trees void DrawAnimTreeSelectionGUI() { EditorGUIUtility.LookLikeControls (); string[] trees = new string[m_activeAnimationTrees.Length + 2]; trees[0] = "None"; trees[1] = ""; int counter = 2; int selected = 0; foreach (AnimationTree tree in m_activeAnimationTrees) { if (tree != null) { trees[counter] = tree.name; if (m_selectedAnimationTree == tree) { selected = counter; } counter++; } } GUILayout.Label("Animation Tree:", GUILayout.ExpandWidth(false)); int newSel = EditorGUILayout.Popup(selected, trees, GUILayout.ExpandWidth(false)); if (newSel != selected) { if (newSel <= 1) { Selection.activeGameObject = null; } else { Selection.activeGameObject = m_activeAnimationTrees[newSel-2].gameObject; } m_controlVarsWindow = null; m_activeContainer = null; m_selectedAnimationTree = null; m_Windows.Clear(); } }