Ejemplo n.º 1
0
 protected void GenerateCurveThumbs(EffectColorModifier colorMod)
 {
     miniRedCurve   = GraphUtils.GenerateCurveTexture(texWidth, texHeight, colorMod.rCurve, Color.red);
     miniBlueCurve  = GraphUtils.GenerateCurveTexture(texWidth, texHeight, colorMod.bCurve, Color.blue);
     miniGreenCurve = GraphUtils.GenerateCurveTexture(texWidth, texHeight, colorMod.gCurve, Color.green);
     miniAlphaCurve = GraphUtils.GenerateCurveTexture(texWidth, texHeight, colorMod.aCurve, Color.white);
 }
Ejemplo n.º 2
0
 public void ChangeCurve(FloatCurve curveToEdit)
 {
     Utils.Log($"Started editing curve {curveToEdit.ToString()}", LogType.UI);
     curve  = curveToEdit;
     points = GraphUtils.FloatCurveToPoints(curveToEdit);
     UpdateCurve(out curve);
     showWindow = true;
 }
Ejemplo n.º 3
0
        //
        public bool Compare(FloatCurve toCompare)
        {
            if (GraphUtils.FloatCurveToPoints(toCompare) != points)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 4
0
 public void ChangeCurve(FloatCurve curveToEdit, UIModifierWindow modWin, string tag)
 {
     modifier    = modWin;
     modifierTag = tag;
     Utils.Log($"Started editing curve {curveToEdit.ToString()}", LogType.UI);
     curve  = curveToEdit;
     points = GraphUtils.FloatCurveToPoints(curveToEdit);
     UpdateCurve(out curve);
     showWindow = true;
 }
Ejemplo n.º 5
0
        public UICurveEditWindow(FloatCurve curveToEdit, bool show) : base(show)
        {
            Utils.Log($"Started editing curve {curveToEdit.ToString()}");

            WindowPosition = new Rect(Screen.width / 2, Screen.height / 2, 678, 600);
            curve          = curveToEdit;

            points = GraphUtils.FloatCurveToPoints(curveToEdit);
            UpdateCurve(out curve);
        }
Ejemplo n.º 6
0
        public UICurveEditWindow(FloatCurve curveToEdit, UIModifierWindow modWin, string tag, bool show) : base(show)
        {
            modifier    = modWin;
            modifierTag = tag;
            Utils.Log($"Started editing curve {curveToEdit.ToString()}", LogType.UI);

            WindowPosition = new Rect(Screen.width / 2, Screen.height / 2, 678, 600);
            curve          = curveToEdit;

            points = GraphUtils.FloatCurveToPoints(curveToEdit);
            UpdateCurve(out curve);
        }
Ejemplo n.º 7
0
        public void UpdateCurve(out FloatCurve theCurve)
        {
            theCurve = new FloatCurve();
            foreach (FloatString4 v in points)
            {
                theCurve.Add(v.floats.x, v.floats.y, v.floats.z, v.floats.w);
            }

            theCurve.FindMinMaxValue(out minY, out maxY);
            curve = theCurve;
            WaterfallUI.Instance.UpdateCurve(curve);
            textVersion  = GraphUtils.PointsToString(points);
            graphTexture = GraphUtils.GenerateCurveTexture(texWidth, texHeight, curve, Color.green);
        }
Ejemplo n.º 8
0
 protected void GenerateCurveThumbs(EffectFloatModifier floatMod)
 {
     miniCurve = GraphUtils.GenerateCurveTexture(texWidth, texHeight, floatMod.curve, Color.green);
 }
Ejemplo n.º 9
0
 protected void GenerateCurveThumbs(EffectScaleModifier scaleMod)
 {
     miniXCurve = GraphUtils.GenerateCurveTexture(texWidth, texHeight, scaleMod.xCurve, Color.red);
     miniYCurve = GraphUtils.GenerateCurveTexture(texWidth, texHeight, scaleMod.yCurve, Color.blue);
     miniZCurve = GraphUtils.GenerateCurveTexture(texWidth, texHeight, scaleMod.zCurve, Color.green);
 }
Ejemplo n.º 10
0
        protected void DrawCurveEditor()
        {
            GUILayout.BeginHorizontal(GUILayout.Height(texHeight));

            Vector2 sizeMax = GUI.skin.label.CalcSize(new GUIContent(maxY.ToString("F3")));
            Vector2 sizeMin = GUI.skin.label.CalcSize(new GUIContent(minY.ToString("F3")));

            GUILayout.BeginVertical(GUILayout.MinWidth(Mathf.Max(sizeMin.x, sizeMax.x)));
            const int   GraphLabels = 4;
            const float labelSpace  = 20f * (GraphLabels + 1) / GraphLabels;

            for (int i = 0; i <= GraphLabels; i++)
            {
                GUILayout.Label((maxY - (maxY - minY) * i / GraphLabels).ToString("F3"), new GUIStyle(GUI.skin.label)
                {
                    wordWrap = false
                });
                if (i != GraphLabels) //only do it if it's not the last one
                {
                    GUILayout.Space(texHeight / GraphLabels - labelSpace);
                }
            }
            GUILayout.EndVertical();

            GUILayout.Box(graphTexture);

            GUILayout.EndHorizontal();

            FloatString4 excludePoint = null;

            scrollPos = GUILayout.BeginScrollView(scrollPos, GUILayout.ExpandWidth(true), GUILayout.Height(200));
            GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
            GUILayout.BeginVertical();
            GUILayout.Label("X");

            foreach (FloatString4 p in points)
            {
                string ns = GUILayout.TextField(p.strings[0]);
                if (ns != p.strings[0])
                {
                    p.strings[0] = ns;
                    p.UpdateFloats();
                    UpdateCurve(out curve);
                }
            }
            GUILayout.EndVertical();
            GUILayout.BeginVertical();
            GUILayout.Label("Y");
            foreach (FloatString4 p in points)
            {
                string ns = GUILayout.TextField(p.strings[1]);
                if (ns != p.strings[1])
                {
                    p.strings[1] = ns;
                    p.UpdateFloats();
                    UpdateCurve(out curve);
                }
            }
            GUILayout.EndVertical();
            GUILayout.BeginVertical();
            GUILayout.Label("In Tangent");
            foreach (FloatString4 p in points)
            {
                string ns = GUILayout.TextField(p.strings[2]);
                if (ns != p.strings[2])
                {
                    p.strings[2] = ns;
                    p.UpdateFloats();
                    UpdateCurve(out curve);
                }
            }
            GUILayout.EndVertical();
            GUILayout.BeginVertical();
            GUILayout.Label("Out Tangent");
            foreach (FloatString4 p in points)
            {
                string ns = GUILayout.TextField(p.strings[3]);
                if (ns != p.strings[3])
                {
                    p.strings[3] = ns;
                    p.UpdateFloats();
                    UpdateCurve(out curve);
                }
            }
            GUILayout.EndVertical();
            GUILayout.BeginVertical();
            GUILayout.Label("Remove");
            foreach (FloatString4 p in points)
            {
                if (GUILayout.Button("X"))
                {
                    excludePoint = p;
                }
            }
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            GUILayout.EndScrollView();

            if (excludePoint != null)
            {
                points.Remove(excludePoint);
                UpdateCurve(out curve);
            }

            GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
            // sort = GUILayout.Toggle(sort, "Sort");
            if (GUILayout.Button("New Curve"))
            {
                points.Clear();
                textVersion  = "";
                graphTexture = GraphUtils.GenerateCurveTexture(texWidth, texHeight, curve, Color.green);
            }
            if (GUILayout.Button("Smooth Tangents"))
            {
                //SmoothTangents();
            }
            if (GUILayout.Button("Copy out"))
            {
                GUIUtility.systemCopyBuffer = textVersion;
            }
            if (GUILayout.Button("Paste in"))
            {
                textVersion = GUIUtility.systemCopyBuffer;
                points      = GraphUtils.StringToPoints(textVersion);
                UpdateCurve(out curve);
            }
            if (GUILayout.Button("Add Node"))
            {
                if (points.Count > 0)
                {
                    points.Add(new FloatString4(points.Last().floats.x + 1, points.Last().floats.y, points.Last().floats.z, points.Last().floats.w));
                }
                else
                {
                    points.Add(new FloatString4(0, 0, 0, 0));
                }
                UpdateCurve(out curve);
            }
            GUILayout.EndHorizontal();
        }
 protected void GenerateCurveThumbs(EffectUVScrollModifier scaleMod)
 {
     miniXCurve = GraphUtils.GenerateCurveTexture(texWidth, texHeight, scrollMod.scrollCurveX, Color.red);
     miniYCurve = GraphUtils.GenerateCurveTexture(texWidth, texHeight, scrollMod.scrollCurveY, Color.blue);
 }
 protected void GenerateCurveThumbs()
 {
     miniCurve = GraphUtils.GenerateCurveTexture(texWidth, texHeight, eventCurve, Color.green);
 }