[JW Lua] Metrics update problem
Jan Angermüller
jan at angermueller.com
Thu Jul 3 16:33:14 CEST 2014
I guess the static MarkMetricsForRebuild() functions should solve the
problem...
I haven't had the problem again since they are in.
Jan Angermueller
Am 27.06.2014 21:29, schrieb Jan Angermüller:
>
> Jari,
>
> I have a problem probably with the metrics update.
> While I was playing a little bit with your dynamic_horizpos script
> that you posted once and was trying to add the
> "avoid vertical collision of articulation with dynamics" functionality
> that you also have in your group demonstration youtube video.
> So if it detects an articulation collision it will not only move
> the dynamics horizontally (as in your script), but also vertically down.
>
> It works fine, but ... only for a small regions. The larger
> the regions are (e.g. 5 measures across 5 staves) I get wrong metric
> calculations from FCArticulation:CalcMetricPos(point). It doesn't calculate a point
> anymore, after it was calculated a few times.
>
> With the first script version it worked only on the very first point
> calculation, then I added the following hoping that it would update the metrics.
>
> local cellmetrics = finale.FCCellMetrics()
> cellmetrics:LoadAtEntry(entry)
> local entrymetrics = finale.FCEntryMetrics()
> entrymetrics:Load(entry)
>
> And yes, it somehow did. Now it works on a few more entries.
> But after some measures it stops again and doesn't calculate anymore
> (FCArticulation:CalcMetricPos(point) then returns false,
> while FCExpression:CalcMetricPos(point) still does fine).
>
> I have attached the full script. Apart from the few lines above
> this is the only thing I added to your script
> (the script works fine in most cases, but as it currently only uses
> a very simple collision detection, it's just a demonstration yet...)
>
> function RemoveArticulationCollision(entry,expr)
> if entry.ArticulationFlag then
> local articulations= entry:CreateArticulations()
> local point = finale.FCPoint(1,1)
> local point2 =finale.FCPoint(1,1)
> expr:CalcMetricPos(point2)
>
> for a in each(articulations) do
> a:CalcMetricPos(point) -- this is where the problem occurs
>
> print(point.X,point.Y) -- this will print (1,1) in the attached screenshot example in the last measure, instead of the real value
>
> local mindiff=60 -- minimum difference, below this value there will probably be a collision
> local vertdiffabs= math.abs(point2.Y)-math.abs(point.Y)
> local vertdiff =point2.Y-point.Y
>
> if ((point2.Y<point.Y) and (vertdiffabs<mindiff)) then
> -- expression currently below articulation
> if vertdiffabs~=mindiff then -- don't change anymore if it is "perfect" position
> expr.VerticalPos= expr.VerticalPos+(vertdiffabs-mindiff)
> point2.Y=point2.Y+(vertdiffabs-mindiff)
> end
> elseif ((point2.Y>point.Y) and (vertdiffabs>-90)) then
> -- expression currently above articulation
> expr.VerticalPos= expr.VerticalPos+(vertdiffabs-mindiff)
> point2.Y=point2.Y+(vertdiffabs-mindiff)
> end
> end
> end
> return expr
> end
>
> Also attached are two screenshots of what happens.
> The dynamics in the last measure third staff is not fixed when I select
> all measures and apply the plugin,
> but the other three fixes are fine.
> When I only select the last measure, that one will also be fixed. So
> there seems to be a metrics problem.
>
> Do you have any hints ?
>
> Jan
>
>
>
>
>
>
>
> _______________________________________________
> 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/20140703/761666f5/attachment.htm>
More information about the JWLua
mailing list