private void DoIconAndName(Rect rect, AnimationWindowHierarchyNode node, bool selected, bool focused, float indent) { EditorGUIUtility.SetIconSize(new Vector2(13, 13)); // If not set we see icons scaling down if text is being cropped // TODO: All this is horrible. SHAME FIX! if (Event.current.type == EventType.Repaint) { if (selected) { selectionStyle.Draw(rect, false, false, true, focused); } // Leave some space for the value field that comes after. if (node is AnimationWindowHierarchyPropertyNode) { rect.width -= k_ValueFieldOffsetFromRightSide + 2; } bool isLeftOverCurve = AnimationWindowUtility.IsNodeLeftOverCurve(node); bool isAmbiguous = AnimationWindowUtility.IsNodeAmbiguous(node); bool isPhantom = AnimationWindowUtility.IsNodePhantom(node); string warningText = ""; string tooltipText = ""; if (isPhantom) { warningText = " (Default Value)"; tooltipText = "Transform position, rotation and scale can't be partially animated. This value will be animated to the default value"; } if (isLeftOverCurve) { warningText = " (Missing!)"; tooltipText = "The GameObject or Component is missing (" + node.path + ")"; } if (isAmbiguous) { warningText = " (Duplicate GameObject name!)"; tooltipText = "Target for curve is ambiguous since there are multiple GameObjects with same name (" + node.path + ")"; } Color oldColor = lineStyle.normal.textColor; Color textColor = oldColor; if (node.depth == 0) { string nodePrefix = ""; if (node.curves.Length > 0) { AnimationWindowSelectionItem selectionBinding = node.curves[0].selectionBinding; string gameObjectName = GetGameObjectName(selectionBinding != null ? selectionBinding.rootGameObject : null, node.path); nodePrefix = string.IsNullOrEmpty(gameObjectName) ? "" : gameObjectName + " : "; } Styles.content = new GUIContent(nodePrefix + node.displayName + warningText, GetIconForItem(node), tooltipText); textColor = EditorGUIUtility.isProSkin ? Color.gray * 1.35f : Color.black; } else { Styles.content = new GUIContent(node.displayName + warningText, GetIconForItem(node), tooltipText); textColor = EditorGUIUtility.isProSkin ? Color.gray : m_LightSkinPropertyTextColor; var phantomColor = selected ? m_PhantomCurveColor * k_SelectedPhantomCurveColorMultiplier : m_PhantomCurveColor; textColor = isPhantom ? phantomColor : textColor; } textColor = isLeftOverCurve || isAmbiguous ? k_LeftoverCurveColor : textColor; SetStyleTextColor(lineStyle, textColor); rect.xMin += (int)(indent + foldoutStyleWidth + lineStyle.margin.left); GUI.Label(rect, Styles.content, lineStyle); SetStyleTextColor(lineStyle, oldColor); } if (IsRenaming(node.id) && Event.current.type != EventType.Layout) { GetRenameOverlay().editFieldRect = new Rect(rect.x + k_IndentWidth, rect.y, rect.width - k_IndentWidth - 1, rect.height); } }