Exemplo n.º 1
0
        private void DoCurveColorIndicator(Rect rect, AnimationWindowHierarchyNode node)
        {
            if (Event.current.type != EventType.Repaint)
            {
                return;
            }
            Color color = GUI.color;

            GUI.color = this.state.showCurveEditor ? (node.curves.Length != 1 || node.curves[0].isPPtrCurve ? AnimationWindowHierarchyGUI.k_KeyColorForNonCurves : CurveUtility.GetPropertyColor(node.curves[0].binding.propertyName)) : AnimationWindowHierarchyGUI.k_KeyColorInDopesheetMode;
            bool flag = false;

            if (AnimationMode.InAnimationMode())
            {
                foreach (AnimationWindowCurve curve in node.curves)
                {
                    if (curve.m_Keyframes.Any <AnimationWindowKeyframe>((Func <AnimationWindowKeyframe, bool>)(key => this.state.time.ContainsTime(key.time))))
                    {
                        flag = true;
                    }
                }
            }
            Texture image = !flag ? (Texture)CurveUtility.GetIconCurve() : (Texture)CurveUtility.GetIconKey();

            rect = new Rect((float)((double)rect.xMax - 10.0 - (double)(image.width / 2) - 5.0), rect.yMin + 3f, (float)image.width, (float)image.height);
            GUI.DrawTexture(rect, image, ScaleMode.ScaleToFit, true, 1f);
            GUI.color = color;
        }
		public static bool IsNodeAmbiguous(AnimationWindowHierarchyNode node, GameObject rootGameObject)
		{
			if (rootGameObject == null)
			{
				return false;
			}
			EditorCurveBinding? binding = node.binding;
			if (binding.HasValue)
			{
				return AnimationUtility.AmbiguousBinding(node.binding.Value.path, node.binding.Value.m_ClassID, rootGameObject.transform);
			}
			if (node.hasChildren)
			{
				using (List<TreeViewItem>.Enumerator enumerator = node.children.GetEnumerator())
				{
					if (enumerator.MoveNext())
					{
						TreeViewItem current = enumerator.Current;
						return AnimationWindowUtility.IsNodeAmbiguous(current as AnimationWindowHierarchyNode, rootGameObject);
					}
				}
				return false;
			}
			return false;
		}
Exemplo n.º 3
0
        private List <AnimationWindowCurve> GetCurvesAffectedByNodes(List <AnimationWindowHierarchyNode> nodes, bool includeLinkedCurves)
        {
            List <AnimationWindowCurve> source = new List <AnimationWindowCurve>();

            using (List <AnimationWindowHierarchyNode> .Enumerator enumerator = nodes.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    AnimationWindowHierarchyNode windowHierarchyNode = enumerator.Current;
                    if (windowHierarchyNode.parent is AnimationWindowHierarchyPropertyGroupNode && includeLinkedCurves)
                    {
                        windowHierarchyNode = (AnimationWindowHierarchyNode)windowHierarchyNode.parent;
                    }
                    if (windowHierarchyNode is AnimationWindowHierarchyPropertyGroupNode || windowHierarchyNode is AnimationWindowHierarchyPropertyNode)
                    {
                        source.AddRange((IEnumerable <AnimationWindowCurve>)AnimationWindowUtility.FilterCurves(this.state.allCurves.ToArray(), windowHierarchyNode.path, windowHierarchyNode.animatableObjectType, windowHierarchyNode.propertyName));
                    }
                    else
                    {
                        source.AddRange((IEnumerable <AnimationWindowCurve>)AnimationWindowUtility.FilterCurves(this.state.allCurves.ToArray(), windowHierarchyNode.path, windowHierarchyNode.animatableObjectType));
                    }
                }
            }
            return(source.Distinct <AnimationWindowCurve>().ToList <AnimationWindowCurve>());
        }
        private List <AnimationWindowCurve> GetCurvesAffectedByNodes(List <AnimationWindowHierarchyNode> nodes, bool includeLinkedCurves)
        {
            List <AnimationWindowCurve> curves = new List <AnimationWindowCurve>();

            foreach (var node in nodes)
            {
                AnimationWindowHierarchyNode hierarchyNode = node;

                if (hierarchyNode.parent is AnimationWindowHierarchyPropertyGroupNode && includeLinkedCurves)
                {
                    hierarchyNode = (AnimationWindowHierarchyNode)hierarchyNode.parent;
                }

                if (hierarchyNode.curves == null)
                {
                    continue;
                }

                if (hierarchyNode.curves.Length > 0)
                {
                    // Property or propertygroup
                    if (hierarchyNode is AnimationWindowHierarchyPropertyGroupNode || hierarchyNode is AnimationWindowHierarchyPropertyNode)
                    {
                        curves.AddRange(AnimationWindowUtility.FilterCurves(hierarchyNode.curves, hierarchyNode.path, hierarchyNode.animatableObjectType, hierarchyNode.propertyName));
                    }
                    else
                    {
                        curves.AddRange(AnimationWindowUtility.FilterCurves(hierarchyNode.curves, hierarchyNode.path, hierarchyNode.animatableObjectType));
                    }
                }
            }
            return(curves.Distinct().ToList());
        }
 private void RemoveCurvesFromNodes(List <AnimationWindowHierarchyNode> nodes)
 {
     foreach (AnimationWindowHierarchyNode current in nodes)
     {
         AnimationWindowHierarchyNode animationWindowHierarchyNode = current;
         if (animationWindowHierarchyNode.parent is AnimationWindowHierarchyPropertyGroupNode)
         {
             EditorCurveBinding?binding = animationWindowHierarchyNode.binding;
             if (binding.HasValue)
             {
                 EditorCurveBinding?binding2 = animationWindowHierarchyNode.binding;
                 if (AnimationWindowUtility.ForceGrouping(binding2.Value))
                 {
                     animationWindowHierarchyNode = (AnimationWindowHierarchyNode)animationWindowHierarchyNode.parent;
                 }
             }
         }
         List <AnimationWindowCurve> list;
         if (animationWindowHierarchyNode is AnimationWindowHierarchyPropertyGroupNode || animationWindowHierarchyNode is AnimationWindowHierarchyPropertyNode)
         {
             list = AnimationWindowUtility.FilterCurves(this.state.allCurves.ToArray(), animationWindowHierarchyNode.path, animationWindowHierarchyNode.animatableObjectType, animationWindowHierarchyNode.propertyName);
         }
         else
         {
             list = AnimationWindowUtility.FilterCurves(this.state.allCurves.ToArray(), animationWindowHierarchyNode.path, animationWindowHierarchyNode.animatableObjectType);
         }
         foreach (AnimationWindowCurve current2 in list)
         {
             this.state.RemoveCurve(current2);
         }
     }
     this.m_TreeView.ReloadData();
 }
        override protected void RenameEnded()
        {
            string newName = GetRenameOverlay().name;
            string oldName = GetRenameOverlay().originalName;

            if (newName != oldName)
            {
                Undo.RecordObject(state.activeAnimationClip, "Rename Curve");

                foreach (AnimationWindowCurve curve in m_RenamedNode.curves)
                {
                    EditorCurveBinding newBinding = AnimationWindowUtility.GetRenamedBinding(curve.binding, newName);

                    if (AnimationWindowUtility.CurveExists(newBinding, state.allCurves.ToArray()))
                    {
                        Debug.LogWarning("Curve already exists, renaming cancelled.");
                        continue;
                    }

                    AnimationWindowUtility.RenameCurvePath(curve, newBinding, curve.clip);
                }
            }

            m_RenamedNode = null;
        }
