コード例 #1
0
    private Vector3 ShowPoint(int index)
    {
        Vector3 point      = t.TransformPoint(spline.GetPoint(index));
        float   firstPoint = index == 0 ? 2f : 1f;

        if (Handles.Button(point, q, 0.2f * firstPoint, 0.6f, Handles.DotCap))
        {
            selectedIndex = index;
        }

        Handles.color = Color.gray;
        if (selectedIndex == index)
        {
            EditorGUI.BeginChangeCheck();
            point = Handles.DoPositionHandle(point, q);
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(spline, "CatmullRom Moved");
                EditorUtility.SetDirty(spline);
                spline.SetPoint(index, t.InverseTransformPoint(point));
            }
        }
        return(point);
    }