Esempio n. 1
0
        public static bool IsNodeLeftOverCurve(AnimationWindowHierarchyNode node, GameObject rootGameObject)
        {
            if (rootGameObject == null)
            {
                return(false);
            }
            EditorCurveBinding?binding = node.binding;

            if (binding.HasValue)
            {
                EditorCurveBinding?binding2 = node.binding;
                return(AnimationUtility.GetEditorCurveValueType(rootGameObject, binding2.Value) == null);
            }
            if (node.hasChildren)
            {
                using (List <TreeViewItem> .Enumerator enumerator = node.children.GetEnumerator())
                {
                    if (enumerator.MoveNext())
                    {
                        TreeViewItem current = enumerator.Current;
                        return(AnimationWindowUtility.IsNodeLeftOverCurve(current as AnimationWindowHierarchyNode, rootGameObject));
                    }
                }
                return(false);
            }
            return(false);
        }
 private void DoIconAndName(Rect rect, AnimationWindowHierarchyNode node, bool selected, bool focused, float indent)
 {
     EditorGUIUtility.SetIconSize(new Vector2(13f, 13f));
     if (Event.current.type == EventType.Repaint)
     {
         if (selected)
         {
             TreeViewGUI.s_Styles.selectionStyle.Draw(rect, false, false, true, focused);
         }
         if (AnimationMode.InAnimationMode())
         {
             rect.width -= 77f;
         }
         bool   flag    = AnimationWindowUtility.IsNodeLeftOverCurve(node, this.state.activeRootGameObject);
         bool   flag2   = AnimationWindowUtility.IsNodeAmbiguous(node, this.state.activeRootGameObject);
         string str     = string.Empty;
         string tooltip = string.Empty;
         if (flag)
         {
             str     = " (Missing!)";
             tooltip = "The GameObject or Component is missing (" + node.path + ")";
         }
         if (flag2)
         {
             str     = " (Duplicate GameObject name!)";
             tooltip = "Target for curve is ambiguous since there are multiple GameObjects with same name (" + node.path + ")";
         }
         if (node.depth == 0)
         {
             if ((this.state.activeRootGameObject != null) && (this.state.activeRootGameObject.transform.Find(node.path) == null))
             {
                 flag = true;
             }
             TreeViewGUI.s_Styles.content = new GUIContent(this.GetGameObjectName(node.path) + " : " + node.displayName + str, this.GetIconForNode(node), tooltip);
             Color textColor = this.m_AnimationLineStyle.normal.textColor;
             Color color     = !EditorGUIUtility.isProSkin ? Color.black : ((Color)(Color.gray * 1.35f));
             color = (!flag && !flag2) ? color : k_LeftoverCurveColor;
             this.SetStyleTextColor(this.m_AnimationLineStyle, color);
             rect.xMin += (int)(indent + base.k_FoldoutWidth);
             GUI.Label(rect, TreeViewGUI.s_Styles.content, this.m_AnimationLineStyle);
             this.SetStyleTextColor(this.m_AnimationLineStyle, textColor);
         }
         else
         {
             TreeViewGUI.s_Styles.content = new GUIContent(node.displayName + str, this.GetIconForNode(node), tooltip);
             Color color3 = this.m_AnimationLineStyle.normal.textColor;
             Color color4 = !EditorGUIUtility.isProSkin ? this.m_LightSkinPropertyTextColor : Color.gray;
             color4 = (!flag && !flag2) ? color4 : k_LeftoverCurveColor;
             this.SetStyleTextColor(this.m_AnimationLineStyle, color4);
             rect.xMin += (int)((indent + base.k_IndentWidth) + base.k_FoldoutWidth);
             GUI.Label(rect, TreeViewGUI.s_Styles.content, this.m_AnimationLineStyle);
             this.SetStyleTextColor(this.m_AnimationLineStyle, color3);
         }
     }
     if (this.IsRenaming(node.id) && (Event.current.type != EventType.Layout))
     {
         base.GetRenameOverlay().editFieldRect = new Rect(rect.x + base.k_IndentWidth, rect.y, (rect.width - base.k_IndentWidth) - 1f, rect.height);
     }
 }
 public static bool IsNodeLeftOverCurve(AnimationWindowHierarchyNode node, GameObject rootGameObject)
 {
     if ((UnityEngine.Object)rootGameObject == (UnityEngine.Object)null)
     {
         return(false);
     }
     if (node.binding.HasValue)
     {
         return(AnimationUtility.GetEditorCurveValueType(rootGameObject, node.binding.Value) == null);
     }
     if (node.hasChildren)
     {
         using (List <TreeViewItem> .Enumerator enumerator = node.children.GetEnumerator())
         {
             if (enumerator.MoveNext())
             {
                 return(AnimationWindowUtility.IsNodeLeftOverCurve(enumerator.Current as AnimationWindowHierarchyNode, rootGameObject));
             }
         }
     }
     return(false);
 }
        public static bool IsNodeLeftOverCurve(AnimationWindowHierarchyNode node)
        {
            EditorCurveBinding?binding = node.binding;
            bool result;

            if (binding.HasValue)
            {
                if (node.curves.Length > 0)
                {
                    AnimationWindowSelectionItem selectionBinding = node.curves[0].selectionBinding;
                    if (selectionBinding != null)
                    {
                        if (selectionBinding.rootGameObject == null && selectionBinding.scriptableObject == null)
                        {
                            result = false;
                            return(result);
                        }
                        AnimationWindowSelectionItem arg_77_0 = selectionBinding;
                        EditorCurveBinding?          binding2 = node.binding;
                        result = (arg_77_0.GetEditorCurveValueType(binding2.Value) == null);
                        return(result);
                    }
                }
            }
            if (node.hasChildren)
            {
                using (List <TreeViewItem> .Enumerator enumerator = node.children.GetEnumerator())
                {
                    if (enumerator.MoveNext())
                    {
                        TreeViewItem current = enumerator.Current;
                        result = AnimationWindowUtility.IsNodeLeftOverCurve(current as AnimationWindowHierarchyNode);
                        return(result);
                    }
                }
            }
            result = false;
            return(result);
        }
        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);
            }
        }
        private void DoIconAndName(Rect rect, AnimationWindowHierarchyNode node, bool selected, bool focused, float indent)
        {
            EditorGUIUtility.SetIconSize(new Vector2(13f, 13f));
            int itemControlID = TreeView.GetItemControlID(node);

            if (Event.current.type == EventType.Repaint)
            {
                bool flag = this.m_TreeView.dragging.GetDropTargetControlID() == itemControlID && this.m_TreeView.data.CanBeParent(node);
                this.animationLineStyle.Draw(rect, GUIContent.none, flag, flag, selected, focused);
                if (AnimationMode.InAnimationMode())
                {
                    rect.width -= 77f;
                }
                bool   flag2   = AnimationWindowUtility.IsNodeLeftOverCurve(node, this.state.m_RootGameObject);
                bool   flag3   = AnimationWindowUtility.IsNodeAmbiguous(node, this.state.m_RootGameObject);
                string text    = string.Empty;
                string tooltip = string.Empty;
                if (flag2)
                {
                    text    = " (Missing!)";
                    tooltip = "The GameObject or Component is missing (" + node.path + ")";
                }
                if (flag3)
                {
                    text    = " (Duplicate GameObject name!)";
                    tooltip = "Target for curve is ambiguous since there are multiple GameObjects with same name (" + node.path + ")";
                }
                if (node.depth == 0)
                {
                    Transform x = this.state.m_RootGameObject.transform.Find(node.path);
                    if (x == null)
                    {
                        flag2 = true;
                    }
                    TreeViewGUI.s_Styles.content = new GUIContent(this.GetGameObjectName(node.path) + " : " + node.displayName + text, this.GetIconForNode(node), tooltip);
                    Color textColor = this.animationLineStyle.normal.textColor;
                    Color color     = (!EditorGUIUtility.isProSkin) ? Color.black : (Color.gray * 1.35f);
                    color = ((!flag2 && !flag3) ? color : AnimationWindowHierarchyGUI.k_LeftoverCurveColor);
                    this.SetStyleTextColor(this.animationLineStyle, color);
                    rect.xMin += (float)((int)(indent + this.k_FoldoutWidth));
                    GUI.Label(rect, TreeViewGUI.s_Styles.content, this.animationLineStyle);
                    this.SetStyleTextColor(this.animationLineStyle, textColor);
                }
                else
                {
                    TreeViewGUI.s_Styles.content = new GUIContent(node.displayName + text, this.GetIconForNode(node), tooltip);
                    Color textColor2 = this.animationLineStyle.normal.textColor;
                    Color color2     = (!EditorGUIUtility.isProSkin) ? this.m_LightSkinPropertyTextColor : Color.gray;
                    color2 = ((!flag2 && !flag3) ? color2 : AnimationWindowHierarchyGUI.k_LeftoverCurveColor);
                    this.SetStyleTextColor(this.animationLineStyle, color2);
                    rect.xMin += (float)((int)(indent + this.k_IndentWidth + this.k_FoldoutWidth));
                    GUI.Label(rect, TreeViewGUI.s_Styles.content, this.animationLineStyle);
                    this.SetStyleTextColor(this.animationLineStyle, textColor2);
                    if (this.m_TreeView.dragging.GetRowMarkerControlID() == itemControlID)
                    {
                        this.m_DraggingInsertionMarkerRect = new Rect(rect.x + indent + this.k_FoldoutWidth, rect.y, rect.width - indent, rect.height);
                    }
                }
            }
            if (this.IsRenaming(node.id))
            {
                base.GetRenameOverlay().editFieldRect = new Rect(rect.x + this.k_IndentWidth, rect.y, rect.width - this.k_IndentWidth - 1f, rect.height);
            }
        }