Exemplo n.º 7
0
        public static bool IsNodeAmbiguous(AnimationWindowHierarchyNode node, GameObject rootGameObject)
        {
            if (rootGameObject == null)
            {
                return(false);
            }
            EditorCurveBinding?binding = node.binding;

            if (binding.HasValue)
            {
                return(AnimationUtility.AmbiguousBinding(node.binding.Value.path, node.binding.Value.m_ClassID, rootGameObject.transform));
            }
            if (node.hasChildren)
            {
                using (List <TreeViewItem> .Enumerator enumerator = node.children.GetEnumerator())
                {
                    if (enumerator.MoveNext())
                    {
                        TreeViewItem current = enumerator.Current;
                        return(AnimationWindowUtility.IsNodeAmbiguous(current as AnimationWindowHierarchyNode, rootGameObject));
                    }
                }
                return(false);
            }
            return(false);
        }
        private void DoCurveColorIndicator(Rect rect, AnimationWindowHierarchyNode node)
        {
            if (Event.current.type == EventType.Repaint)
            {
                Color color = GUI.color;
                if (!this.state.showCurveEditor)
                {
                    GUI.color = k_KeyColorInDopesheetMode;
                }
                else if ((node.curves.Length == 1) && !node.curves[0].isPPtrCurve)
                {
                    GUI.color = CurveUtility.GetPropertyColor(node.curves[0].binding.propertyName);
                }
                else
                {
                    GUI.color = k_KeyColorForNonCurves;
                }
                bool flag = false;
                if (AnimationMode.InAnimationMode())
                {
                    foreach (AnimationWindowCurve curve in node.curves)
                    {
                        if (curve.m_Keyframes.Any <AnimationWindowKeyframe>(key => this.state.time.ContainsTime(key.time)))
                        {
                            flag = true;
                        }
                    }
                }
                Texture image = !flag?CurveUtility.GetIconCurve() : CurveUtility.GetIconKey();

                rect = new Rect(((rect.xMax - 10f) - (image.width / 2)) - 5f, rect.yMin + 3f, (float)image.width, (float)image.height);
                GUI.DrawTexture(rect, image, ScaleMode.ScaleToFit, true, 1f);
                GUI.color = color;
            }
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
0
        private List <AnimationWindowCurve> GetCurvesAffectedByNodes(List <AnimationWindowHierarchyNode> nodes, bool includeLinkedCurves)
        {
            List <AnimationWindowCurve> list = new List <AnimationWindowCurve>();

            foreach (AnimationWindowHierarchyNode current in nodes)
            {
                AnimationWindowHierarchyNode animationWindowHierarchyNode = current;
                if (animationWindowHierarchyNode.parent is AnimationWindowHierarchyPropertyGroupNode && includeLinkedCurves)
                {
                    animationWindowHierarchyNode = (AnimationWindowHierarchyNode)animationWindowHierarchyNode.parent;
                }
                if (animationWindowHierarchyNode.curves.Length > 0)
                {
                    if (animationWindowHierarchyNode is AnimationWindowHierarchyPropertyGroupNode || animationWindowHierarchyNode is AnimationWindowHierarchyPropertyNode)
                    {
                        list.AddRange(AnimationWindowUtility.FilterCurves(animationWindowHierarchyNode.curves, animationWindowHierarchyNode.path, animationWindowHierarchyNode.animatableObjectType, animationWindowHierarchyNode.propertyName));
                    }
                    else
                    {
                        list.AddRange(AnimationWindowUtility.FilterCurves(animationWindowHierarchyNode.curves, animationWindowHierarchyNode.path, animationWindowHierarchyNode.animatableObjectType));
                    }
                }
            }
            return(list.Distinct <AnimationWindowCurve>().ToList <AnimationWindowCurve>());
        }
 public void SetTallMode(AnimationWindowHierarchyNode node, bool tallMode)
 {
   if (tallMode)
     this.m_TallInstanceIDs.Add(node.id);
   else
     this.m_TallInstanceIDs.Remove(node.id);
 }
Exemplo n.º 12
0
        public List <AnimationWindowHierarchyNode> CreateTreeFromCurves()
        {
            List <AnimationWindowHierarchyNode> list  = new List <AnimationWindowHierarchyNode>();
            List <AnimationWindowCurve>         list2 = new List <AnimationWindowCurve>();

            AnimationWindowCurve[]       array      = this.state.allCurves.ToArray();
            AnimationWindowHierarchyNode parentNode = (AnimationWindowHierarchyNode)this.m_RootItem;

            for (int i = 0; i < array.Length; i++)
            {
                AnimationWindowCurve animationWindowCurve  = array[i];
                AnimationWindowCurve animationWindowCurve2 = (i >= array.Length - 1) ? null : array[i + 1];
                list2.Add(animationWindowCurve);
                bool flag  = animationWindowCurve2 != null && AnimationWindowUtility.GetPropertyGroupName(animationWindowCurve2.propertyName) == AnimationWindowUtility.GetPropertyGroupName(animationWindowCurve.propertyName);
                bool flag2 = animationWindowCurve2 != null && animationWindowCurve.path.Equals(animationWindowCurve2.path) && animationWindowCurve.type == animationWindowCurve2.type;
                if (i == array.Length - 1 || !flag || !flag2)
                {
                    if (list2.Count > 1)
                    {
                        list.Add(this.AddPropertyGroupToHierarchy(list2.ToArray(), parentNode));
                    }
                    else
                    {
                        list.Add(this.AddPropertyToHierarchy(list2[0], parentNode));
                    }
                    list2.Clear();
                }
            }
            return(list);
        }
 protected void DoNodeGUI(Rect rect, AnimationWindowHierarchyNode node, bool selected, bool focused, int row)
 {
     this.InitStyles();
     if (!(node is AnimationWindowHierarchyMasterNode))
     {
         float indent = base.k_BaseIndent + ((node.depth + node.indent) * base.k_IndentWidth);
         if (node is AnimationWindowHierarchyAddButtonNode)
         {
             if ((Event.current.type == EventType.MouseMove) && (s_WasInsideValueRectFrame >= 0))
             {
                 if (s_WasInsideValueRectFrame >= (Time.frameCount - 1))
                 {
                     Event.current.Use();
                 }
                 else
                 {
                     s_WasInsideValueRectFrame = -1;
                 }
             }
             using (new EditorGUI.DisabledScope(!this.state.selection.canAddCurves))
             {
                 this.DoAddCurveButton(rect, node, row);
             }
         }
         else
         {
             this.DoRowBackground(rect, row);
             this.DoIconAndName(rect, node, selected, focused, indent);
             this.DoFoldout(node, rect, indent, row);
             bool enabled = false;
             if (node.curves != null)
             {
                 if (< > f__am$cache0 == null)
                 {
Exemplo n.º 14
0
        protected override void RenameEnded()
        {
            string name         = base.GetRenameOverlay().name;
            string originalName = base.GetRenameOverlay().originalName;

            if (name != originalName)
            {
                Undo.RecordObject(this.state.activeAnimationClip, "Rename Curve");
                AnimationWindowCurve[] curves = this.m_RenamedNode.curves;
                for (int i = 0; i < curves.Length; i++)
                {
                    AnimationWindowCurve animationWindowCurve = curves[i];
                    string             newPath        = this.RenamePath(animationWindowCurve.path, name);
                    EditorCurveBinding renamedBinding = AnimationWindowUtility.GetRenamedBinding(animationWindowCurve.binding, newPath);
                    if (AnimationWindowUtility.CurveExists(renamedBinding, this.state.allCurves.ToArray()))
                    {
                        Debug.LogWarning("Curve already exists, renaming cancelled.");
                    }
                    else
                    {
                        AnimationWindowUtility.RenameCurvePath(animationWindowCurve, renamedBinding, animationWindowCurve.clip);
                    }
                }
            }
            this.m_RenamedNode = null;
        }
 protected void DoNodeGUI(Rect rect, AnimationWindowHierarchyNode node, bool selected, bool focused, int row)
 {
   this.InitStyles();
   if (node is AnimationWindowHierarchyMasterNode)
     return;
   float indent = this.k_BaseIndent + (float) (node.depth + node.indent) * this.k_IndentWidth;
   if (node is AnimationWindowHierarchyAddButtonNode)
   {
     if (Event.current.type == EventType.MouseMove && AnimationWindowHierarchyGUI.s_WasInsideValueRectFrame >= 0)
     {
       if (AnimationWindowHierarchyGUI.s_WasInsideValueRectFrame >= Time.frameCount - 1)
         Event.current.Use();
       else
         AnimationWindowHierarchyGUI.s_WasInsideValueRectFrame = -1;
     }
     EditorGUI.BeginDisabledGroup(!(bool) ((UnityEngine.Object) this.state.activeGameObject) || !AnimationWindowUtility.GameObjectIsAnimatable(this.state.activeGameObject, this.state.activeAnimationClip));
     this.DoAddCurveButton(rect);
     EditorGUI.EndDisabledGroup();
   }
   else
   {
     this.DoRowBackground(rect, row);
     this.DoIconAndName(rect, node, selected, focused, indent);
     this.DoFoldout(node, rect, indent);
     EditorGUI.BeginDisabledGroup(this.state.animationIsReadOnly);
     this.DoValueField(rect, node, row);
     this.HandleContextMenu(rect, node);
     EditorGUI.EndDisabledGroup();
     this.DoCurveDropdown(rect, node);
     this.DoCurveColorIndicator(rect, node);
   }
   EditorGUIUtility.SetIconSize(Vector2.zero);
 }
		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;
		}
Exemplo n.º 17
0
        public static bool IsNodeAmbiguous(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)
                        {
                            result = AnimationUtility.AmbiguousBinding(node.binding.Value.path, node.binding.Value.m_ClassID, selectionBinding.rootGameObject.transform);
                            return(result);
                        }
                    }
                }
            }
            if (node.hasChildren)
            {
                using (List <TreeViewItem> .Enumerator enumerator = node.children.GetEnumerator())
                {
                    if (enumerator.MoveNext())
                    {
                        TreeViewItem current = enumerator.Current;
                        result = AnimationWindowUtility.IsNodeAmbiguous(current as AnimationWindowHierarchyNode);
                        return(result);
                    }
                }
            }
            result = false;
            return(result);
        }
 private void RemoveCurvesFromNodes(List <AnimationWindowHierarchyNode> nodes)
 {
     foreach (AnimationWindowHierarchyNode node in nodes)
     {
         AnimationWindowHierarchyNode parent = node;
         if (((parent.parent is AnimationWindowHierarchyPropertyGroupNode) && parent.binding.HasValue) && AnimationWindowUtility.ForceGrouping(parent.binding.Value))
         {
             parent = (AnimationWindowHierarchyNode)parent.parent;
         }
         List <AnimationWindowCurve> list = null;
         if ((parent is AnimationWindowHierarchyPropertyGroupNode) || (parent is AnimationWindowHierarchyPropertyNode))
         {
             list = AnimationWindowUtility.FilterCurves(this.state.allCurves.ToArray(), parent.path, parent.animatableObjectType, parent.propertyName);
         }
         else
         {
             list = AnimationWindowUtility.FilterCurves(this.state.allCurves.ToArray(), parent.path, parent.animatableObjectType);
         }
         foreach (AnimationWindowCurve curve in list)
         {
             this.state.RemoveCurve(curve);
         }
     }
     base.m_TreeView.ReloadData();
 }
 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);
     }
 }
