Exemplo n.º 1
0
        private static void setupCurveData(FloatCurve curve)
        {
            curveData.Clear();
            int             len = curve.Curve.length;
            FloatCurveEntry entry;

            for (int i = 0; i < len; i++)
            {
                entry = new FloatCurveEntry(curve.Curve[i].time, curve.Curve[i].value, curve.Curve[i].inTangent, curve.Curve[i].outTangent);
                curveData.Add(entry);
            }
        }
Exemplo n.º 2
0
        private static void updateGraphWindow(int id)
        {
            GUILayout.BeginVertical();
            GUILayout.Box(texture);
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Load Preset", GUILayout.Width(200)))
            {
                presetWindowOpen = true;
            }
            if (GUILayout.Button("Clear Data", GUILayout.Width(200)))
            {
                clearData();
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Key", GUILayout.Width(100));
            GUILayout.Label("Value", GUILayout.Width(100));
            GUILayout.Label("In", GUILayout.Width(100));
            GUILayout.Label("Out", GUILayout.Width(100));
            GUILayout.EndHorizontal();
            scrollPos = GUILayout.BeginScrollView(scrollPos);
            FloatCurveEntry data;
            int             removeIndex = -1;
            FloatCurveEntry added       = null;
            bool            updateGraph = false;
            int             len         = curveData.Count;

            if (len == 0)
            {
                GUILayout.Label("No curve data available");
                if (GUILayout.Button("Add New Data Point"))
                {
                    added = new FloatCurveEntry(0, 0, 1, 1);
                }
            }
            for (int i = 0; i < len; i++)
            {
                GUILayout.BeginHorizontal();
                data = curveData[i];
                data.stringValues[0] = GUILayout.TextField(data.stringValues[0], GUILayout.Width(100));
                data.stringValues[1] = GUILayout.TextField(data.stringValues[1], GUILayout.Width(100));
                data.stringValues[3] = GUILayout.TextField(data.stringValues[3], GUILayout.Width(100));
                data.stringValues[2] = GUILayout.TextField(data.stringValues[2], GUILayout.Width(100));
                if (GUILayout.Button("Delete", GUILayout.Width(100)))
                {
                    removeIndex = i;
                }
                if (GUILayout.Button("Copy", GUILayout.Width(100)))
                {
                    added = new FloatCurveEntry(data.values.x, data.values.y, data.values.z, data.values.w);
                }
                if (data.updateValues())
                {
                    updateGraph = true;
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndScrollView();
            if (GUILayout.Button("Sort Keys"))
            {
                sortKeys(false);
            }
            if (GUILayout.Button("Close GUI"))
            {
                closeGUI();
            }
            GUILayout.EndVertical();
            GUI.DragWindow();
            if (removeIndex >= 0 && len > 1)//do not remove last key
            {
                curveData.RemoveAt(removeIndex);
                updateGraph = true;
            }
            if (added != null)
            {
                curveData.Add(added);
                updateGraph = true;
            }
            if (updateGraph)
            {
                presetName = "";
                updateGraphTexture();
            }
        }
Exemplo n.º 3
0
 private static void updateGraphWindow(int id)
 {
     GUILayout.BeginVertical();
     GUILayout.Box(texture);
     GUILayout.BeginHorizontal();
     if (GUILayout.Button("Load Preset", GUILayout.Width(200)))
     {
         presetWindowOpen = true;
     }
     if (GUILayout.Button("Clear Data", GUILayout.Width(200)))
     {
         clearData();
     }
     GUILayout.EndHorizontal();
     GUILayout.BeginHorizontal();
     GUILayout.Label("Key", GUILayout.Width(100));
     GUILayout.Label("Value", GUILayout.Width(100));
     GUILayout.Label("In", GUILayout.Width(100));
     GUILayout.Label("Out", GUILayout.Width(100));
     GUILayout.EndHorizontal();
     scrollPos = GUILayout.BeginScrollView(scrollPos);
     FloatCurveEntry data;
     int removeIndex = -1;
     FloatCurveEntry added = null;
     bool updateGraph = false;
     int len = curveData.Count;
     if (len == 0)
     {
         GUILayout.Label("No curve data available");
         if (GUILayout.Button("Add New Data Point"))
         {
             added = new FloatCurveEntry(0, 0, 1, 1);
         }
     }
     for (int i = 0; i < len; i++)
     {
         GUILayout.BeginHorizontal();
         data = curveData[i];
         data.stringValues[0] = GUILayout.TextField(data.stringValues[0], GUILayout.Width(100));
         data.stringValues[1] = GUILayout.TextField(data.stringValues[1], GUILayout.Width(100));
         data.stringValues[3] = GUILayout.TextField(data.stringValues[3], GUILayout.Width(100));
         data.stringValues[2] = GUILayout.TextField(data.stringValues[2], GUILayout.Width(100));
         if (GUILayout.Button("Delete", GUILayout.Width(100)))
         {
             removeIndex = i;
         }
         if (GUILayout.Button("Copy", GUILayout.Width(100)))
         {
             added = new FloatCurveEntry(data.values.x, data.values.y, data.values.z, data.values.w);
         }
         if (data.updateValues()) { updateGraph = true; }
         GUILayout.EndHorizontal();
     }
     GUILayout.EndScrollView();
     if (GUILayout.Button("Sort Keys"))
     {
         sortKeys(false);
     }
     if (GUILayout.Button("Close GUI"))
     {
         closeGUI();
     }
     GUILayout.EndVertical();
     GUI.DragWindow();
     if (removeIndex >= 0 && len > 1)//do not remove last key
     {
         curveData.RemoveAt(removeIndex);
         updateGraph = true;
     }
     if (added != null)
     {
         curveData.Add(added);
         updateGraph = true;
     }
     if (updateGraph)
     {
         presetName = "";
         updateGraphTexture();
     }
 }
Exemplo n.º 4
0
 private static void setupCurveData(FloatCurve curve)
 {
     curveData.Clear();
     int len = curve.Curve.length;
     FloatCurveEntry entry;
     for (int i = 0; i < len; i++)
     {
         entry = new FloatCurveEntry(curve.Curve[i].time, curve.Curve[i].value, curve.Curve[i].inTangent, curve.Curve[i].outTangent);
         curveData.Add(entry);
     }
 }