static private ShowAtPosition ( |
||
buttonRect | ||
layer | ||
layerIndex | int | |
controller | AnimatorController | |
return | bool |
private void OnDrawLayer(Rect rect, int index, bool selected, bool focused) { Event current = Event.current; if (current.type == EventType.MouseUp && current.button == 1 && rect.Contains(current.mousePosition)) { GenericMenu genericMenu = new GenericMenu(); genericMenu.AddItem(new GUIContent("Delete"), false, new GenericMenu.MenuFunction(this.DeleteLayer)); genericMenu.ShowAsContext(); Event.current.Use(); } UnityEditor.Animations.AnimatorControllerLayer animatorControllerLayer = this.m_LayerList.list[index] as UnityEditor.Animations.AnimatorControllerLayer; rect.yMin += 4f; rect.yMax -= 4f; Vector2 vector = LayerControllerView.s_Styles.invisibleButton.CalcSize(LayerControllerView.s_Styles.settingsIcon); Rect rect2 = new Rect(rect.xMax - vector.x - 4f, rect.yMin + 1f, vector.x, rect.height - 16f); Rect rect3 = rect2; if (GUI.Button(rect3, LayerControllerView.s_Styles.settingsIcon, LayerControllerView.s_Styles.invisibleButton)) { Rect buttonRect = rect3; buttonRect.x += 15f; if (LayerSettingsWindow.ShowAtPosition(buttonRect, animatorControllerLayer, index, this.m_Host.animatorController)) { GUIUtility.ExitGUI(); } } if (animatorControllerLayer.syncedLayerIndex != -1) { Vector2 vector2 = LayerControllerView.s_Styles.layerLabel.CalcSize((!animatorControllerLayer.syncedLayerAffectsTiming) ? LayerControllerView.s_Styles.sync : LayerControllerView.s_Styles.syncTime); rect3 = new Rect(rect3.xMin - vector2.x - 4f, rect.yMin, vector2.x, rect.height - 16f); GUI.Label(rect3, (!animatorControllerLayer.syncedLayerAffectsTiming) ? LayerControllerView.s_Styles.sync : LayerControllerView.s_Styles.syncTime, LayerControllerView.s_Styles.layerLabel); } if (animatorControllerLayer.iKPass) { Vector2 vector3 = LayerControllerView.s_Styles.layerLabel.CalcSize(LayerControllerView.s_Styles.ik); rect3 = new Rect(rect3.xMin - vector3.x - 4f, rect.yMin, vector3.x, rect.height - 16f); GUI.Label(rect3, LayerControllerView.s_Styles.ik, LayerControllerView.s_Styles.layerLabel); } if (animatorControllerLayer.blendingMode == UnityEditor.Animations.AnimatorLayerBlendingMode.Additive) { Vector2 vector4 = LayerControllerView.s_Styles.layerLabel.CalcSize(LayerControllerView.s_Styles.additive); rect3 = new Rect(rect3.xMin - vector4.x - 4f, rect.yMin, vector4.x, rect.height - 16f); GUI.Label(rect3, LayerControllerView.s_Styles.additive, LayerControllerView.s_Styles.layerLabel); } if (animatorControllerLayer.avatarMask != null) { Vector2 vector5 = LayerControllerView.s_Styles.layerLabel.CalcSize(LayerControllerView.s_Styles.mask); rect3 = new Rect(rect3.xMin - vector5.x - 4f, rect.yMin, vector5.x, rect.height - 16f); GUI.Label(rect3, LayerControllerView.s_Styles.mask, LayerControllerView.s_Styles.layerLabel); } Rect rect4 = Rect.MinMaxRect(rect.xMin, rect.yMin, rect3.xMin - 4f, rect.yMax - 16f); float num = (float)LayerControllerView.s_Styles.label.padding.left; Rect rect5 = Rect.MinMaxRect(rect.xMin + num, rect.yMax - 11f, rect2.xMax, rect.yMax - 9f); bool flag = this.renameOverlay.IsRenaming() && this.renameOverlay.userData == index && !this.renameOverlay.isWaitingForDelay; if (flag) { if (rect4.width >= 0f && rect4.height >= 0f) { rect4.x -= 2f; this.renameOverlay.editFieldRect = rect4; } if (!this.renameOverlay.OnGUI()) { this.RenameEnd(); } } else { GUI.Label(rect4, animatorControllerLayer.name, LayerControllerView.s_Styles.label); } if (Event.current.type == EventType.Repaint) { float num2 = (index != 0) ? ((!this.m_Host.liveLink) ? animatorControllerLayer.defaultWeight : this.m_Host.previewAnimator.GetLayerWeight(index)) : 1f; Rect rect6 = rect5; rect6.width *= num2; EditorGUI.DrawRect(rect5, LayerControllerView.s_Styles.progressBackground); EditorGUI.DrawRect(rect6, (!this.m_Host.liveLink) ? LayerControllerView.s_Styles.progressEdit : LayerControllerView.s_Styles.progressLiveLink); } }
private void OnDrawLayer(Rect rect, int index, bool selected, bool focused) { Event current = Event.current; if (((current.type == EventType.MouseUp) && (current.button == 1)) && rect.Contains(current.mousePosition)) { GenericMenu menu = new GenericMenu(); menu.AddItem(new GUIContent("Delete"), false, new GenericMenu.MenuFunction(this.DeleteLayer)); menu.ShowAsContext(); Event.current.Use(); } UnityEditor.Animations.AnimatorControllerLayer layer = this.m_LayerList.list[index] as UnityEditor.Animations.AnimatorControllerLayer; rect.yMin += 4f; rect.yMax -= 4f; Vector2 vector = s_Styles.invisibleButton.CalcSize(s_Styles.settingsIcon); Rect rect2 = new Rect((rect.xMax - vector.x) - 4f, rect.yMin + 1f, vector.x, rect.height - 16f); Rect position = rect2; if (GUI.Button(position, s_Styles.settingsIcon, s_Styles.invisibleButton)) { Rect buttonRect = position; buttonRect.x += 15f; if (LayerSettingsWindow.ShowAtPosition(buttonRect, layer, index, this.m_Host.animatorController)) { GUIUtility.ExitGUI(); } } if (layer.syncedLayerIndex != -1) { Vector2 vector2 = s_Styles.layerLabel.CalcSize(!layer.syncedLayerAffectsTiming ? s_Styles.sync : s_Styles.syncTime); position = new Rect((position.xMin - vector2.x) - 4f, rect.yMin, vector2.x, rect.height - 16f); GUI.Label(position, !layer.syncedLayerAffectsTiming ? s_Styles.sync : s_Styles.syncTime, s_Styles.layerLabel); } if (layer.iKPass) { Vector2 vector3 = s_Styles.layerLabel.CalcSize(s_Styles.ik); position = new Rect((position.xMin - vector3.x) - 4f, rect.yMin, vector3.x, rect.height - 16f); GUI.Label(position, s_Styles.ik, s_Styles.layerLabel); } if (layer.blendingMode == UnityEditor.Animations.AnimatorLayerBlendingMode.Additive) { Vector2 vector4 = s_Styles.layerLabel.CalcSize(s_Styles.additive); position = new Rect((position.xMin - vector4.x) - 4f, rect.yMin, vector4.x, rect.height - 16f); GUI.Label(position, s_Styles.additive, s_Styles.layerLabel); } if (layer.avatarMask != null) { Vector2 vector5 = s_Styles.layerLabel.CalcSize(s_Styles.mask); position = new Rect((position.xMin - vector5.x) - 4f, rect.yMin, vector5.x, rect.height - 16f); GUI.Label(position, s_Styles.mask, s_Styles.layerLabel); if ((index == 0) && this.IsLayerUsingHumanoid(layer)) { Vector2 vector6 = s_Styles.invisibleButton.CalcSize(s_Styles.maskWarningIcon); float num = (position.height - vector6.y) * 0.5f; position = new Rect((position.xMin - vector6.x) - 4f, rect.yMin + num, vector6.x, vector6.y); GUI.Label(position, s_Styles.maskWarningIcon, s_Styles.invisibleButton); } } Rect rect5 = Rect.MinMaxRect(rect.xMin, rect.yMin, position.xMin - 4f, rect.yMax - 16f); float left = s_Styles.label.padding.left; Rect rect6 = Rect.MinMaxRect(rect.xMin + left, rect.yMax - 11f, rect2.xMax, rect.yMax - 9f); if ((this.renameOverlay.IsRenaming() && (this.renameOverlay.userData == index)) && !this.renameOverlay.isWaitingForDelay) { if ((rect5.width >= 0f) && (rect5.height >= 0f)) { rect5.x -= 2f; this.renameOverlay.editFieldRect = rect5; } if (!this.renameOverlay.OnGUI()) { this.RenameEnd(); } } else { GUI.Label(rect5, layer.name, s_Styles.label); } if (Event.current.type == EventType.Repaint) { float num3 = (index != 0) ? (!this.m_Host.liveLink ? layer.defaultWeight : this.m_Host.previewAnimator.GetLayerWeight(index)) : 1f; Rect rect7 = rect6; rect7.width *= num3; EditorGUI.DrawRect(rect6, s_Styles.progressBackground); EditorGUI.DrawRect(rect7, !this.m_Host.liveLink ? s_Styles.progressEdit : s_Styles.progressLiveLink); } }