コード例 #1
0
 public override void FetchData()
 {
     if (AddCurvesPopup.selection != null)
     {
         AnimationWindowSelectionItem[] array = AddCurvesPopup.selection.ToArray();
         if (array.Length > 1)
         {
             this.m_RootItem = new AddCurvesPopupObjectNode(null, "", "");
         }
         AnimationWindowSelectionItem[] array2 = array;
         for (int i = 0; i < array2.Length; i++)
         {
             AnimationWindowSelectionItem animationWindowSelectionItem = array2[i];
             if (animationWindowSelectionItem.canAddCurves)
             {
                 if (animationWindowSelectionItem.rootGameObject != null)
                 {
                     this.AddGameObjectToHierarchy(animationWindowSelectionItem.rootGameObject, animationWindowSelectionItem, this.m_RootItem);
                 }
                 else if (animationWindowSelectionItem.scriptableObject != null)
                 {
                     this.AddScriptableObjectToHierarchy(animationWindowSelectionItem.scriptableObject, animationWindowSelectionItem, this.m_RootItem);
                 }
             }
         }
         this.SetupRootNodeSettings();
         this.m_NeedRefreshRows = true;
     }
 }
コード例 #2
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);
        }
コード例 #3
0
 public void Set(AnimationWindowSelectionItem newItem)
 {
     this.BeginOperations();
     this.Clear();
     this.Add(newItem);
     this.EndOperations();
 }
コード例 #4
0
        private TreeViewItem AddAnimatableObjectToHierarchy(AnimationWindowSelectionItem selectionItem, EditorCurveBinding[] curveBindings, TreeViewItem parentNode, string path)
        {
            TreeViewItem treeViewItem = new AddCurvesPopupObjectNode(parentNode, path, AddCurvesPopupHierarchyDataSource.GetClassName(selectionItem, curveBindings[0]));

            treeViewItem.icon = AddCurvesPopupHierarchyDataSource.GetIcon(selectionItem, curveBindings[0]);
            List <TreeViewItem>       list  = new List <TreeViewItem>();
            List <EditorCurveBinding> list2 = new List <EditorCurveBinding>();

            for (int i = 0; i < curveBindings.Length; i++)
            {
                EditorCurveBinding item = curveBindings[i];
                list2.Add(item);
                if (i == curveBindings.Length - 1 || AnimationWindowUtility.GetPropertyGroupName(curveBindings[i + 1].propertyName) != AnimationWindowUtility.GetPropertyGroupName(item.propertyName))
                {
                    TreeViewItem treeViewItem2 = this.CreateNode(selectionItem, list2.ToArray(), treeViewItem);
                    if (treeViewItem2 != null)
                    {
                        list.Add(treeViewItem2);
                    }
                    list2.Clear();
                }
            }
            list.Sort();
            TreeViewUtility.SetChildParentReferences(list, treeViewItem);
            return(treeViewItem);
        }
コード例 #5
0
 public void UpdateTimeOffset(AnimationWindowSelectionItem itemToUpdate, float timeOffset)
 {
     if (this.m_Selection.Contains(itemToUpdate))
     {
         itemToUpdate.timeOffset = timeOffset;
     }
 }
コード例 #6
0
 private AnimationWindowHierarchyClipNode AddClipNodeToHierarchy(AnimationWindowSelectionItem selectedItem, AnimationWindowCurve[] curves, AnimationWindowHierarchyNode parentNode)
 {
     return(new AnimationWindowHierarchyClipNode(parentNode, selectedItem.id, selectedItem.animationClip.name)
     {
         curves = curves
     });
 }
コード例 #7
0
 public void Add(AnimationWindowSelectionItem newItem)
 {
     if (!this.m_Selection.Contains(newItem))
     {
         this.m_Selection.Add(newItem);
         this.Notify();
     }
 }
コード例 #8
0
 public void UpdateClip(AnimationWindowSelectionItem itemToUpdate, AnimationClip newClip)
 {
     if (this.m_Selection.Contains(itemToUpdate))
     {
         itemToUpdate.animationClip = newClip;
         this.Notify();
     }
 }