Exemplo n.º 20
0
 public float GetNodeHeight(AnimationWindowHierarchyNode node)
 {
     if (node is AnimationWindowHierarchyAddButtonNode)
     {
         return(40f);
     }
     return((this.m_TreeView.state as AnimationWindowHierarchyState).GetTallMode(node) ? 32f : 16f);
 }
 private void HandleContextMenu(Rect rect, AnimationWindowHierarchyNode node)
 {
     if ((Event.current.type == EventType.ContextClick) && rect.Contains(Event.current.mousePosition))
     {
         this.state.SelectHierarchyItem(node.id, false, true);
         this.GenerateMenu(this.state.selectedHierarchyNodes).ShowAsContext();
         Event.current.Use();
     }
 }
Exemplo n.º 22
0
        public float GetNodeHeight(AnimationWindowHierarchyNode node)
        {
            if (node is AnimationWindowHierarchyAddButtonNode)
            {
                return(40f);
            }
            AnimationWindowHierarchyState animationWindowHierarchyState = this.m_TreeView.state as AnimationWindowHierarchyState;

            return((!animationWindowHierarchyState.GetTallMode(node)) ? 16f : 32f);
        }
Exemplo n.º 23
0
        public List <AnimationWindowKeyframe> GetAggregateKeys(AnimationWindowHierarchyNode hierarchyNode)
        {
            DopeLine dopeLine = this.dopelines.FirstOrDefault((DopeLine e) => e.m_HierarchyNodeID == hierarchyNode.id);

            if (dopeLine == null)
            {
                return(null);
            }
            return(dopeLine.keys);
        }
