CircuitLord / NotReaper

A mapper for the VR rhythm game Audica
GNU General Public License v3.0
21 stars 14 forks source link

Basic Path Builder! #76

Closed Mettra closed 4 years ago

Mettra commented 4 years ago

This PR adds a path builder for NotReaper, similar to the path builder found in Reaper!

Clicking on the "Path Builder" button (or using the hotkey T) will open the beautiful UI: veryprettypathbuilder

Upon converting a note (or clicking on a valid pathbuilder note) the ui changes: fullpathbuilder

Pathbuilder notes act similar to sustain notes, with buttons above them to change the length of time the path takes to complete. The initial angle can be changed by holding down on a note, then moving outside the note to select the angle: initialangle

The options in the pathbuilding window are similar to the ones found in Reaper. One very important difference is that these values represent the final position at the end of the curve, not per step. I.E A value of 180° means the path will be semicircular in total, not incrementing by 180° per note placed)

As you change these values, you will see a line representing the path through all notes that will be generated by the path builder. Pressing "Generate Path", or exiting the path builder will place the notes.

values

Converting to a pathbuilder note is handled in undo/redo, although changing beat length or any pathbuilder values are not undo/redo-able.

The notes generated by pathbuilder notes are not intractable in any way, however the pathbuilder notes themselves are fully compatible as notes themselves, with the ability to move along the grid and timeline, and flip hand type as well as horizontally/vertically.

Some technical details

When saving out .cues files, all the pathbuilder notes are stripped and only the generated notes remain. The data is still saved, just under a new tag NRCueData. A sample looks like this:

"NRCueData": {
"pathBuilderNoteCues": [
    {
        "tick": 6720,
        "tickLength": 1920,
        "pitch": 43,
        "velocity": 0,
        "gridOffset": {
            "x": 0.0,
            "y": 0.0
        },
        "zOffset": 0.0,
        "handType": 2,
        "behavior": 101
    },
    {
        "tick": 6720,
        "tickLength": 1920,
        "pitch": 44,
        "velocity": 0,
        "gridOffset": {
            "x": 0.0,
            "y": 0.0
        },
        "zOffset": 0.0,
        "handType": 1,
        "behavior": 101
    },
    {
        "tick": 9600,
        "tickLength": 1920,
        "pitch": 40,
        "velocity": 0,
        "gridOffset": {
            "x": 0.0,
            "y": 0.0
        },
        "zOffset": 0.0,
        "handType": 2,
        "behavior": 101
    },
    {
        "tick": 9600,
        "tickLength": 1920,
        "pitch": 44,
        "velocity": 0,
        "gridOffset": {
            "x": 0.0,
            "y": 0.0
        },
        "zOffset": 0.0,
        "handType": 1,
        "behavior": 101
    }
],
"pathBuilderNoteData": [
    {
        "_behavior": 4,
        "_velocity": 1,
        "_handType": 2,
        "_interval": 16,
        "_initialAngle": 45.0,
        "_angle": 0.0,
        "_angleIncrement": 0.0,
        "_stepDistance": 0.5,
        "_stepIncrement": 0.0
    },
    {
        "_behavior": 4,
        "_velocity": 1,
        "_handType": 1,
        "_interval": 16,
        "_initialAngle": 45.0,
        "_angle": 0.0,
        "_angleIncrement": 0.0,
        "_stepDistance": 0.5,
        "_stepIncrement": 0.0
    },
    {
        "_behavior": 4,
        "_velocity": 1,
        "_handType": 2,
        "_interval": 16,
        "_initialAngle": -45.0,
        "_angle": 0.0,
        "_angleIncrement": 0.0,
        "_stepDistance": 0.5,
        "_stepIncrement": 0.0
    },
    {
        "_behavior": 4,
        "_velocity": 1,
        "_handType": 1,
        "_interval": 16,
        "_initialAngle": 45.0,
        "_angle": 0.0,
        "_angleIncrement": 0.0,
        "_stepDistance": 0.5,
        "_stepIncrement": 0.0
    }
]

When loading an .audica file with this data, NR will re-create the pathbuilder notes, and delete any notes in the original cues that match the generated notes of the pathbuilder. This does mean that if there are any changes to the pathbuilder algorithm, we will have to have some backwards compatibility path to load older NR saves without duplicate notes.