Exemple #1
0
    protected override void OnDrawScene(SceneView scene)
    {
        ColorKeyframe keyframe = Target;
        Crazyflie     drone    = keyframe.Drone;

        CrazyflieEditor.Draw(drone);

        if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Delete)
        {
            drone.RemoveColorKeyframe(keyframe);
        }

        // -- GUI -- //
        DrawGUI(keyframe);
    }
Exemple #2
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);
        }
    }