コード例 #9
0
 public static void CreateDefaultCurves(IAnimationRecordingState state, AnimationWindowSelectionItem selectionItem, EditorCurveBinding[] properties)
 {
     properties = RotationCurveInterpolation.ConvertRotationPropertiesToDefaultInterpolation(selectionItem.animationClip, properties);
     EditorCurveBinding[] array = properties;
     for (int i = 0; i < array.Length; i++)
     {
         EditorCurveBinding binding = array[i];
         state.SaveCurve(AnimationWindowUtility.CreateDefaultCurve(selectionItem, binding));
     }
 }
コード例 #10
0
 public void Set(AnimationWindowSelectionItem newItem)
 {
     if (this.locked)
     {
         return;
     }
     this.BeginOperations();
     this.Clear();
     this.Add(newItem);
     this.EndOperations();
 }
コード例 #11
0
 public override bool BeginRename(TreeViewItem item, float delay)
 {
     this.m_RenamedNode = (item as AnimationWindowHierarchyNode);
     if (this.m_RenamedNode.curves.Length > 0)
     {
         AnimationWindowSelectionItem selectionBinding = this.m_RenamedNode.curves[0].selectionBinding;
         if (selectionBinding != null)
         {
             GameObject rootGameObject = selectionBinding.rootGameObject;
         }
     }
     return(base.GetRenameOverlay().BeginRename(this.m_RenamedNode.path, item.id, delay));
 }
コード例 #12
0
        private TreeViewItem CreateNode(AnimationWindowSelectionItem selectionItem, EditorCurveBinding[] curveBindings, TreeViewItem parentNode)
        {
            AddCurvesPopupPropertyNode addCurvesPopupPropertyNode = new AddCurvesPopupPropertyNode(parentNode, selectionItem, curveBindings);

            if (AnimationWindowUtility.IsRectTransformPosition(addCurvesPopupPropertyNode.curveBindings[0]))
            {
                addCurvesPopupPropertyNode.curveBindings = new EditorCurveBinding[]
                {
                    addCurvesPopupPropertyNode.curveBindings[2]
                };
            }
            addCurvesPopupPropertyNode.icon = parentNode.icon;
            return(addCurvesPopupPropertyNode);
        }
コード例 #13
0
        private static string GetClassName(AnimationWindowSelectionItem selectionItem, EditorCurveBinding binding)
        {
            string result;

            if (selectionItem.rootGameObject != null)
            {
                UnityEngine.Object animatedObject = AnimationUtility.GetAnimatedObject(selectionItem.rootGameObject, binding);
                if (animatedObject)
                {
                    result = ObjectNames.GetInspectorTitle(animatedObject);
                    return(result);
                }
            }
            result = binding.type.Name;
            return(result);
        }
コード例 #14
0
        public Texture2D GetIcon(AnimationWindowSelectionItem selectedItem, EditorCurveBinding curveBinding)
        {
            Texture2D result;

            if (selectedItem.rootGameObject != null)
            {
                UnityEngine.Object animatedObject = AnimationUtility.GetAnimatedObject(selectedItem.rootGameObject, curveBinding);
                if (animatedObject != null)
                {
                    result = AssetPreview.GetMiniThumbnail(animatedObject);
                    return(result);
                }
            }
            result = AssetPreview.GetMiniTypeThumbnail(curveBinding.type);
            return(result);
        }
コード例 #15
0
        override public bool BeginRename(TreeViewItem item, float delay)
        {
            m_RenamedNode = item as AnimationWindowHierarchyNode;

            GameObject rootGameObject = null;

            if (m_RenamedNode.curves.Length > 0)
            {
                AnimationWindowSelectionItem selectionBinding = m_RenamedNode.curves[0].selectionBinding;
                if (selectionBinding != null)
                {
                    rootGameObject = selectionBinding.rootGameObject;
                }
            }

            return(GetRenameOverlay().BeginRename(m_RenamedNode.path, item.id, delay));
        }
コード例 #16
0
        private static Texture2D GetIcon(AnimationWindowSelectionItem selectionItem, EditorCurveBinding binding)
        {
            Texture2D result;

            if (selectionItem.rootGameObject != null)
            {
                result = AssetPreview.GetMiniThumbnail(AnimationUtility.GetAnimatedObject(selectionItem.rootGameObject, binding));
            }
            else if (selectionItem.scriptableObject != null)
            {
                result = AssetPreview.GetMiniThumbnail(selectionItem.scriptableObject);
            }
            else
            {
                result = null;
            }
            return(result);
        }
