<div dir="ltr"><div>The short answer is that the 0x04 bit by itself does not do much. You also have to transpose the note by Finale's "default enharmonic flip" amount. I have worked out how to enharmonic flip and have it unlink. It requires the following steps (with the part in edit focus):<br></div><ul><li>Set the 0x04 bit and save the FCNoteheadMod.</li><li>Transpose the FCNote enharmonically by Finale's default enharmonic flip. (Any other transposition remains linked to the score.) I have added a function to do this to the transposition library in the Lua-scripts repo, but it isn't merged yet. There's a lot of non-trivial support code already written in the transposition library, which is why I haven't added a function to the PDK Framework. (It would be a ballooning project.)<br></li><li>(Optional but recommended) rebuild metrics (outside eachentrysaved loop) and set entry.StemUp = entry:CalcStemUp().</li></ul><div>To relink (with the part in edit focus):</div><ul><li>Reset the 0x04 bit and then delete the FCNoteheadMod (but save the reference to it).</li><li>Call the new (in 0.66) function note:MatchSpellingToScore(). You could write your own version of it in Lua, but this seemed like a useful function to add to the PDK Framework and easy to add.<br></li><li>Put the score in edit focus and resave (as new) the FCNoteheadMod.</li><li>Rebuild metrics as before and adjust the stem bits.</li></ul><div>There could be an improvement to this to check if there are no other mods in the FCNoteheadMod and skip re-saving it, but this is safe and easy. I have a longer-term goal to add __FCBaseData::Relink to the framework, which you could use instead, but it won't be in 0.66.</div><div><br></div><div>Here is the code I'm using (requires RGP Lua 0.66):</div><div><span style="font-family:monospace"><br>local transpose = require('library.transposition')<br><br>for entry in eachentrysaved(finenv.Region()) do<br> for note in each(entry) do<br> local note_mod = finale.FCNoteheadMod()<br> note_mod:SetNoteEntry(entry)<br> note_mod:LoadAt(note)<br> note_mod.EnharmonicFlip = not note_mod.EnharmonicFlip<br> if note_mod.EnharmonicFlip then<br> note_mod:SaveAt(note)<br> transpose.enharmonic_transpose_default(note)<br> else<br> note_mod:DeleteData()<br> note:MatchSpellingToScore()<br> local score = finale.FCPart(finale.PARTID_SCORE)<br> score:SwitchTo()<br> note_mod:SaveAt(note)<br> score:SwitchBack()<br> end<br> end<br>end<br><br>finale.FCEntryMetrics.MarkMetricsForRebuild()<br>for entry in eachentrysaved(finenv.Region()) do<br> entry.StemUp = entry:CalcStemUp()<br>end<br></span></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Mar 1, 2023 at 10:03 AM Jan Angermüller <<a href="mailto:jan@angermueller.com">jan@angermueller.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
Did you get feedback from MakeMusic on how it works?<br>
Was it only the 4? Or were more bits involved?<br>
<br>
Jan<br>
<br>
<div>Am 23.02.2023 um 14:57 schrieb Jan
Angermüller:<br>
</div>
<blockquote type="cite">
Thank you! This helps indeed.<br>
<br>
<div>Am 23.02.2023 um 14:49 schrieb Robert
Patterson:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>That 4 value appears to be the enharmonic flip bit, which
is not documented in the PDK. I have sent a message to
Makemusic to get clarification on how it works. Once I hear
back, I will add it to the PDK Framework and Lua.<br>
</div>
<div><br>
</div>
<div>The 13 is a custom font id. However, 13 is the font ID
for Finale Music, so it's the same as the default font.
Furthermore, since the "UseCustomFont" option is false, the
custom font id is ignored anyway. The 13s appear to be cruft
in the file.<br>
</div>
<div><br>
</div>
<div>You may encounter this situation with any Special Tools
modification that is unlinkable, including FCNoteheadMods.
It will appear to have all default values in the score but
is modified in one or more parts. There is no way to
determine this except to compare in all parts that contain
the staff.</div>
<div><br>
</div>
<div>You may know that my Mass Copy plugin has a "Relink"
option. Relinking is not directly supported in the PDK. The
way my plugin works is that it makes a copy of the values it
wants to relink to, deletes the item entirely and then
re-adds it in the score with the copied values.</div>
<div><br>
</div>
<div>If you delete seemingly empty note details in the score,
you are removing unlinked values from the parts and
relinking them to the score.<br>
</div>
<div><br>
</div>
I hope this helps.<br>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Thu, Feb 23, 2023 at 3:06
AM Jan Angermüller <<a href="mailto:jan@angermueller.com" target="_blank">jan@angermueller.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div> Robert,<br>
<br>
I have recently had a document that included seemingly
"empty" FCNoteheadMods.<br>
I.e. all options from the NoteheadMod dialog were set to
the default value. <br>
<br>
So I deleted it with nh:DeleteData(), because I thought it
was an unnecessary/corrupt FCNoteheadMod.<br>
This lead to a problem:<br>
When you do the CreateRawDataDump and list the 11th value,
it may include a "4", and 13th value may include a "13".<br>
<br>
local nu=nh:CreateRawDataDump()<br>
print(nu:GetItemAt(10).Int)<br>
<br>
If this returns 4, then the "Enharmonic" bit is activated.
Otherwise it returns 0.<br>
If you delete the FCNoteheadMod in this case, the
enharmonic flip disappears.<br>
nu:GetItemAt(12).Int sometimes returns "13". I didn't find
out what this is.<br>
<br>
As Perfect Layout wants to delete corrupt/empty
FCNoteheadMods by default, it's difficult to find out when
looking at the score only:<br>
If the enharmonic flip is only in a linked part and you
load the FCNoteheadMod in the score, you won't recognize
that there may be a flip in a part.<br>
Or in other words: if you analyze the DataDump in the
score, it looks like the FCNoteheadMod doesn't make sense,
because all values are set to 0 (except the 100 resize
value).<br>
<br>
My questions:<br>
- Maybe you could add the GetEnharmonic() to
FCNoteheadMod?<br>
- Maybe you know what the 13 is?<br>
- Do you know if there is a simple way to decide when
looking at the FCNoteheadMod in the score whether this is
a "false/empty" FCNoteheadMod or if this is actually an
unlinked FCNoteheadMod?<br>
According to my documentation there have been situations
(maybe in corrupt documents?) where false/empty
FCNoteheadMods should be deleted.<br>
Until now I did when all values where set to the default
values in the score. And I don't want to switch through
all parts at that point, if possible.<br>
<br>
Here is a test script for the attached document:<br>
local reg=finale.FCMusicRegion()<br>
reg:SetFullDocument()<br>
local parts=finale.FCParts()<br>
parts:LoadAll()<br>
for p in each(parts) do<br>
p:SwitchTo()<br>
for e in eachentry(reg) do<br>
if e.NoteDetailFlag then<br>
local nhmods=e:CreateNoteheadMods() <br>
for nh in each(nhmods) do<br>
local nu=nh:CreateRawDataDump()<br>
if nu then<br>
print(p.ID,e.Measure,e.MeasurePos,nu:GetItemAt(10).Int,nu:GetItemAt(12).Int)<br>
end<br>
end<br>
end<br>
end<br>
p:SwitchBack()<br>
end<br>
<br>
Running [Unnamed Script] ======><br>
0 1 0 0 0 --> Score: Measure 1, Pos 0, all default
values (=0)<br>
0 1 2048 0 0<br>
0 2 0 0 13 --> 13 is set<br>
0 3 2560 4 13 --> 4 and 13 is set<br>
9 1 0 4 0 --> 4 is set<br>
9 1 2048 4 0 --> 4 is set<br>
9 2 0 4 13 --> 4 and 13 is set<br>
9 3 2560 0 13 --> 13 is set<br>
<======= [Unnamed Script] succeeded (Processing time:
0.000 s).<br>
<br>
Four notes have enharmonic flips and two also have the
"13" value.<br>
Three notes have the "4" in the linked part, one note has
it in the score.<br>
<br>
Jan<br>
<br>
<br>
<br>
</div>
_______________________________________________<br>
JWLua mailing list<br>
<a href="mailto:JWLua@jwmusic.nu" target="_blank">JWLua@jwmusic.nu</a><br>
<a href="http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu" rel="noreferrer" target="_blank">http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu</a><br>
</blockquote>
</div>
<br>
<fieldset></fieldset>
<pre>_______________________________________________
JWLua mailing list
<a href="mailto:JWLua@jwmusic.nu" target="_blank">JWLua@jwmusic.nu</a>
<a href="http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu" target="_blank">http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu</a>
</pre>
</blockquote>
<br>
<pre cols="72">--
Jan Angermüller
Orchideenstieg 13
22297 Hamburg
Tel. 040 - 28 94 84 82
Mobil 0173 - 99 33 904
<a href="http://www.elbsound.studio" target="_blank">www.elbsound.studio</a></pre>
<br>
<fieldset></fieldset>
<pre>_______________________________________________
JWLua mailing list
<a href="mailto:JWLua@jwmusic.nu" target="_blank">JWLua@jwmusic.nu</a>
<a href="http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu" target="_blank">http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu</a>
</pre>
</blockquote>
<br>
<pre cols="72">--
Jan Angermüller
Orchideenstieg 13
22297 Hamburg
Tel. 040 - 28 94 84 82
Mobil 0173 - 99 33 904
<a href="http://www.elbsound.studio" target="_blank">www.elbsound.studio</a></pre>
</div>
_______________________________________________<br>
JWLua mailing list<br>
<a href="mailto:JWLua@jwmusic.nu" target="_blank">JWLua@jwmusic.nu</a><br>
<a href="http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu" rel="noreferrer" target="_blank">http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu</a><br>
</blockquote></div>