Exemplo n.º 24
0
        private float GetTopPixelOfRow(int row, List <TreeViewItem> rows)
        {
            float num = 0.0f;

            for (int index = 0; index < row && index < rows.Count; ++index)
            {
                AnimationWindowHierarchyNode row1 = rows[index] as AnimationWindowHierarchyNode;
                num += this.GetNodeHeight(row1);
            }
            return(num);
        }
 private void DoCurveDropdown(Rect rect, AnimationWindowHierarchyNode node, int row, bool enabled)
 {
     rect = new Rect((rect.xMax - 10f) - 12f, rect.yMin + 2f, 22f, 12f);
     if (this.DoTreeViewButton(this.m_HierarchyItemButtonControlIDs[row], rect, GUIContent.none, this.m_AnimationCurveDropdown))
     {
         this.state.SelectHierarchyItem(node.id, false, false);
         AnimationWindowHierarchyNode[] source = new AnimationWindowHierarchyNode[] { node };
         this.GenerateMenu(source.ToList <AnimationWindowHierarchyNode>(), enabled).DropDown(rect);
         Event.current.Use();
     }
 }
        private float GetTopPixelOfRow(int row, List <TreeViewItem> rows)
        {
            float num = 0f;

            for (int i = 0; (i < row) && (i < rows.Count); i++)
            {
                AnimationWindowHierarchyNode node = rows[i] as AnimationWindowHierarchyNode;
                num += this.GetNodeHeight(node);
            }
            return(num);
        }
        public float GetNodeHeight(AnimationWindowHierarchyNode node)
        {
            if (node is AnimationWindowHierarchyAddButtonNode)
            {
                return(k_AddCurveButtonNodeHeight);
            }

            AnimationWindowHierarchyState hierarchyState = m_TreeView.state as AnimationWindowHierarchyState;

            return(hierarchyState.GetTallMode(node) ? k_DopeSheetRowHeightTall : k_DopeSheetRowHeight);
        }
 private void DoCurveDropdown(Rect rect, AnimationWindowHierarchyNode node)
 {
     rect = new Rect((rect.xMax - 10f) - 12f, rect.yMin + 2f, 22f, 12f);
     if (GUI.Button(rect, GUIContent.none, this.m_AnimationCurveDropdown))
     {
         this.state.SelectHierarchyItem(node.id, false, false);
         AnimationWindowHierarchyNode[] source = new AnimationWindowHierarchyNode[] { node };
         this.GenerateMenu(source.ToList <AnimationWindowHierarchyNode>()).DropDown(rect);
         Event.current.Use();
     }
 }
        public override Rect GetRowRect(int row, float rowWidth)
        {
            List <TreeViewItem>          rows = base.m_TreeView.data.GetRows();
            AnimationWindowHierarchyNode node = rows[row] as AnimationWindowHierarchyNode;

            if (!node.topPixel.HasValue)
            {
                node.topPixel = new float?(this.GetTopPixelOfRow(row, rows));
            }
            return(new Rect(0f, node.topPixel.Value, rowWidth, this.GetNodeHeight(node)));
        }
        public override Vector2 GetTotalSize(List <TreeViewItem> rows)
        {
            float num = 0f;

            for (int i = 0; i < rows.Count; i++)
            {
                AnimationWindowHierarchyNode node = rows[i] as AnimationWindowHierarchyNode;
                num += this.GetNodeHeight(node);
            }
            return(new Vector2(1f, num));
        }
