[JW Lua] FCBeatChartElement(s) - Problems with v0.66

Robert Patterson robert at robertgpatterson.com
Mon Mar 13 16:18:50 CET 2023


I believe ReferenceWidth is supported all the way back in JW Lua. Let me
know if it isn't.

On Mon, Mar 13, 2023 at 10:00 AM Jan Angermüller <jan at angermueller.com>
wrote:

> Thank you very much, Robert, for this quick solution!
>
> Yes, replacing MinimumPosition with ReferenceWidth  in the header item
> seems to have solved the problem.
> Though I haven't run all my tests yet - only the one file.
>
> *And do I understand you correctly that it is safe to change this for all
> versions prior to v0.66 as well?*
>
> Or let me put the question the other way around:
> Is it really necessary to introduce incompatibility here?
>
> All scripts that use .MinimumPosition from element 0 won't work anymore.
> I have never noticed that MinimumPosition could be replaced with
> ReferenceWidth, because storing in MinimumPosition updated the value in
> ReferenceWidth too - for whatever reason.
>
> I understand that it may be more clear to use ReferenceWidth directly.
> However, it has worked fine so far in previous versions.
> According to the new documentation "SetMinimumPosition can't be applied to
> the init beat chart element".
> So if MinimumPosition is not used in the header element anyway, then it
> could still be used just for compatibility reasons.
>
> Currently I have only updated the Perfect Layout code. But I'll have to
> check the other plug-ins too.
> I ask because the fix is a bit risky.
> When updating the code you have to make sure only that only the 0-index
> elements are affected and not the elements above index 0.
>
> Jan
>
>
> Am 13.03.2023 um 13:01 schrieb Robert Patterson:
>
> For the header (item 0), use ReferenceWidth instead of MinimumPosition. It
> might be worth reading the updated documentation. Item 0 is a header and
> has different properties than the rest of the items.
>
> I have found that editing beat charts is a fool's game unless you first
> transition them to manual mode. I added a new function that does a version
> of this. Unfortunately, Finale's algorithm for doing it is much more
> complicated, and it is too difficult to reverse engineer. But the version I
> provided is serviceable for most use cases.
>
> That said, if your code doesn't require transition to manual mode, and you
> are happy with it, it should continue to work. You'll just need to use the
> ReferenceWidth field on item 0 instead of MinimumPosition. Be aware that
> the ReferenceWidth is a scratch value and if Finale actually uses it, it
> has been extremely difficult to figure out how. My contact at MakeMusic
> says it is the minimum measure width that the chart can handle without
> collisions.
>
>
>
>
> On Mon, Mar 13, 2023 at 5:55 AM Jan Angermüller <jan at angermueller.com>
> wrote:
>
>> Robert,
>>
>> in my further tests with v0.66 and Perfect Layout I noticed that the *FCBeatChartElement
>> *functionality has changed significantly.
>> My "insert space" function doesn't work anymore ... while it used to add
>> more space, it now reduces the space in some cases.
>>
>> Attached is a test document and a code snippet.
>> However, the problem occurs in all sorts of documents.
>>
>> The code simply prints the FCBeatChartElement properties from measure 4.
>> It seems that there is a problem with the MinimumPosition on
>> FCBeatChartElement 0.
>>
>> function plugindef()
>>    finaleplugin.LoadLuaSocket=true
>>    return "Test","Test","Test"
>> end
>> pluginname=plugindef()
>> if finenv.IsRGPLua then require('mobdebug').start() end
>> local measure=finale.FCMeasure()
>> measure:Load(4)
>> local beatcharts= measure:CreateBeatChartElements()
>> local beatchart2
>> for beatchart2 in each(beatcharts) do
>>
>> print("BC2",measure.ItemNo,beatchart2.ItemCmper,beatchart2.ItemInci,beatchart2.MeasurePos,beatchart2.HorizontalPosition,beatchart2.NextHorizontalPosition,beatchart2:CalcWidth(),beatchart2.MinimumPosition)
>> end
>>
>> Before RGP Lua v0.66   (here JW Lua 0.54)
>> BC2 4 4 0 4096 336 0 0* 641*
>> BC2 4 4 1 0 0 84 84 0
>> BC2 4 4 2 1024 84 116 32 64
>> BC2 4 4 3 1280 116 148 32 125
>> BC2 4 4 4 1536 148 200 52 177
>> BC2 4 4 5 2048 200 336 136 218
>>
>> RGP Lua v0.66
>> "BC2"    4    4    0    4096    336    0    0    *0*
>> -- 641 missing!
>> "BC2"    4    4    1    0    0    84    84    0
>> "BC2"    4    4    2    1024    84    116    32    64
>> "BC2"    4    4    3    1280    116    148    32    125
>> "BC2"    4    4    4    1536    148    200    52    177
>> "BC2"    4    4    5    2048    200    336    136    218
>>
>> Any ideas?
>>
>> Jan
>>
>>
>>
>>
>> Am 11.02.2023 um 18:01 schrieb Robert Patterson:
>>
>> Okay, I will leave it. I am adding some additional properties for clarity.
>>
>> The main concept that is missing is the concept of transitioning the beat
>> chart from automatic to manual. This is a concept I discovered after
>> extensive reverse-engineering of Finale behavior. Unfortunately, I didn't
>> get the comments into the PDK before Jari withdrew from working on it.
>>
>> You basically cannot edit a beat chart unless you first transition it to
>> a manual beat chart. Finale does this when the user manually edits it with
>> the beat chart handles. I'm going to add a method on FCBeatChartElements to
>> do it programmatically.
>>
>>
>> On Sat, Feb 11, 2023 at 10:53 AM Jan Angermüller <jan at angermueller.com>
>> wrote:
>>
>>> Robert,
>>>
>>> I use both classes a lot in Perfect Layout.
>>> Though it still sometimes seems like a puzzle (or incomplete?) to me too.
>>> Adding more properties would be fine, but changing/splitting the whole
>>> thing would have massive impact on the spacing algorithms from Perfect
>>> Layout.
>>>
>>> If it really makes sense to you to change it, maybe you could keep
>>> FCBeatChartElement(s) and add an alternative implementation with a new
>>> name, so that the old one still can be used. Not so nice, but very
>>> pragmatic ;-)
>>>
>>> Jan
>>>
>>> Am 11.02.2023 um 16:46 schrieb Robert Patterson:
>>>
>>> Hello,
>>>
>>> Does anyone use FCBeatChartElement or FCBeatChartElements? It appears to
>>> be incomplete to me, and I would also like to split the header out into its
>>> own class. This would be a breaking change, so I am not sure I'll do it.
>>> But I thought I would poll the group.
>>>
>>> Robert
>>>
>>>
>>> _______________________________________________
>>> JWLua mailing listJWLua at jwmusic.nuhttp://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>>>
>>>
>> _______________________________________________
>> JWLua mailing list
>> JWLua at jwmusic.nu
>> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>>
>
> _______________________________________________
> JWLua mailing listJWLua at jwmusic.nuhttp://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>
>
> --
> Jan Angermüller
> Orchideenstieg 13
> 22297 Hamburg
> Tel. 040 - 28 94 84 82
> Mobil 0173 - 99 33 904www.elbsound.studio
>
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20230313/0030dc49/attachment.html>


More information about the JWLua mailing list