Curves Editor

Explanation

The Curves Editor is a new utility which should help you fine tune a lot of aspects of our pinball simulation.
The goal is to define the way a parameter changes according to antoher one.
This lead to a 2D curve, and this tool is used to create, modify, setup, define and comment it.

 

A demo of this functionality can be seen in this video.

 

Overview

This capture shows, on the left, the control panel (Options and Functions), used to create, save, delete and select curves. On the right, the currently selected curve is displayed and is able to be edited.

 

Control panel

Save functions

This will save current curves and their modifications in to config/StandardFunctions.xml.
In future release, the saving path will be choosable.

Create New

Creates a new simple ease in/out curve and add it to the Functions list.

Delete

This will delete the currently selected function

Background image...

Open a file dialog to choose a background helper image. More informations lower on this page.

Functions

Available curves are listed here. Click on checkboxes to display the corresponding curves on the curve panel.

 

Curve panel

By default, the curve is in "viewing mode", a.k.a, it cannot be edited.
The only possible interaction is to show a description of the curve by clicking the  button next to the curve title:

It then turns to a  button. Click on it to close the description box.

To swap to edit mode, click on the :

Click again on  to return to viewing mode.

 

Curve Edition

In edition mode, all curves parameters are editable. You can change the title, the axes labels, the ranges, the curve description by clicking   again and the curve shape by moving/adding/deleting control points.

Range

 When you create a new curve, the parameter, let's call it x, can vary between 0 and 1 by default, and the value returned, let's call f(x), is also bounded to the [0 - 1] interval. You can change it by filling the corresponding text fields. If the value entered is not valid (floating point value), the field's color turns to red.

 

Control Points

To change the shape of the curve, we use control points. You add control points by left-clicking the curve itself while holding Control key:

To delete a point, left-click on it while holding the Alt key.

 

You can drag the point in the curve area with the left mouse button to change the shape of the curve.

Note: The first and the last point of the curve are contrained to stay on the borders of the area.

 

There are currently three types of control points:

 

Corner

This is the simplest control point type. The line comes-in straight and goes out straight too.

 
  
Smooth

In and out tangents are linked: when you move one, the other one moves accordingliy to keep and smooth transition.

 
  
Smooth Corner

In tangent (yellow) and out tangent (green) can be modified separately.

 
  

 To change a point's type, simply right-click on it: the type will switch to the next control type.

 

Background image

We also added a simple yet very handy tool: the background image helper. This helps you to quiclky design a curve, from example using an internet image of a function's plot.

Click on Background image... on the Options group, then double click your image file: it will be displayed under the curve area:

 

 

Todo

  • Table/Script specific functions
  • API to use custom functions in script
  • Delete question box
  • Saving/erasing message box
  • Context menu for control points options
  • Include to Undo/Redo framework