Exemplo n.º 31
0
 public void SetTallMode(AnimationWindowHierarchyNode node, bool tallMode)
 {
     if (tallMode)
     {
         m_TallInstanceIDs.Add(node.id);
     }
     else
     {
         m_TallInstanceIDs.Remove(node.id);
     }
 }
        float GetTopPixelOfRow(int row, IList <TreeViewItem> rows)
        {
            float top = 0f;

            for (int i = 0; i < row && i < rows.Count; i++)
            {
                AnimationWindowHierarchyNode node = rows[i] as AnimationWindowHierarchyNode;
                top += GetNodeHeight(node);
            }
            return(top);
        }
        public override Vector2 GetTotalSize()
        {
            List <TreeViewItem> rows = base.m_TreeView.data.GetRows();
            float y = 0f;

            for (int i = 0; i < rows.Count; i++)
            {
                AnimationWindowHierarchyNode node = rows[i] as AnimationWindowHierarchyNode;
                y += this.GetNodeHeight(node);
            }
            return(new Vector2(1f, y));
        }
        protected void DoNodeGUI(Rect rect, AnimationWindowHierarchyNode node, bool selected, bool focused, int row)
        {
            InitStyles();

            if (node is AnimationWindowHierarchyMasterNode)
            {
                return;
            }

            float indent = k_BaseIndent + (node.depth + node.indent) * k_IndentWidth;

            if (node is AnimationWindowHierarchyAddButtonNode)
            {
                if (Event.current.type == EventType.MouseMove && s_WasInsideValueRectFrame >= 0)
                {
                    if (s_WasInsideValueRectFrame >= Time.frameCount - 1)
                    {
                        Event.current.Use();
                    }
                    else
                    {
                        s_WasInsideValueRectFrame = -1;
                    }
                }

                using (new EditorGUI.DisabledScope(!state.selection.canAddCurves))
                {
                    DoAddCurveButton(rect, node, row);
                }
            }
            else
            {
                DoRowBackground(rect, row);
                DoIconAndName(rect, node, selected, focused, indent);
                DoFoldout(node, rect, indent, row);

                bool enabled = false;
                if (node.curves != null)
                {
                    enabled = !Array.Exists(node.curves, curve => curve.animationIsEditable == false);
                }

                using (new EditorGUI.DisabledScope(!enabled))
                {
                    DoValueField(rect, node, row);
                }
                DoCurveDropdown(rect, node, row, enabled);
                HandleContextMenu(rect, node, enabled);
                DoCurveColorIndicator(rect, node);
            }
            EditorGUIUtility.SetIconSize(Vector2.zero);
        }
 public override bool BeginRename(TreeViewItem item, float delay)
 {
     this.m_RenamedNode = item as AnimationWindowHierarchyNode;
     GameObject rootGameObject = null;
     if (this.m_RenamedNode.curves.Length > 0)
     {
         AnimationWindowSelectionItem selectionBinding = this.m_RenamedNode.curves[0].selectionBinding;
         if (selectionBinding != null)
         {
             rootGameObject = selectionBinding.rootGameObject;
         }
     }
     return base.GetRenameOverlay().BeginRename(this.GetGameObjectName(rootGameObject, this.m_RenamedNode.path), item.id, delay);
 }
 private AnimationWindowHierarchyPropertyNode AddPropertyToHierarchy(AnimationWindowCurve curve, AnimationWindowHierarchyNode parentNode)
 {
     AnimationWindowHierarchyPropertyNode node = new AnimationWindowHierarchyPropertyNode(curve.type, curve.propertyName, curve.path, parentNode, curve.binding, curve.isPPtrCurve);
     if (parentNode.icon != null)
     {
         node.icon = parentNode.icon;
     }
     else
     {
         node.icon = this.GetIcon(curve.binding);
     }
     node.indent = curve.depth;
     node.curves = new AnimationWindowCurve[] { curve };
     return node;
 }
 private AnimationWindowHierarchyPropertyGroupNode AddPropertyGroupToHierarchy(AnimationWindowCurve[] curves, AnimationWindowHierarchyNode parentNode)
 {
   List<AnimationWindowHierarchyNode> windowHierarchyNodeList = new List<AnimationWindowHierarchyNode>();
   AnimationWindowHierarchyPropertyGroupNode propertyGroupNode = new AnimationWindowHierarchyPropertyGroupNode(curves[0].type, AnimationWindowUtility.GetPropertyGroupName(curves[0].propertyName), curves[0].path, (TreeViewItem) parentNode);
   propertyGroupNode.icon = this.GetIcon(curves[0].binding);
   propertyGroupNode.indent = curves[0].depth;
   propertyGroupNode.curves = curves;
   foreach (AnimationWindowCurve curve in curves)
   {
     AnimationWindowHierarchyPropertyNode hierarchy = this.AddPropertyToHierarchy(curve, (AnimationWindowHierarchyNode) propertyGroupNode);
     hierarchy.displayName = AnimationWindowUtility.GetPropertyDisplayName(hierarchy.propertyName);
     windowHierarchyNodeList.Add((AnimationWindowHierarchyNode) hierarchy);
   }
   TreeViewUtility.SetChildParentReferences(new List<TreeViewItem>((IEnumerable<TreeViewItem>) windowHierarchyNodeList.ToArray()), (TreeViewItem) propertyGroupNode);
   return propertyGroupNode;
 }
 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 IsNodeAmbiguous(AnimationWindowHierarchyNode node, GameObject rootGameObject)
 {
   if ((UnityEngine.Object) rootGameObject == (UnityEngine.Object) null)
     return false;
   if (node.binding.HasValue)
     return AnimationUtility.AmbiguousBinding(node.binding.Value.path, node.binding.Value.m_ClassID, rootGameObject.transform);
   if (node.hasChildren)
   {
     using (List<TreeViewItem>.Enumerator enumerator = node.children.GetEnumerator())
     {
       if (enumerator.MoveNext())
         return AnimationWindowUtility.IsNodeAmbiguous(enumerator.Current as AnimationWindowHierarchyNode, rootGameObject);
     }
   }
   return false;
 }
 private AnimationWindowHierarchyPropertyGroupNode AddPropertyGroupToHierarchy(AnimationWindowCurve[] curves, AnimationWindowHierarchyNode parentNode)
 {
     List<AnimationWindowHierarchyNode> list = new List<AnimationWindowHierarchyNode>();
     AnimationWindowHierarchyPropertyGroupNode node = new AnimationWindowHierarchyPropertyGroupNode(curves[0].type, AnimationWindowUtility.GetPropertyGroupName(curves[0].propertyName), curves[0].path, parentNode) {
         icon = this.GetIcon(curves[0].binding),
         indent = curves[0].depth,
         curves = curves
     };
     foreach (AnimationWindowCurve curve in curves)
     {
         AnimationWindowHierarchyPropertyNode item = this.AddPropertyToHierarchy(curve, node);
         item.displayName = AnimationWindowUtility.GetPropertyDisplayName(item.propertyName);
         list.Add(item);
     }
     TreeViewUtility.SetChildParentReferences(new List<TreeViewItem>(list.ToArray()), node);
     return node;
 }
		private AnimationWindowHierarchyPropertyGroupNode AddPropertyGroupToHierarchy(AnimationWindowCurve[] curves, AnimationWindowHierarchyNode parentNode)
		{
			List<AnimationWindowHierarchyNode> list = new List<AnimationWindowHierarchyNode>();
			Type type = curves[0].type;
			AnimationWindowHierarchyPropertyGroupNode animationWindowHierarchyPropertyGroupNode = new AnimationWindowHierarchyPropertyGroupNode(type, AnimationWindowUtility.GetPropertyGroupName(curves[0].propertyName), curves[0].path, parentNode);
			animationWindowHierarchyPropertyGroupNode.icon = this.GetIcon(curves[0].binding);
			animationWindowHierarchyPropertyGroupNode.indent = curves[0].depth;
			animationWindowHierarchyPropertyGroupNode.curves = curves;
			for (int i = 0; i < curves.Length; i++)
			{
				AnimationWindowCurve curve = curves[i];
				AnimationWindowHierarchyPropertyNode animationWindowHierarchyPropertyNode = this.AddPropertyToHierarchy(curve, animationWindowHierarchyPropertyGroupNode);
				animationWindowHierarchyPropertyNode.displayName = AnimationWindowUtility.GetPropertyDisplayName(animationWindowHierarchyPropertyNode.propertyName);
				list.Add(animationWindowHierarchyPropertyNode);
			}
			TreeViewUtility.SetChildParentReferences(new List<TreeViewItem>(list.ToArray()), animationWindowHierarchyPropertyGroupNode);
			return animationWindowHierarchyPropertyGroupNode;
		}
 private void DoCurveDropdown(Rect rect, AnimationWindowHierarchyNode node)
 {
     rect = new Rect((rect.xMax - 10f) - 12f, rect.yMin + 2f, 22f, 12f);
     if (GUI.Button(rect, GUIContent.none, this.m_AnimationCurveDropdown))
     {
         this.state.SelectHierarchyItem(node.id, false, false);
         AnimationWindowHierarchyNode[] source = new AnimationWindowHierarchyNode[] { node };
         this.GenerateMenu(source.ToList<AnimationWindowHierarchyNode>()).DropDown(rect);
         Event.current.Use();
     }
 }
 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 isHover = (base.m_TreeView.dragging.GetDropTargetControlID() == itemControlID) && base.m_TreeView.data.CanBeParent(node);
         this.m_AnimationLineStyle.Draw(rect, GUIContent.none, isHover, isHover, selected, selected);
         if (AnimationMode.InAnimationMode())
         {
             rect.width -= 77f;
         }
         bool flag2 = AnimationWindowUtility.IsNodeLeftOverCurve(node, this.state.activeRootGameObject);
         bool flag3 = AnimationWindowUtility.IsNodeAmbiguous(node, this.state.activeRootGameObject);
         string str = string.Empty;
         string tooltip = string.Empty;
         if (flag2)
         {
             str = " (Missing!)";
             tooltip = "The GameObject or Component is missing (" + node.path + ")";
         }
         if (flag3)
         {
             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))
             {
                 flag2 = 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 = (!flag2 && !flag3) ? 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 = (!flag2 && !flag3) ? 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 (base.m_TreeView.dragging.GetRowMarkerControlID() == itemControlID)
             {
                 base.m_DraggingInsertionMarkerRect = new Rect((rect.x + indent) + base.k_FoldoutWidth, rect.y, rect.width - indent, rect.height);
             }
         }
     }
     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);
     }
 }
 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);
         bool flag2 = AnimationWindowUtility.IsNodeAmbiguous(node);
         bool flag3 = AnimationWindowUtility.IsNodePhantom(node);
         string str = "";
         string tooltip = "";
         if (flag3)
         {
             str = " (Default Value)";
             tooltip = "Transform position, rotation and scale can't be partially animated. This value will be animated to the default value";
         }
         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 + ")";
         }
         Color textColor = this.m_AnimationLineStyle.normal.textColor;
         Color color = textColor;
         if (node.depth == 0)
         {
             string str3 = "";
             if (node.curves.Length > 0)
             {
                 AnimationWindowSelectionItem selectionBinding = node.curves[0].selectionBinding;
                 if (((selectionBinding != null) && (selectionBinding.rootGameObject != null)) && (selectionBinding.rootGameObject.transform.Find(node.path) == null))
                 {
                     flag = true;
                 }
                 string gameObjectName = this.GetGameObjectName((selectionBinding == null) ? null : selectionBinding.rootGameObject, node.path);
                 str3 = !string.IsNullOrEmpty(gameObjectName) ? (gameObjectName + " : ") : "";
             }
             TreeViewGUI.s_Styles.content = new GUIContent(str3 + node.displayName + str, this.GetIconForItem(node), tooltip);
             color = !EditorGUIUtility.isProSkin ? Color.black : ((Color) (Color.gray * 1.35f));
         }
         else
         {
             TreeViewGUI.s_Styles.content = new GUIContent(node.displayName + str, this.GetIconForItem(node), tooltip);
             color = !EditorGUIUtility.isProSkin ? this.m_LightSkinPropertyTextColor : Color.gray;
             Color color3 = !selected ? this.m_PhantomCurveColor : ((Color) (this.m_PhantomCurveColor * 1.4f));
             color = !flag3 ? color : color3;
         }
         color = (!flag && !flag2) ? color : k_LeftoverCurveColor;
         this.SetStyleTextColor(this.m_AnimationLineStyle, color);
         rect.xMin += ((int) (indent + TreeViewGUI.s_Styles.foldoutWidth)) + this.m_AnimationLineStyle.margin.left;
         GUI.Label(rect, TreeViewGUI.s_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 + base.k_IndentWidth, rect.y, (rect.width - base.k_IndentWidth) - 1f, rect.height);
     }
 }
 private void DoValueField(Rect rect, AnimationWindowHierarchyNode node, int row)
 {
     bool flag = false;
     if (AnimationMode.InAnimationMode())
     {
         EditorGUI.BeginDisabledGroup(this.state.animationIsReadOnly);
         if (node is AnimationWindowHierarchyPropertyNode)
         {
             List<AnimationWindowCurve> curves = this.state.GetCurves(node, false);
             if ((curves == null) || (curves.Count == 0))
             {
                 return;
             }
             AnimationWindowCurve curve = curves[0];
             object currentValue = CurveBindingUtility.GetCurrentValue(this.state.activeRootGameObject, curve.binding);
             System.Type editorCurveValueType = CurveBindingUtility.GetEditorCurveValueType(this.state.activeRootGameObject, curve.binding);
             if (currentValue is float)
             {
                 float num = (float) currentValue;
                 Rect position = new Rect(rect.xMax - 75f, rect.y, 50f, rect.height);
                 if ((Event.current.type == EventType.MouseMove) && position.Contains(Event.current.mousePosition))
                 {
                     s_WasInsideValueRectFrame = Time.frameCount;
                 }
                 EditorGUI.BeginChangeCheck();
                 if (editorCurveValueType == typeof(bool))
                 {
                     num = !EditorGUI.Toggle(position, num != 0f) ? ((float) 0) : ((float) 1);
                 }
                 else
                 {
                     int id = GUIUtility.GetControlID(0x75bcc20, FocusType.Keyboard, position);
                     bool flag2 = (((GUIUtility.keyboardControl == id) && EditorGUIUtility.editingTextField) && (Event.current.type == EventType.KeyDown)) && ((Event.current.character == '\n') || (Event.current.character == '\x0003'));
                     num = EditorGUI.DoFloatField(EditorGUI.s_RecycledEditor, position, new Rect(0f, 0f, 0f, 0f), id, num, EditorGUI.kFloatFieldFormatString, this.m_AnimationSelectionTextField, false);
                     if (flag2)
                     {
                         GUI.changed = true;
                         Event.current.Use();
                     }
                 }
                 if (float.IsInfinity(num) || float.IsNaN(num))
                 {
                     num = 0f;
                 }
                 if (EditorGUI.EndChangeCheck())
                 {
                     AnimationWindowKeyframe keyframe = null;
                     foreach (AnimationWindowKeyframe keyframe2 in curve.m_Keyframes)
                     {
                         if (Mathf.Approximately(keyframe2.time, this.state.time.time))
                         {
                             keyframe = keyframe2;
                         }
                     }
                     if (keyframe == null)
                     {
                         AnimationWindowUtility.AddKeyframeToCurve(curve, num, editorCurveValueType, this.state.time);
                     }
                     else
                     {
                         keyframe.value = num;
                     }
                     this.state.SaveCurve(curve);
                     flag = true;
                 }
             }
         }
         EditorGUI.EndDisabledGroup();
         if (flag)
         {
             this.state.ResampleAnimation();
         }
     }
 }
 public bool GetTallMode(AnimationWindowHierarchyNode node)
 {
   return this.m_TallInstanceIDs.Contains(node.id);
 }
