Example #1
0
 public static void CurveHandle(float width, float height, AnimationCurve curve, Vector3 position, Quaternion rotation, Color startColor, Color endColor)
 {
     curveHandle.matrix = Matrix4x4.TRS(position, rotation, Vector3.one);
     curveHandle.SetColors(startColor, endColor);
     curveHandle.Set2DSize(width, height);
     curveHandle.DrawHandle(curve);
 }
Example #2
0
    public void OnSceneGUI(SceneView sv)
    {
        var cso = target as CurveScriptableObject;

        curveHandle.Set2DSize(cso.curveSize);
        curveHandle.SetColors(cso.curveGradient);
        curveHandle.curveSamples = cso.sampleCount;

        AnimationCurve modifiedCurve = curveHandle.DrawHandle(cso.curve);

        if (GUI.changed)
        {
            Undo.RecordObject(target, "Changed curve");
            cso.curve = modifiedCurve;
        }
    }