PKBeam / Edda

A beatmap editor for the VR rhythm game Ragnarock
GNU General Public License v3.0
34 stars 8 forks source link

Improve clipboard support #139

Open Brollyy opened 2 weeks ago

Brollyy commented 2 weeks ago

133

I'm very sorry for a large PR - while working on the clipboard, I've also noticed several performance issues and smaller bugs with rune images sometimes showing X wrongly, so I've ended up going a bit too far and fixing them here as well.

Changelist

  1. Implemented native clipboard support for copying and pasting notes, using open source RagnaRuneString library by @Brollyy to enable clipboard support outside Edda as well.
  2. Implemented three different options when pasting notes, allowing mappers to select how they want the notes to be pasted, depending on source/target BPM.
  3. Significantly improved performance of editor actions:
    • highlighting and unhighlightning notes in large bulks
    • highlighting all notes (Ctrl+A) and unhighlightning all notes (Esc)
    • reversing large edit lists (Ctrl+Z)

Copy/paste

To better illustrate what these changes are mainly about, I'll provide a few examples of how the new code behaves.

  1. Go into Edda and select some notes (these ones come from a song with 155 global BPM). image
  2. Ctrl+C to copy the notes into clipboard.
  3. Ctrl+V somewhere else to paste the notes, just as before, but now it works automatically for:
    • a different map difficulty
    • another Edda window - you can have multiple windows open and copy/paste between them, or copy notes from one song and then open another song and paste them there
    • any text editor - notes will be pasted in RagnaRuneString format (looks similar to Hearthstone deckcodes, e.g. AAEJ+IsEvJ8EgLMExMYEiNoEzO0EkIEF1JQFmKgFG7kAAAACALDNXpY3sM1e), which can then be copied and pasted again into Edda seemlessly. This is the main use-case for the library, to enable easy sharing of patterns on Discord or RagnaCustoms. I also have plans in the near future to create a small Discord bot that will generate and post visualizations of these runestrings, so we can stop talking about patterns in ASCII art 😄

When pasting previously copied notes or a runestring, Edda will now have three modes of how the new notes will be added:

1. Align to global beat

This is how the copy/paste worked in Edda until now - you move the global beats of the copied notes by an offset determined by current mouse position and then add them to the map.

Fully inside section with global BPM: image

Fully inside section with different BPM: image

Partially inside both global BPM and different BPM: image

Partially inside different BPM and then global BPM: image

Pros:

Cons:

2. Align to first note BPM

This is very similar to the previous mode, but the timing of all the pasted notes is scaled relative to the BPM from which the first copied note came from, and the BPM at the current mouse position. For example, when copying the pattern above into a different section with 120 BPM, the notes will align to the grid, but that won't be the case if the timing change occurs somewhere after the first pasted note.

Fully inside section with global BPM: image

Fully inside section with different BPM: image

Partially inside both global BPM and different BPM: image

Partially inside different BPM and then global BPM: image

Pros:

Cons:

3. Align to all notes BPM (default)

While it's more complicated to explain how this mode work in detail, it's designed to remedy the issue from the previous mode, so that the copied pattern "looks" the same on the grid as it "looked" when it was copied.

Fully inside section with global BPM: image

Fully inside section with different BPM: image

Partially inside both global BPM and different BPM: image

Partially inside different BPM and then global BPM: image

Pros:

Cons:

Before I've implemented these changes, I've run a poll on Discord channel to see which option would be preferable - this is why the last mode is selected as the new default.

The selected mode can be changed in the settings: image

Brollyy commented 23 hours ago

@PKBeam It's been two weeks without any further bug reports for 1.2.7b1, so I don't think I'll need to change anything in this PR anymore. I've also mapped a few songs with 1.2.7b1 without noticing any issues and confirmed with Watsu that he didn't see any issues as well.