Ejemplo n.º 1
0
 protected override void OnStyleResolved(ICustomStyle styles)
 {
     base.OnStyleResolved(styles);
     styles.ApplyCustomProperty("port-color", ref this.m_PortColor);
     styles.ApplyCustomProperty("disabled-port-color", ref this.m_DisabledPortColor);
     this.UpdateConnectorColor();
 }
Ejemplo n.º 2
0
 protected override void OnStyleResolved(ICustomStyle style)
 {
     base.OnStyleResolved(style);
     base.effectiveStyle.ApplyCustomProperty("selection-color", ref this.m_SelectionColor);
     base.effectiveStyle.ApplyCustomProperty("cursor-color", ref this.m_CursorColor);
     base.effectiveStyle.WriteToGUIStyle(this.editorEngine.style);
 }
Ejemplo n.º 3
0
        protected override void OnCustomStyleResolved(ICustomStyle styles)
        {
            base.OnCustomStyleResolved(styles);

            int   animDurationValue = 0;
            float heightValue       = 0f;
            float extentValue       = 0f;

            if (styles.TryGetValue(s_AnimationDuration, out animDurationValue))
            {
                m_AnimationDuration = animDurationValue;
            }

            if (styles.TryGetValue(s_SeparatorHeight, out heightValue))
            {
                m_SeparatorHeight = heightValue;
            }

            if (styles.TryGetValue(s_SeparatorExtent, out extentValue))
            {
                m_SeparatorExtent = extentValue;
            }

            schedule.Execute(a => UpdateSeparators());
        }
Ejemplo n.º 4
0
        protected override void OnCustomStyleResolved(ICustomStyle styles)
        {
            base.OnCustomStyleResolved(styles);

            int   edgeWidthValue   = 0;
            Color selectColorValue = Color.clear;
            Color edgeColorValue   = Color.clear;
            Color ghostColorValue  = Color.clear;

            if (styles.TryGetValue(s_EdgeWidthProperty, out edgeWidthValue))
            {
                m_EdgeWidth = edgeWidthValue;
            }

            if (styles.TryGetValue(s_SelectedEdgeColorProperty, out selectColorValue))
            {
                m_SelectedColor = selectColorValue;
            }

            if (styles.TryGetValue(s_EdgeColorProperty, out edgeColorValue))
            {
                m_DefaultColor = edgeColorValue;
            }

            if (styles.TryGetValue(s_GhostEdgeColorProperty, out ghostColorValue))
            {
                m_GhostColor = ghostColorValue;
            }
        }
Ejemplo n.º 5
0
        private void OnCustomStyleResolved(CustomStyleResolvedEvent e)
        {
            // We should consider not exposing image as a style at all, since it's intimately tied to uv/sourceRect
            Texture2D    textureValue = null;
            string       scaleModeValue;
            Color        tintValue   = Color.white;
            ICustomStyle customStyle = e.customStyle;

            if (!m_ImageIsInline && customStyle.TryGetValue(s_ImageProperty, out textureValue))
            {
                m_Image = textureValue;
            }

            if (!m_ScaleModeIsInline && customStyle.TryGetValue(s_ScaleModeProperty, out scaleModeValue))
            {
                int scaleModeIntValue;

                if (StyleSheetCache.TryParseEnum <ScaleMode>(scaleModeValue, out scaleModeIntValue))
                {
                    m_ScaleMode = (ScaleMode)scaleModeIntValue;
                }
            }

            if (!m_TintColorIsInline && customStyle.TryGetValue(s_TintColorProperty, out tintValue))
            {
                m_TintColor = tintValue;
            }
        }
Ejemplo n.º 6
0
        protected override void OnStyleResolved(ICustomStyle styles)
        {
            base.OnStyleResolved(styles);

            styles.ApplyCustomProperty("start-color", ref m_StartColor);
            styles.ApplyCustomProperty("end-color", ref m_EndColor);
        }
Ejemplo n.º 7
0
        private void OnCustomStyleResolved(CustomStyleResolvedEvent evt)
        {
            ICustomStyle styles = evt.customStyle;

            if (styles.TryGetValue(_background_image_property, out Texture2D value))
            {
                // if there is no background image create it
                if (_backgroundImage == null)
                {
                    _backgroundImage = TiledImage.CreateBackground(value);
                    _backgroundImage.AddToClassList("viewport-background");

                    hierarchy.Add(_backgroundImage);
                    _backgroundImage.SendToBack();
                    _backgroundImage.StretchToParentSize();

                    _contentContainer.RegisterCallback <GeometryChangedEvent>(e => UpdateBackground());
                }
                else
                {
                    _backgroundImage.SetTexture(value);
                }

                UpdateBackground();
            }
        }
Ejemplo n.º 8
0
 protected override void OnStyleResolved(ICustomStyle styles)
 {
     base.OnStyleResolved(styles);
     styles.ApplyCustomProperty("segment-size", ref this.m_SegmentSize);
     styles.ApplyCustomProperty("segment-color", ref this.m_SegmentColor);
     styles.ApplyCustomProperty("delete-segment-color", ref this.m_DeleteSegmentColor);
 }
Ejemplo n.º 9
0
        private void OnCustomStyleResolved(CustomStyleResolvedEvent e)
        {
            float spacingValue        = 0f;
            int   thicklinesValue     = 0;
            Color thicklineColorValue = Color.clear;
            Color lineColorValue      = Color.clear;
            Color gridColorValue      = Color.clear;

            ICustomStyle customStyle = e.customStyle;

            if (customStyle.TryGetValue(s_SpacingProperty, out spacingValue))
            {
                m_Spacing = spacingValue;
            }

            if (customStyle.TryGetValue(s_ThickLinesProperty, out thicklinesValue))
            {
                m_ThickLines = thickLines;
            }

            if (customStyle.TryGetValue(s_ThickLineColorProperty, out thicklineColorValue))
            {
                m_ThickLineColor = thicklineColorValue;
            }

            if (customStyle.TryGetValue(s_LineColorProperty, out lineColorValue))
            {
                m_LineColor = lineColorValue;
            }

            if (customStyle.TryGetValue(s_GridBackgroundColorProperty, out gridColorValue))
            {
                m_GridBackgroundColor = gridColorValue;
            }
        }
Ejemplo n.º 10
0
        protected override void OnStyleResolved(ICustomStyle style)
        {
            base.OnStyleResolved(style);
            int value = this.m_Layer.value;

            style.ApplyCustomProperty("layer", ref this.m_Layer);
            this.UpdateLayer(value);
        }
Ejemplo n.º 11
0
        protected override void OnStyleResolved(ICustomStyle styles)
        {
            base.OnStyleResolved(styles);

            styles.ApplyCustomProperty(k_ItemHeightProperty, ref m_ItemHeight);

            Refresh();
        }
Ejemplo n.º 12
0
 protected override void OnCustomStyleResolved(ICustomStyle style)
 {
     base.OnCustomStyleResolved(style);
     if (m_Container.visible)
     {
         m_EdgeControl.UpdateLayout();
     }
 }
Ejemplo n.º 13
0
            protected override void OnStyleResolved(ICustomStyle styles)
            {
                base.OnStyleResolved(styles);

                styles.ApplyCustomProperty(k_SegmentSizeProperty, ref m_SegmentSize);
                styles.ApplyCustomProperty(k_SegmentColorProperty, ref m_SegmentColor);
                styles.ApplyCustomProperty(k_DeleteSegmentColorProperty, ref m_DeleteSegmentColor);
            }
Ejemplo n.º 14
0
        protected override void OnStyleResolved(ICustomStyle style)
        {
            base.OnStyleResolved(style);

            effectiveStyle.ApplyCustomProperty(SelectionColorProperty, ref m_SelectionColor); // TODO: Switch over to default style properties
            effectiveStyle.ApplyCustomProperty(CursorColorProperty, ref m_CursorColor);
            effectiveStyle.WriteToGUIStyle(editorEngine.style);
        }
Ejemplo n.º 15
0
            protected override void OnStyleResolved(ICustomStyle style)
            {
                base.OnStyleResolved(style);
                float left        = depth * 12;
                var   paddingLeft = new StyleValue <float>(left);

                this.style.paddingLeft = paddingLeft;
            }
Ejemplo n.º 16
0
 protected override void OnStyleResolved(ICustomStyle styles)
 {
     base.OnStyleResolved(styles);
     styles.ApplyCustomProperty("edge-width", ref this.m_EdgeWidth);
     styles.ApplyCustomProperty("selected-edge-color", ref this.m_SelectedColor);
     styles.ApplyCustomProperty("ghost-edge-color", ref this.m_GhostColor);
     styles.ApplyCustomProperty("edge-color", ref this.m_DefaultColor);
 }
Ejemplo n.º 17
0
        protected override void OnStyleResolved(ICustomStyle style)
        {
            base.OnStyleResolved(style);
            int prevLayer = m_Layer.value;

            style.ApplyCustomProperty(k_LayerProperty, ref m_Layer);
            UpdateLayer(prevLayer);
        }
Ejemplo n.º 18
0
 protected override void OnStyleResolved(ICustomStyle styles)
 {
     base.OnStyleResolved(styles);
     styles.ApplyCustomProperty(k_EdgeColorProperty, ref m_EdgeColor);
     m_EdgeControl.UpdateLayout();
     m_EdgeControl.inputColor  = edgeColor;
     m_EdgeControl.outputColor = edgeColor;
 }
Ejemplo n.º 19
0
        protected override void OnStyleResolved(ICustomStyle styles)
        {
            base.OnStyleResolved(styles);

            styles.ApplyCustomProperty(k_EdgeWidthProperty, ref m_EdgeWidth);
            styles.ApplyCustomProperty(k_SelectedEdgeColorProperty, ref m_SelectedColor);
            styles.ApplyCustomProperty(k_GhostEdgeColorProperty, ref m_GhostColor);
            styles.ApplyCustomProperty(k_EdgeColorProperty, ref m_DefaultColor);
        }
 protected override void OnStyleResolved(ICustomStyle elementStyle)
 {
     base.OnStyleResolved(elementStyle);
     elementStyle.ApplyCustomProperty(k_SpacingProperty, ref m_Spacing);
     elementStyle.ApplyCustomProperty(k_ThickLinesProperty, ref m_ThickLines);
     elementStyle.ApplyCustomProperty(k_ThickLineColorProperty, ref m_ThickLineColor);
     elementStyle.ApplyCustomProperty(k_LineColorProperty, ref m_LineColor);
     elementStyle.ApplyCustomProperty(k_GridBackgroundColorProperty, ref m_GridBackgroundColor);
 }
Ejemplo n.º 21
0
        protected override void OnStyleResolved(ICustomStyle styles)
        {
            base.OnStyleResolved(styles);

            styles.ApplyCustomProperty(k_PortColorProperty, ref m_PortColor);
            styles.ApplyCustomProperty(k_DisabledPortColorProperty, ref m_DisabledPortColor);

            UpdateConnectorColor();
        }
Ejemplo n.º 22
0
 protected override void OnStyleResolved(ICustomStyle elementStyle)
 {
     base.OnStyleResolved(elementStyle);
     elementStyle.ApplyCustomProperty("spacing", ref this.m_Spacing);
     elementStyle.ApplyCustomProperty("thick-lines", ref this.m_ThickLines);
     elementStyle.ApplyCustomProperty("thick-line-color", ref this.m_ThickLineColor);
     elementStyle.ApplyCustomProperty("line-color", ref this.m_LineColor);
     elementStyle.ApplyCustomProperty("grid-background-color", ref this.m_GridBackgroundColor);
 }
Ejemplo n.º 23
0
        protected override void OnStyleResolved(ICustomStyle styles)
        {
            base.OnStyleResolved(styles);

            styles.ApplyCustomProperty(k_AnimationDuration, ref m_AnimationDuration);
            styles.ApplyCustomProperty(k_SeparatorHeight, ref m_SeparatorHeight);
            styles.ApplyCustomProperty(k_SeparatorExtent, ref m_SeparatorExtent);

            schedule.Execute(a => UpdateSeparators());
        }
Ejemplo n.º 24
0
 protected override void OnCustomStyleResolved(ICustomStyle style)
 {
     base.OnCustomStyleResolved(style);
     if (UIElementUtility.Theme.coloredNodeBorder)
     {
         Color c = uNodePreference.GetColorForType(nodeValuePort.GetPortType());
         c.a = 0.8f;
         border.style.SetBorderColor(c);
     }
 }
        /// <summary>
        /// Unity's Edge OnCustomStyleResolved is bugged and will unselect itself if it was selected too soon after the graphview was created.
        /// https://github.com/Unity-Technologies/UnityCsReference/blob/master/Modules/GraphViewEditor/Elements/Edge.cs
        /// https://github.com/Unity-Technologies/UnityCsReference/blob/master/Modules/GraphViewEditor/Views/GraphView.cs
        /// OnCustomStyleResolved eventually takes you to GraphView.ChangeLayer where it's trying to prevent it from unselecting itself but
        /// the result is it still does.
        /// Great way to see this is to override OnUnselected():
        //public override void OnUnselected()
        //{
        //    System.Diagnostics.StackTrace stackTrace = new System.Diagnostics.StackTrace();
        //    for (int i = 1; i < 25; i++)
        //    {
        //        if (i >= 3 && i <= 10)
        //        {
        //            continue;
        //        }
        //        System.Reflection.MethodBase method = stackTrace.GetFrame(i).GetMethod();
        //        Debug.Log("unselected " + method.ReflectedType.ToString() + " " + method.Name);
        //    }

        //    base.OnUnselected();
        //}
        /// For now, there is a hacky solution in place that re-selects the edgeview if it was originally selected by
        /// the GraphTheoryWindow's Deserialize method. Sed.
        /// </summary>
        /// <param name="styles"></param>
        protected override void OnCustomStyleResolved(ICustomStyle styles)
        {
            bool retain = selected && RetainSelected;

            base.OnCustomStyleResolved(styles);
            if (retain)
            {
                RetainSelected = false;
                GetFirstAncestorOfType <NodeGraphView>().AddToSelection(this);
            }
        }
Ejemplo n.º 26
0
        void OnCustomStyleResolved(CustomStyleResolvedEvent e)
        {
            Color portColorValue = Color.clear;

            ICustomStyle customStyle = e.customStyle;

            if (customStyle.TryGetValue(m_PortColorProperty, out portColorValue))
            {
                PortColor = portColorValue;
            }
        }
Ejemplo n.º 27
0
        protected virtual void OnCustomStyleResolved(ICustomStyle style)
        {
            int prevLayer = m_Layer;

            if (!m_LayerIsInline)
            {
                style.TryGetValue(s_LayerProperty, out m_Layer);
            }

            UpdateLayer(prevLayer);
        }
Ejemplo n.º 28
0
        protected override void OnStyleResolved(ICustomStyle elementStyle)
        {
            base.OnStyleResolved(elementStyle);

            // We should consider not exposing image as a style at all, since it's intimately tied to uv/sourceRect
            StyleValue <Texture2D> targetAsDefinition = new StyleValue <Texture2D>(m_Image.value as Texture2D, m_Image.specificity);

            elementStyle.ApplyCustomProperty("image", ref targetAsDefinition);
            m_Image = new StyleValue <Texture>(targetAsDefinition.value, targetAsDefinition.specificity);

            elementStyle.ApplyCustomProperty("image-size", ref m_ScaleMode);
        }
Ejemplo n.º 29
0
        protected override void OnStyleResolved(ICustomStyle style)
        {
            base.OnStyleResolved(style);

            Color color = curveColor;

            style.ApplyCustomProperty(k_CurveColorProperty, ref m_CurveColor);

            if (color != curveColor && renderMode == RenderMode.Texture)
            {
                // The mesh texture is updated at each repaint, the standard texture should however be regenerated
                m_TextureDirty = true;
            }
        }
Ejemplo n.º 30
0
        protected override void OnStyleResolved(ICustomStyle style)
        {
            base.OnStyleResolved(style);
#endif
            // Something is forcing style! Resetting a few things here, grrr.

            this.style.borderBottomWidth = 1;

            var resizer = this.Q(null, "resizer");
            if (resizer != null)
            {
                resizer.style.paddingTop  = 0;
                resizer.style.paddingLeft = 0;
            }
        }