Example #1
0
    private static void DrawColorKeyframeTools(ColorKeyframe keyframe)
    {
        Crazyflie drone = keyframe.Drone;

        EditorGUI.BeginChangeCheck();
        float updatedTime  = EditorGUILayout.FloatField("Time (seconds)", (float)keyframe.time);
        Color updatedColor = EditorGUILayout.ColorField(new GUIContent("Light Color"), keyframe.LightColor, false, false, false);

        if (EditorGUI.EndChangeCheck())
        {
            Undo.RecordObject(keyframe, "Change Color Keyframe");
            keyframe.time       = Mathf.Max(0, updatedTime);
            keyframe.LightColor = updatedColor;
            drone.UpdateView();
            TimelineEditor.Refresh(RefreshReason.ContentsModified);
        }

        EditorGUILayout.Space(30.0f);
        if (GUILayout.Button("Delete"))
        {
            drone.RemoveColorKeyframe(keyframe);
        }
    }
Example #2
0
    private static void DrawWaypointTools(Waypoint waypoint)
    {
        Crazyflie drone = waypoint.Drone;

        EditorGUI.BeginChangeCheck();
        float updatedTime = EditorGUILayout.FloatField("Time (seconds)", (float)waypoint.time);

        JointType updatedJointType = (JointType)EditorGUILayout.EnumPopup("Joint Type", waypoint.JointType);

        EditorGUILayout.Space(10);

        Vector3 updatedPosition = EditorGUILayout.Vector3Field(new GUIContent("Position"), waypoint.Position);

        EditorGUILayout.Space(10);

        GUI.enabled = (updatedJointType == JointType.Continuous);
        Vector3 updatedTangent = EditorGUILayout.Vector3Field(new GUIContent("Tangent"), waypoint.Tangent);

        EditorGUILayout.Space(30);
        GUI.enabled = true;

        if (EditorGUI.EndChangeCheck())
        {
            Undo.RecordObject(waypoint, "Change Waypoint");
            waypoint.time      = Mathf.Max(0, updatedTime);
            waypoint.Position  = updatedPosition;
            waypoint.Tangent   = updatedTangent;
            waypoint.JointType = updatedJointType;
            drone.UpdateView();
            TimelineEditor.Refresh(RefreshReason.ContentsModified);
        }

        if (GUILayout.Button("Delete"))
        {
            drone.RemoveWaypoint(waypoint);
        }
    }