Skip to content
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

Fix #9352: Add ability to guess tie attachment point for different noteheads #9653

Merged

Conversation

asattely
Copy link
Contributor

@asattely asattely commented Nov 4, 2021

Resolves: #9352

Noteheads are now taken into account when determining where to attach ties. For noteheads with cutout information, this is the average of the cutouts. Also, now that noteheads have a single attachment point, ties adjust for each other when they share that point:
image

For slash noteheads, which are special, the tie attachment point takes the stem anchor into account:
image

For all other noteheads, the exact center is used.
image

@asattely
Copy link
Contributor Author

asattely commented Nov 4, 2021

Added some extra space for the ties to adjust to each other

@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Nov 4, 2021

3 vtests show differences, all with ties, unsurprisingly. 3 look OK, 3 don't:
Before:
image
After:
image
The tie in the 2nd measure is too high, IMHO. On the other hand the 1st tie, grace to note, looks better now, but IMHO too low.
Before:
image
After:
image
In top staff the 1st tie in the 1st measure is too high IMHO, in bottom staff the last ties in the 1sxt meaure seem to be to high/low, not really sure there.
But the worst, before:
image
After:
image
The bottom tie starts way too late. It started to late before already, but now even later.

(Sorry for transparent PNG, but that's what the vtests produce)

@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Nov 4, 2021

Actually there's one more, before:
image
After:
image
See the tie for the 1st grace to note (was the case before already) and the 2 gracenotes at the end, they are too far to the right.
Seems the smallness of notes need to get taken into considaration?

@asattely
Copy link
Contributor Author

asattely commented Nov 5, 2021

Yup, I noticed those as well. Thanks for looking through and getting the screenshots, I'll definitely be taking another whack at this once I finish something I'm working on tomorrow.

@asattely asattely force-pushed the outside-tie-placement-and-cleanup branch from e6ba044 to f20db59 Compare November 10, 2021 00:07
@asattely
Copy link
Contributor Author

asattely commented Nov 10, 2021

So, the extra height on some of the ties were due to the fact that the vtests still use Emmentaler rather than Leland, for the record. The vtests will almost certainly still fail because the ties will look different, but now the ties from gracenotes will be a lot nicer with a little special handling. The wholenotes one was a weird oversight that should be fixed now. Let's see what the vtests say on this one.

edit: a few fixes still needed, should be easy

@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Nov 10, 2021

Looks better, but this here does not, before:
image
after:
image
before:
image
after:
image
The 1st tie on each looks better (but to narrow IMHO), the other 3 don't, they go too far past the note they tie to

@asattely
Copy link
Contributor Author

Yep, very well aware. The problem is that headWidth (and, bafflingly, the bounding box as well) always returns the width of a regular-sized notehead instead of the grace-sized one, so I just need to figure out how to get the grace-sized head width and we're golden.

@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Nov 10, 2021

See (in 3.x) Format > Style > Sizes > Grace note size. Defaults to 70%, so you'ds need to pick on that style setting

@asattely asattely force-pushed the outside-tie-placement-and-cleanup branch from f20db59 to 913a570 Compare November 10, 2021 16:07
@asattely
Copy link
Contributor Author

The answer was mag() (or magS()) which holds information about the note's relative size

@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Nov 10, 2021

Still the issue with these too narrow ties (same as in the above images), they are not going from/to center of notehead

@asattely
Copy link
Contributor Author

Those are inside-style ties because they are going to or from a multinote chord. This is an issue in other inside-style tie situations as well, and in the future there will be a minimum tie width issue where that will be looked at in greater detail.

@igorkorsukov igorkorsukov added the vtests This PR produces approved changes to vtest results label Nov 11, 2021
@asattely
Copy link
Contributor Author

Still messing around with different fonts and noteheads, there are so many combinations to go through..!

@asattely asattely force-pushed the outside-tie-placement-and-cleanup branch from 913a570 to 94505fd Compare November 17, 2021 17:34
@asattely
Copy link
Contributor Author

Rewrote the Y adjust code to be simpler and also more robust in the face of different fonts. Still needs a rebase.

@asattely asattely force-pushed the outside-tie-placement-and-cleanup branch from 94505fd to dbd681f Compare November 17, 2021 18:01
@asattely
Copy link
Contributor Author

asattely commented Nov 17, 2021

Rebase finished. I was also requested to add a small left- or right-offset to outside tie endpoints, which I ended up making 1/8 sp.

edit: i think i know what is killing the utests, give me a sec.

@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Nov 17, 2021

4 utests crash with a failed assertion:
ASSERT: "_anchor == Anchor::CHORD" in file .../src/engraving/libmscore/spanner.cpp, line 879
Not sure how (or whether) this relates to this PR?

Edit: I see, you're on it

@asattely asattely force-pushed the outside-tie-placement-and-cleanup branch from dbd681f to 8571237 Compare November 17, 2021 18:35
@asattely
Copy link
Contributor Author

Tests should be fixed now

@Jojo-Schmitz
Copy link
Contributor

Nope, exact same crash

@asattely asattely force-pushed the outside-tie-placement-and-cleanup branch 2 times, most recently from 3211f22 to ccd8db4 Compare November 17, 2021 23:18
@asattely
Copy link
Contributor Author

asattely commented Nov 17, 2021

The weird thing is that these tests pass when I run them locally. I think I identified the problem, we'll see if the tests are good this time.

edit: There we go. The problem was that Tie::startChord() doesn't actually return the correct chord, so you have to use Tie::startNote()->chord() in order to access it. I'm not sure why this is the case, but changing it to the latter fixes it, so it's all good now.

@AntonioBL
Copy link
Contributor

The vtests are now better, except for "grace-5-1".
Before
grace-5-1 ref
After
grace-5-1
First, second and third ties are better than the reference, but there is something strange in the vertical position of the tie between the two grace notes (i.e. the fourth tie in the file).

Ciao

@Nick-Mazuk
Copy link
Contributor

Does this work as expected on chords where every note has a different notehead?

@asattely asattely force-pushed the outside-tie-placement-and-cleanup branch 2 times, most recently from 4dbf36c to 6b85e44 Compare November 23, 2021 18:48
Also, cleaned up some comments and renamed some functions to make them easier to understand
@asattely asattely force-pushed the outside-tie-placement-and-cleanup branch from 6b85e44 to 18064e7 Compare November 25, 2021 02:13
@asattely
Copy link
Contributor Author

Fixed a little issue with forced-direction outside ties colliding with hooks, and also added another special case for slashed noteheads, which are different from slash noteheads for the record.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vtests This PR produces approved changes to vtest results
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MU4 Issue] Properly determine 'midpoint' of noteheads for origin of ties
6 participants