-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Song Editor - Pasting tco on first position #5840
Comments
Thanks! A duplicate it is. Closing. |
Sorry... Those were closed already. Sticking to this one then. |
Can't reproduce on my development copy on linux, should I pull an even newer copy to test? |
Pulled latest master, still can't reproduce. Steps? OS? |
He, he. A bit of a mystery then. I think I will have to do a bisect down to where it happens for me on master then.
I'm now on Ubuntu/Mate 20.10
I notice now that this bug is only if you copy a pattern that starts on the first bar to a second instruments first bar so the steps to test replicate this is:
|
@zonkmachine That's a weird one. If you create the TCO on the second bar of the first track and copy/paste on the first bar of the second track it works fine. So it seems to be a requirement for the bug to happen that the TCO being copied is at the first bar.. |
Ok, I know what's happening. Any time you copy from one bar to the same bar, the clip will be offset to avoid landing on itself. Looks like the logic doesn't account for the fact that you're pasting on another track. |
Unfortunately I'm lost in the new copy/paste code and can't find where the offset happens anymore. @IanCaio you did the clipboard updates, right? |
Yes, if I'm not mistaken the offset calculation starts here: lmms/src/gui/widgets/TrackContentWidget.cpp Lines 478 to 482 in 3d7d005
And the problem might be here: lmms/src/gui/widgets/TrackContentWidget.cpp Line 511 in 3d7d005
|
PR opened :) |
This left shift is decided in SongEditor::getSnapSize() and is relative to the Quantization setting. I don't think this is working well. |
Just a note, I think that's unrelated to the first issue that Spekular submitted a fix to. I'm trying to figure out what it could be, probably some error while calculating the |
I think so too. You right click for the context menu and then left click to choose paste. Is this right click/left click combination passed on to the pattern underneath as a delete command? |
I think I found the issue: lmms/src/gui/widgets/TrackContentWidget.cpp Lines 479 to 482 in 3d7d005
Line 480 subtracts half the snapsize from the offset. The idea is that if the snapsize is 1 bar for example, and you click on the second half of the bar, you'll still paste the TCO on that bar instead of the next one. The logic is as follows:
That works fine if the offset is positive, so clicking on paste in a TCO after the one you copied works fine. When the offset is negative on the other hand (the TCO is before the one being copied),
Lines 66 to 78 in 3d7d005
I'd still have to think what is a good fix for that. |
I'm not sure changing Should we make an exception for the negative side and instead of snapping on the range |
TimePos::quantize works for negative values, but ends up snapping the TCO to the opposite direction. This is because the snapping happens in the direction of the origin, which is left for positive values and right for negative values. That wasn't accounted for in the pasteSelection method and we ended up with wrong positions when pasting before the TCO(s) we copied. This PR attempts a fix by doing the following: - Changing TimePos::quantize to have a boolean parameter that will define whether it snaps the position up if we are halfway through the interval or not (this removes the need to use that trick of subtracting "TimePos::ticksPerBar() * snapSize / 2" from the offset to try to "bias" it. - Checking if we need quantizing at all by checking if the offset falls outsize the snap grid. - If we do need quantizing and the offset is negative we subtract one snap, since the quantization will move the TCO to the opposite end (to the right). Then we call quantize.
Posted a possible fix for the second issue. The first one will still happen (pasting on the same position in a separate track) because it's a separate fix. Another noticed behavior which is more a misbehavior than a bug, but still something we should change later: If we copy a TCO, delete it and try to paste on the same position it was before it will snap up, because it will still consider we can't copy on the same position we had before, even though the TCO was removed. |
* Fixes bug with pasting of TCOs (#5840) TimePos::quantize works for negative values, but ends up snapping the TCO to the opposite direction. This is because the snapping happens in the direction of the origin, which is left for positive values and right for negative values. That wasn't accounted for in the pasteSelection method and we ended up with wrong positions when pasting before the TCO(s) we copied. This PR fixes the issue by ensuring that we snap in the same direction when halfway through an interval, regardless of negative or positive offset. * Fixes a calculation on TimePos::quantize Since we are working with integers, using "offset / (interval/2)" would be problematic if interval was odd. We instead multiply both sides by two and use "(2 * offset) / interval" to obtain the result for snapUp.
* Fixes bug with pasting of TCOs (LMMS#5840) TimePos::quantize works for negative values, but ends up snapping the TCO to the opposite direction. This is because the snapping happens in the direction of the origin, which is left for positive values and right for negative values. That wasn't accounted for in the pasteSelection method and we ended up with wrong positions when pasting before the TCO(s) we copied. This PR fixes the issue by ensuring that we snap in the same direction when halfway through an interval, regardless of negative or positive offset. * Fixes a calculation on TimePos::quantize Since we are working with integers, using "offset / (interval/2)" would be problematic if interval was odd. We instead multiply both sides by two and use "(2 * offset) / interval" to obtain the result for snapUp.
* Fixes bug with pasting of TCOs (LMMS#5840) TimePos::quantize works for negative values, but ends up snapping the TCO to the opposite direction. This is because the snapping happens in the direction of the origin, which is left for positive values and right for negative values. That wasn't accounted for in the pasteSelection method and we ended up with wrong positions when pasting before the TCO(s) we copied. This PR fixes the issue by ensuring that we snap in the same direction when halfway through an interval, regardless of negative or positive offset. * Fixes a calculation on TimePos::quantize Since we are working with integers, using "offset / (interval/2)" would be problematic if interval was odd. We instead multiply both sides by two and use "(2 * offset) / interval" to obtain the result for snapUp.
* Fixes bug with pasting of TCOs (LMMS#5840) TimePos::quantize works for negative values, but ends up snapping the TCO to the opposite direction. This is because the snapping happens in the direction of the origin, which is left for positive values and right for negative values. That wasn't accounted for in the pasteSelection method and we ended up with wrong positions when pasting before the TCO(s) we copied. This PR fixes the issue by ensuring that we snap in the same direction when halfway through an interval, regardless of negative or positive offset. * Fixes a calculation on TimePos::quantize Since we are working with integers, using "offset / (interval/2)" would be problematic if interval was odd. We instead multiply both sides by two and use "(2 * offset) / interval" to obtain the result for snapUp.
If you try and paste something to the first bar in the Song Editor it ends up on the second bar. This is a glitch that has been introduced after lmms-1.2 .
Affected LMMS versions
master
The text was updated successfully, but these errors were encountered: