using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UIElements; using UnityEditor.Experimental.GraphView; using System; using System.Linq; using UnityObject = UnityEngine.Object; namespace UnityEditor.VFX.UI { class VFXSystemBorderFactory : UxmlFactory {} class VFXSystemBorder : GraphElement, IControlledElement, IDisposable { class Content : ImmediateModeElement { VFXSystemBorder m_Border; public Content(VFXSystemBorder border) { m_Border = border; } protected override void ImmediateRepaint() { m_Border.RecreateResources(); VFXView view = GetFirstAncestorOfType(); if (view != null && m_Border.m_Mat != null) { float radius = m_Border.resolvedStyle.borderTopLeftRadius; float realBorder = m_Border.resolvedStyle.borderLeftWidth * view.scale; Vector4 size = new Vector4(layout.width * .5f, layout.height * 0.5f, 0, 0); m_Border.m_Mat.SetVector("_Size", size); m_Border.m_Mat.SetFloat("_Border", realBorder < 1.75f ? 1.75f / view.scale : m_Border.resolvedStyle.borderLeftWidth); m_Border.m_Mat.SetFloat("_Radius", radius); float opacity = m_Border.resolvedStyle.opacity; Color start = (QualitySettings.activeColorSpace == ColorSpace.Linear) ? m_Border.startColor.gamma : m_Border.startColor; start.a *= opacity; m_Border.m_Mat.SetColor("_ColorStart", start); Color end = (QualitySettings.activeColorSpace == ColorSpace.Linear) ? m_Border.endColor.gamma : m_Border.endColor; end.a *= opacity; m_Border.m_Mat.SetColor("_ColorEnd", end); Color middle = (QualitySettings.activeColorSpace == ColorSpace.Linear) ? m_Border.middleColor.gamma : m_Border.middleColor; middle.a *= opacity; m_Border.m_Mat.SetColor("_ColorMiddle", middle); m_Border.m_Mat.SetPass(0); Graphics.DrawMeshNow(s_Mesh, Matrix4x4.Translate(new Vector3(size.x, size.y, 0))); } } } Material m_Mat; static Mesh s_Mesh; public VFXSystemBorder() { RecreateResources(); var tpl = VFXView.LoadUXML("VFXSystemBorder"); tpl.CloneTree(this); this.AddStyleSheetPath("VFXSystemBorder"); this.style.overflow = Overflow.Visible; m_Title = this.Query