Exemplo n.º 47
0
 public static bool IsNodeLeftOverCurve(AnimationWindowHierarchyNode node, GameObject rootGameObject)
 {
     if (rootGameObject != null)
     {
         if (node.binding.HasValue)
         {
             return (AnimationUtility.GetEditorCurveValueType(rootGameObject, node.binding.Value) == null);
         }
         if (node.hasChildren)
         {
             foreach (TreeViewItem item in node.children)
             {
                 return IsNodeLeftOverCurve(item as AnimationWindowHierarchyNode, rootGameObject);
             }
         }
     }
     return false;
 }
		public List<AnimationWindowCurve> GetCurves(AnimationWindowHierarchyNode hierarchyNode, bool entireHierarchy)
		{
			return AnimationWindowUtility.FilterCurves(this.allCurves.ToArray(), hierarchyNode.path, hierarchyNode.animatableObjectType, hierarchyNode.propertyName);
		}
 private void DoFoldout(AnimationWindowHierarchyNode node, Rect rect, float indent, int row)
 {
     if (base.m_TreeView.data.IsExpandable(node))
     {
         Rect position = rect;
         position.x = indent;
         position.width = TreeViewGUI.s_Styles.foldoutWidth;
         EditorGUI.BeginChangeCheck();
         bool expand = GUI.Toggle(position, this.m_HierarchyItemFoldControlIDs[row], base.m_TreeView.data.IsExpanded(node), GUIContent.none, TreeViewGUI.s_Styles.foldout);
         if (EditorGUI.EndChangeCheck())
         {
             if (Event.current.alt)
             {
                 base.m_TreeView.data.SetExpandedWithChildren(node, expand);
             }
             else
             {
                 base.m_TreeView.data.SetExpanded(node, expand);
             }
         }
     }
     else
     {
         AnimationWindowHierarchyPropertyNode node2 = node as AnimationWindowHierarchyPropertyNode;
         AnimationWindowHierarchyState state = base.m_TreeView.state as AnimationWindowHierarchyState;
         if ((node2 != null) && node2.isPptrNode)
         {
             Rect rect3 = rect;
             rect3.x = indent;
             rect3.width = TreeViewGUI.s_Styles.foldoutWidth;
             EditorGUI.BeginChangeCheck();
             bool tallMode = state.GetTallMode(node2);
             tallMode = GUI.Toggle(rect3, this.m_HierarchyItemFoldControlIDs[row], tallMode, GUIContent.none, TreeViewGUI.s_Styles.foldout);
             if (EditorGUI.EndChangeCheck())
             {
                 state.SetTallMode(node2, tallMode);
             }
         }
     }
 }
 private void HandleContextMenu(Rect rect, AnimationWindowHierarchyNode node)
 {
     if ((Event.current.type == EventType.ContextClick) && rect.Contains(Event.current.mousePosition))
     {
         this.state.SelectHierarchyItem(node.id, false, true);
         this.GenerateMenu(this.state.selectedHierarchyNodes).ShowAsContext();
         Event.current.Use();
     }
 }
 public List<AnimationWindowKeyframe> GetAggregateKeys(AnimationWindowHierarchyNode hierarchyNode)
 {
   // ISSUE: object of a compiler-generated type is created
   // ISSUE: reference to a compiler-generated method
   DopeLine dopeLine = this.dopelines.FirstOrDefault<DopeLine>(new Func<DopeLine, bool>(new AnimationWindowState.\u003CGetAggregateKeys\u003Ec__AnonStorey43() { hierarchyNode = hierarchyNode }.\u003C\u003Em__71));
   if (dopeLine == null)
     return (List<AnimationWindowKeyframe>) null;
   return dopeLine.keys;
 }