Esempio n. 7
0
 private void DoIconAndName(Rect rect, AnimationWindowHierarchyNode node, bool selected, bool focused, float indent)
 {
     EditorGUIUtility.SetIconSize(new Vector2(13f, 13f));
     if (Event.current.type == EventType.Repaint)
     {
         if (selected)
         {
             TreeViewGUI.Styles.selectionStyle.Draw(rect, false, false, true, focused);
         }
         if (node is AnimationWindowHierarchyPropertyNode)
         {
             rect.width -= 77f;
         }
         bool   flag    = AnimationWindowUtility.IsNodeLeftOverCurve(node);
         bool   flag2   = AnimationWindowUtility.IsNodeAmbiguous(node);
         bool   flag3   = AnimationWindowUtility.IsNodePhantom(node);
         string text    = "";
         string tooltip = "";
         if (flag3)
         {
             text    = " (Default Value)";
             tooltip = "Transform position, rotation and scale can't be partially animated. This value will be animated to the default value";
         }
         if (flag)
         {
             text    = " (Missing!)";
             tooltip = "The GameObject or Component is missing (" + node.path + ")";
         }
         if (flag2)
         {
             text    = " (Duplicate GameObject name!)";
             tooltip = "Target for curve is ambiguous since there are multiple GameObjects with same name (" + node.path + ")";
         }
         Color textColor = this.m_AnimationLineStyle.normal.textColor;
         Color color;
         if (node.depth == 0)
         {
             string str = "";
             if (node.curves.Length > 0)
             {
                 AnimationWindowSelectionItem selectionBinding = node.curves[0].selectionBinding;
                 if (selectionBinding != null)
                 {
                     if (selectionBinding.rootGameObject != null)
                     {
                         Transform x = selectionBinding.rootGameObject.transform.Find(node.path);
                         if (x == null)
                         {
                             flag = true;
                         }
                     }
                 }
                 string gameObjectName = this.GetGameObjectName((!(selectionBinding != null)) ? null : selectionBinding.rootGameObject, node.path);
                 str = ((!string.IsNullOrEmpty(gameObjectName)) ? (gameObjectName + " : ") : "");
             }
             TreeViewGUI.Styles.content = new GUIContent(str + node.displayName + text, this.GetIconForItem(node), tooltip);
             color = ((!EditorGUIUtility.isProSkin) ? Color.black : (Color.gray * 1.35f));
         }
         else
         {
             TreeViewGUI.Styles.content = new GUIContent(node.displayName + text, this.GetIconForItem(node), tooltip);
             color = ((!EditorGUIUtility.isProSkin) ? this.m_LightSkinPropertyTextColor : Color.gray);
             Color color2 = (!selected) ? this.m_PhantomCurveColor : (this.m_PhantomCurveColor * 1.4f);
             color = ((!flag3) ? color : color2);
         }
         color = ((!flag && !flag2) ? color : AnimationWindowHierarchyGUI.k_LeftoverCurveColor);
         this.SetStyleTextColor(this.m_AnimationLineStyle, color);
         rect.xMin += (float)((int)(indent + TreeViewGUI.Styles.foldoutWidth + (float)this.m_AnimationLineStyle.margin.left));
         GUI.Label(rect, TreeViewGUI.Styles.content, this.m_AnimationLineStyle);
         this.SetStyleTextColor(this.m_AnimationLineStyle, textColor);
     }
     if (this.IsRenaming(node.id) && Event.current.type != EventType.Layout)
     {
         base.GetRenameOverlay().editFieldRect = new Rect(rect.x + this.k_IndentWidth, rect.y, rect.width - this.k_IndentWidth - 1f, rect.height);
     }
 }