コード例 #17
0
        public static AnimationWindowCurve CreateDefaultCurve(AnimationWindowSelectionItem selectionItem, EditorCurveBinding binding)
        {
            AnimationClip        animationClip        = selectionItem.animationClip;
            Type                 editorCurveValueType = selectionItem.GetEditorCurveValueType(binding);
            AnimationWindowCurve animationWindowCurve = new AnimationWindowCurve(animationClip, binding, editorCurveValueType);
            object               currentValue         = CurveBindingUtility.GetCurrentValue(selectionItem.rootGameObject, binding);

            if (animationClip.length == 0f)
            {
                AnimationWindowUtility.AddKeyframeToCurve(animationWindowCurve, currentValue, editorCurveValueType, AnimationKeyTime.Time(0f, animationClip.frameRate));
            }
            else
            {
                AnimationWindowUtility.AddKeyframeToCurve(animationWindowCurve, currentValue, editorCurveValueType, AnimationKeyTime.Time(0f, animationClip.frameRate));
                AnimationWindowUtility.AddKeyframeToCurve(animationWindowCurve, currentValue, editorCurveValueType, AnimationKeyTime.Time(animationClip.length, animationClip.frameRate));
            }
            return(animationWindowCurve);
        }
コード例 #18
0
        public void RangeAdd(AnimationWindowSelectionItem[] newItemArray)
        {
            bool flag = false;

            for (int i = 0; i < newItemArray.Length; i++)
            {
                AnimationWindowSelectionItem item = newItemArray[i];
                if (!this.m_Selection.Contains(item))
                {
                    this.m_Selection.Add(item);
                    flag = true;
                }
            }
            if (flag)
            {
                this.Notify();
            }
        }
コード例 #19
0
        private AnimationWindowHierarchyPropertyNode AddPropertyToHierarchy(AnimationWindowSelectionItem selectedItem, AnimationWindowCurve curve, AnimationWindowHierarchyNode parentNode)
        {
            AnimationWindowHierarchyPropertyNode animationWindowHierarchyPropertyNode = new AnimationWindowHierarchyPropertyNode(curve.type, selectedItem.id, curve.propertyName, curve.path, parentNode, curve.binding, curve.isPPtrCurve);

            if (parentNode.icon != null)
            {
                animationWindowHierarchyPropertyNode.icon = parentNode.icon;
            }
            else
            {
                animationWindowHierarchyPropertyNode.icon = this.GetIcon(curve.binding);
            }
            animationWindowHierarchyPropertyNode.indent = curve.depth;
            animationWindowHierarchyPropertyNode.curves = new AnimationWindowCurve[]
            {
                curve
            };
            return(animationWindowHierarchyPropertyNode);
        }
コード例 #20
0
        public bool IsEditable(UnityEngine.Object targetObject)
        {
            bool result;

            if (this.state.selection.disabled)
            {
                result = false;
            }
            else if (!this.previewing)
            {
                result = false;
            }
            else
            {
                AnimationWindowSelectionItem selectedItem = this.state.selectedItem;
                if (selectedItem != null)
                {
                    GameObject gameObject = null;
                    if (targetObject is Component)
                    {
                        gameObject = ((Component)targetObject).gameObject;
                    }
                    else if (targetObject is GameObject)
                    {
                        gameObject = (GameObject)targetObject;
                    }
                    if (gameObject != null)
                    {
                        Component closestAnimationPlayerComponentInParents = AnimationWindowUtility.GetClosestAnimationPlayerComponentInParents(gameObject.transform);
                        if (selectedItem.animationPlayer == closestAnimationPlayerComponentInParents)
                        {
                            result = selectedItem.animationIsEditable;
                            return(result);
                        }
                    }
                }
                result = false;
            }
            return(result);
        }