Exemplo n.º 52
0
 public static bool IsNodeAmbiguous(AnimationWindowHierarchyNode node, GameObject rootGameObject)
 {
     if (rootGameObject != null)
     {
         if (node.binding.HasValue)
         {
             return AnimationUtility.AmbiguousBinding(node.binding.Value.path, node.binding.Value.m_ClassID, rootGameObject.transform);
         }
         if (node.hasChildren)
         {
             foreach (TreeViewItem item in node.children)
             {
                 return IsNodeAmbiguous(item as AnimationWindowHierarchyNode, rootGameObject);
             }
         }
     }
     return false;
 }
 public override bool BeginRename(TreeViewItem item, float delay)
 {
     this.m_RenamedNode = item as AnimationWindowHierarchyNode;
     return base.GetRenameOverlay().BeginRename(this.GetGameObjectName(this.m_RenamedNode.path), item.id, delay);
 }
 protected override void RenameEnded()
 {
     string name = base.GetRenameOverlay().name;
     string originalName = base.GetRenameOverlay().originalName;
     if (name != originalName)
     {
         foreach (AnimationWindowCurve curve in this.m_RenamedNode.curves)
         {
             string newPath = this.RenamePath(curve.path, name);
             EditorCurveBinding renamedBinding = AnimationWindowUtility.GetRenamedBinding(curve.binding, newPath);
             if (AnimationWindowUtility.CurveExists(renamedBinding, this.state.allCurves.ToArray()))
             {
                 Debug.LogWarning("Curve already exists, renaming cancelled.");
             }
             else
             {
                 AnimationWindowUtility.RenameCurvePath(curve, renamedBinding, this.state.activeAnimationClip);
             }
         }
     }
     this.m_RenamedNode = null;
 }
 public float GetNodeHeight(AnimationWindowHierarchyNode node)
 {
     if (node is AnimationWindowHierarchyAddButtonNode)
     {
         return 40f;
     }
     AnimationWindowHierarchyState state = base.m_TreeView.state as AnimationWindowHierarchyState;
     return (!state.GetTallMode(node) ? 16f : 32f);
 }
		public List<AnimationWindowKeyframe> GetAggregateKeys(AnimationWindowHierarchyNode hierarchyNode)
		{
			DopeLine dopeLine = this.dopelines.FirstOrDefault((DopeLine e) => e.m_HierarchyNodeID == hierarchyNode.id);
			if (dopeLine == null)
			{
				return null;
			}
			return dopeLine.keys;
		}
 private void DoCurveColorIndicator(Rect rect, AnimationWindowHierarchyNode node)
 {
     if (Event.current.type == EventType.Repaint)
     {
         Color color = GUI.color;
         if (!this.state.showCurveEditor)
         {
             GUI.color = k_KeyColorInDopesheetMode;
         }
         else if ((node.curves.Length == 1) && !node.curves[0].isPPtrCurve)
         {
             GUI.color = CurveUtility.GetPropertyColor(node.curves[0].binding.propertyName);
         }
         else
         {
             GUI.color = k_KeyColorForNonCurves;
         }
         bool flag = false;
         if (AnimationMode.InAnimationMode())
         {
             foreach (AnimationWindowCurve curve in node.curves)
             {
                 if (Enumerable.Any<AnimationWindowKeyframe>(curve.m_Keyframes, new Func<AnimationWindowKeyframe, bool>(this, (IntPtr) this.<DoCurveColorIndicator>m__1)))
                 {
                     flag = true;
                 }
             }
         }
         Texture image = !flag ? CurveUtility.GetIconCurve() : CurveUtility.GetIconKey();
         rect = new Rect(((rect.xMax - 10f) - (image.width / 2)) - 5f, rect.yMin + 3f, (float) image.width, (float) image.height);
         GUI.DrawTexture(rect, image, ScaleMode.ScaleToFit, true, 1f);
         GUI.color = color;
     }
 }
 private void DoCurveDropdown(Rect rect, AnimationWindowHierarchyNode node, int row, bool enabled)
 {
     rect = new Rect((rect.xMax - 10f) - 12f, rect.yMin + 2f, 22f, 12f);
     if (this.DoTreeViewButton(this.m_HierarchyItemButtonControlIDs[row], rect, GUIContent.none, this.m_AnimationCurveDropdown))
     {
         this.state.SelectHierarchyItem(node.id, false, false);
         AnimationWindowHierarchyNode[] source = new AnimationWindowHierarchyNode[] { node };
         this.GenerateMenu(Enumerable.ToList<AnimationWindowHierarchyNode>(source), enabled).DropDown(rect);
         Event.current.Use();
     }
 }
 protected void DoNodeGUI(Rect rect, AnimationWindowHierarchyNode node, bool selected, bool focused, int row)
 {
     this.InitStyles();
     if (!(node is AnimationWindowHierarchyMasterNode))
     {
         float indent = base.k_BaseIndent + ((node.depth + node.indent) * base.k_IndentWidth);
         if (node is AnimationWindowHierarchyAddButtonNode)
         {
             if ((Event.current.type == EventType.MouseMove) && (s_WasInsideValueRectFrame >= 0))
             {
                 if (s_WasInsideValueRectFrame >= (Time.frameCount - 1))
                 {
                     Event.current.Use();
                 }
                 else
                 {
                     s_WasInsideValueRectFrame = -1;
                 }
             }
             using (new EditorGUI.DisabledScope(!this.state.selection.canAddCurves))
             {
                 this.DoAddCurveButton(rect, node, row);
             }
         }
         else
         {
             this.DoRowBackground(rect, row);
             this.DoIconAndName(rect, node, selected, focused, indent);
             this.DoFoldout(node, rect, indent, row);
             bool enabled = false;
             if (node.curves != null)
             {
                 if (<>f__am$cache0 == null)
                 {
 private void DoAddCurveButton(Rect rect, AnimationWindowHierarchyNode node, int row)
 {
     float num = (rect.width - 230f) / 2f;
     float num2 = 10f;
     Rect position = new Rect(rect.xMin + num, rect.yMin + num2, rect.width - (num * 2f), rect.height - (num2 * 2f));
     if (this.DoTreeViewButton(this.m_HierarchyItemButtonControlIDs[row], position, this.k_AnimatePropertyLabel, GUI.skin.button))
     {
         AddCurvesPopup.selection = this.state.selection;
         AddCurvesPopupHierarchyDataSource.showEntireHierarchy = true;
         if (AddCurvesPopup.ShowAtPosition(position, this.state, new UnityEditorInternal.AddCurvesPopup.OnNewCurveAdded(this.OnNewCurveAdded)))
         {
             GUIUtility.ExitGUI();
         }
     }
 }