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;
            }
        }
示例#2
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;
        }
        private void DoCurveColorIndicator(Rect rect, AnimationWindowHierarchyNode node)
        {
            if (Event.current.type != EventType.Repaint)
            {
                return;
            }
            Color color = GUI.color;

            if (!this.state.m_ShowCurveEditor)
            {
                GUI.color = AnimationWindowHierarchyGUI.k_KeyColorInDopesheetMode;
            }
            else
            {
                if (node.curves.Length == 1 && !node.curves[0].isPPtrCurve)
                {
                    GUI.color = CurveUtility.GetPropertyColor(node.curves[0].binding.propertyName);
                }
                else
                {
                    GUI.color = AnimationWindowHierarchyGUI.k_KeyColorForNonCurves;
                }
            }
            bool flag = false;

            if (AnimationMode.InAnimationMode())
            {
                AnimationWindowCurve[] curves = node.curves;
                for (int i = 0; i < curves.Length; i++)
                {
                    AnimationWindowCurve animationWindowCurve = curves[i];
                    if (animationWindowCurve.m_Keyframes.Any((AnimationWindowKeyframe key) => this.state.time.ContainsTime(key.time)))
                    {
                        flag = true;
                    }
                }
            }
            Texture texture = (!flag) ? CurveUtility.GetIconCurve() : CurveUtility.GetIconKey();

            rect = new Rect(rect.xMax - 10f - (float)(texture.width / 2) - 5f, rect.yMin + 3f, (float)texture.width, (float)texture.height);
            GUI.DrawTexture(rect, texture, ScaleMode.ScaleToFit, true, 1f);
            GUI.color = color;
        }
        private void DoCurveColorIndicator(Rect rect, AnimationWindowHierarchyNode node)
        {
            if (Event.current.type != EventType.Repaint)
            {
                return;
            }

            Color originalColor = GUI.color;

            if (!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 hasKey = false;

            if (state.previewing)
            {
                foreach (var curve in node.curves)
                {
                    if (curve.m_Keyframes.Any(key => state.time.ContainsTime(key.time)))
                    {
                        hasKey = true;
                    }
                }
            }

            Texture icon = hasKey ? CurveUtility.GetIconKey() : CurveUtility.GetIconCurve();

            rect = new Rect(rect.xMax - k_RowRightOffset - (icon.width / 2) - 5, rect.yMin + k_ColorIndicatorTopMargin, icon.width, icon.height);
            GUI.DrawTexture(rect, icon, ScaleMode.ScaleToFit, true, 1);

            GUI.color = originalColor;
        }