コード例 #21
0
 public override void ResampleAnimation()
 {
     if (!this.state.disabled)
     {
         if (this.previewing)
         {
             if (this.canPreview)
             {
                 bool flag = false;
                 AnimationMode.BeginSampling();
                 AnimationWindowSelectionItem[] array = this.state.selection.ToArray();
                 for (int i = 0; i < array.Length; i++)
                 {
                     AnimationWindowSelectionItem animationWindowSelectionItem = array[i];
                     if (animationWindowSelectionItem.animationClip != null)
                     {
                         Undo.FlushUndoRecordObjects();
                         AnimationMode.SampleAnimationClip(animationWindowSelectionItem.rootGameObject, animationWindowSelectionItem.animationClip, this.time.time - animationWindowSelectionItem.timeOffset);
                         if (this.m_CandidateClip != null)
                         {
                             AnimationMode.SampleCandidateClip(animationWindowSelectionItem.rootGameObject, this.m_CandidateClip, 0f);
                         }
                         flag = true;
                     }
                 }
                 AnimationMode.EndSampling();
                 if (flag)
                 {
                     SceneView.RepaintAll();
                     InspectorWindow.RepaintAllInspectors();
                     ParticleSystemWindow instance = ParticleSystemWindow.GetInstance();
                     if (instance)
                     {
                         instance.Repaint();
                     }
                 }
             }
         }
     }
 }
コード例 #22
0
        public List <AnimationWindowHierarchyNode> CreateTreeFromCurves()
        {
            List <AnimationWindowHierarchyNode> list  = new List <AnimationWindowHierarchyNode>();
            List <AnimationWindowCurve>         list2 = new List <AnimationWindowCurve>();

            AnimationWindowSelectionItem[] array = this.state.selection.ToArray();
            for (int i = 0; i < array.Length; i++)
            {
                AnimationWindowSelectionItem animationWindowSelectionItem = array[i];
                AnimationWindowCurve[]       array2     = animationWindowSelectionItem.curves.ToArray();
                AnimationWindowHierarchyNode parentNode = (AnimationWindowHierarchyNode)this.m_RootItem;
                if (this.state.selection.count > 1)
                {
                    AnimationWindowHierarchyNode animationWindowHierarchyNode = this.AddClipNodeToHierarchy(animationWindowSelectionItem, array2, parentNode);
                    list.Add(animationWindowHierarchyNode);
                    parentNode = animationWindowHierarchyNode;
                }
                for (int j = 0; j < array2.Length; j++)
                {
                    AnimationWindowCurve animationWindowCurve  = array2[j];
                    AnimationWindowCurve animationWindowCurve2 = (j >= array2.Length - 1) ? null : array2[j + 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 (j == array2.Length - 1 || !flag || !flag2)
                    {
                        if (list2.Count > 1)
                        {
                            list.Add(this.AddPropertyGroupToHierarchy(animationWindowSelectionItem, list2.ToArray(), parentNode));
                        }
                        else
                        {
                            list.Add(this.AddPropertyToHierarchy(animationWindowSelectionItem, list2[0], parentNode));
                        }
                        list2.Clear();
                    }
                }
            }
            return(list);
        }
コード例 #23
0
        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);
        }
コード例 #24
0
        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);
            }
        }
コード例 #25
0
 public bool Exists(AnimationWindowSelectionItem itemToFind)
 {
     return(this.m_Selection.Contains(itemToFind));
 }
コード例 #26
0
        private TreeViewItem AddScriptableObjectToHierarchy(ScriptableObject scriptableObject, AnimationWindowSelectionItem selectionItem, TreeViewItem parent)
        {
            EditorCurveBinding[] scriptableObjectAnimatableBindings = AnimationUtility.GetScriptableObjectAnimatableBindings(scriptableObject);
            EditorCurveBinding[] array = (from c in scriptableObjectAnimatableBindings
                                          where !AnimationWindowUtility.IsCurveCreated(selectionItem.animationClip, c)
                                          select c).ToArray <EditorCurveBinding>();
            TreeViewItem treeViewItem;

            if (array.Length > 0)
            {
                treeViewItem = this.AddAnimatableObjectToHierarchy(selectionItem, array, parent, "");
            }
            else
            {
                treeViewItem = new AddCurvesPopupObjectNode(parent, "", scriptableObject.name);
            }
            if (this.m_RootItem == null)
            {
                this.m_RootItem = treeViewItem;
            }
            return(treeViewItem);
        }
コード例 #27
0
        private TreeViewItem AddGameObjectToHierarchy(GameObject gameObject, AnimationWindowSelectionItem selectionItem, TreeViewItem parent)
        {
            string              path         = AnimationUtility.CalculateTransformPath(gameObject.transform, selectionItem.rootGameObject.transform);
            TreeViewItem        treeViewItem = new AddCurvesPopupGameObjectNode(gameObject, parent, gameObject.name);
            List <TreeViewItem> list         = new List <TreeViewItem>();

            if (this.m_RootItem == null)
            {
                this.m_RootItem = treeViewItem;
            }
            EditorCurveBinding[]      animatableBindings = AnimationUtility.GetAnimatableBindings(gameObject, selectionItem.rootGameObject);
            List <EditorCurveBinding> list2 = new List <EditorCurveBinding>();

            for (int i = 0; i < animatableBindings.Length; i++)
            {
                EditorCurveBinding editorCurveBinding = animatableBindings[i];
                list2.Add(editorCurveBinding);
                if (editorCurveBinding.propertyName == "m_IsActive")
                {
                    if (editorCurveBinding.path != "")
                    {
                        TreeViewItem treeViewItem2 = this.CreateNode(selectionItem, list2.ToArray(), treeViewItem);
                        if (treeViewItem2 != null)
                        {
                            list.Add(treeViewItem2);
                        }
                        list2.Clear();
                    }
                    else
                    {
                        list2.Clear();
                    }
                }
                else
                {
                    bool flag  = i == animatableBindings.Length - 1;
                    bool flag2 = false;
                    if (!flag)
                    {
                        flag2 = (animatableBindings[i + 1].type != editorCurveBinding.type);
                    }
                    if (AnimationWindowUtility.IsCurveCreated(selectionItem.animationClip, editorCurveBinding))
                    {
                        list2.Remove(editorCurveBinding);
                    }
                    if (editorCurveBinding.type == typeof(Animator) && editorCurveBinding.propertyName == "m_Enabled")
                    {
                        list2.Remove(editorCurveBinding);
                    }
                    if ((flag || flag2) && list2.Count > 0)
                    {
                        list.Add(this.AddAnimatableObjectToHierarchy(selectionItem, list2.ToArray(), treeViewItem, path));
                        list2.Clear();
                    }
                }
            }
            if (AddCurvesPopupHierarchyDataSource.showEntireHierarchy)
            {
                for (int j = 0; j < gameObject.transform.childCount; j++)
                {
                    Transform    child         = gameObject.transform.GetChild(j);
                    TreeViewItem treeViewItem3 = this.AddGameObjectToHierarchy(child.gameObject, selectionItem, treeViewItem);
                    if (treeViewItem3 != null)
                    {
                        list.Add(treeViewItem3);
                    }
                }
            }
            TreeViewUtility.SetChildParentReferences(list, treeViewItem);
            return(treeViewItem);
        }
コード例 #28
0
 public AddCurvesPopupPropertyNode(TreeViewItem parent, AnimationWindowSelectionItem selectionItem, EditorCurveBinding[] curveBindings) : base(curveBindings[0].GetHashCode(), parent.depth + 1, parent, AnimationWindowUtility.NicifyPropertyGroupName(curveBindings[0].type, AnimationWindowUtility.GetPropertyGroupName(curveBindings[0].propertyName)))
 {
     this.selectionItem = selectionItem;
     this.curveBindings = curveBindings;
 }
コード例 #29
0
        private AnimationWindowHierarchyPropertyGroupNode AddPropertyGroupToHierarchy(AnimationWindowSelectionItem selectedItem, AnimationWindowCurve[] curves, AnimationWindowHierarchyNode parentNode)
        {
            List <AnimationWindowHierarchyNode> list = new List <AnimationWindowHierarchyNode>();
            Type type = curves[0].type;
            AnimationWindowHierarchyPropertyGroupNode animationWindowHierarchyPropertyGroupNode = new AnimationWindowHierarchyPropertyGroupNode(type, selectedItem.id, 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(selectedItem, curve, animationWindowHierarchyPropertyGroupNode);
                animationWindowHierarchyPropertyNode.displayName = AnimationWindowUtility.GetPropertyDisplayName(animationWindowHierarchyPropertyNode.propertyName);
                list.Add(animationWindowHierarchyPropertyNode);
            }
            TreeViewUtility.SetChildParentReferences(new List <TreeViewItem>(list.ToArray()), animationWindowHierarchyPropertyGroupNode);
            return(animationWindowHierarchyPropertyGroupNode);
        }
コード例 #30
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);
     }
 }