[JW Lua] Endpoints offsets of slurs can't be changed ... with a small typo update
Jan Angermüller
jan at angermueller.com
Sun Jul 20 17:13:36 CEST 2014
A little typo update:
in the text I wrote leftseg/rightseg:SetControlPoint1OffsetX, but it
should of course be
leftseg/rightseg:SetEndpointOffsetX as I had written correctly in the
function code below.
So it's about changing EndpointOffsets of the shape segments and
CtrlPointOffsets of the ctrlpointadjust.
Jan
Jari,
there may be a bug in JW Lua with changing endpoints of slur smartshapes.
Probably it has to do with FCSmartShapeSegment:SetCustomOffset().
This is what happens:
When I have a smartshape slur with its original endpoint and control
point offsets
(not custom-defined, but just the way Finale created the slur originally
- see image 1 in screenshot)
Then in JW Lua I create the ctrlpoint and left/right segments of the
smartshape slur
and change their offsets (i.e. leftseg:*SetEndpointOffsetX*(...),
rightseg:*SetEndpointOffsetX*(..),
ctrlpoint:SetControlPoint1OffsetX(...) etc.)
Then I add:
ctrlpoint:SetCustomShaped(true)
leftseg:SetCustomOffset(false) -- i.e. not rightside
rightseg:SetCustomOffset(true) -- i.e. rightside
smartshape:Save()
The result is a slur with new controlpoints,
but not with new leftseg/rightseg endpoints (see image 2 in the screenshot).
Then in comparison I do the following:
I go back to the original slur and change one of the endpoints (left or
right)
by dragging it manually. So Finale internally sets the shape to "custom
offset=true".
Then I remove the lines leftseg:SetCustomOffset(false) and
rightseg:SetCustomOffset(true)
from the code and run the same function again.
Now the results are correct: both ctrlpoint and leftseg/rightseg
endpoints have changed
according to the new values (see image 3 in screenshot).
So I guess there is a problem with the FCSmartShapeSegment:SetCustomOffset
function.
Below you find the function to test.
Jan
local marks = finale.FCSmartShapeMeasureMarks()
marks:LoadAllForRegion(finenv.Region(), true)
for mark in each(marks) do
local smartshape = mark:CreateSmartShape()
if (smartshape ~= nil) and smartshape:IsSlur() then
local leftseg=smartshape:GetTerminateSegmentLeft()
local rightseg=smartshape:GetTerminateSegmentRight()
local ctrlpoint=smartshape:GetCtrlPointAdjust()
ctrlpoint:SetCustomShaped(true)
leftseg:SetCustomOffset(false) --i.e. left-side
adjustment --2nd time remove this line of code
rightseg:SetCustomOffset(false) --i.e. right-side adjustment
--2nd time remove this line of code
ctrlpoint:SetControlPoint1OffsetX(0)
ctrlpoint:SetControlPoint1OffsetY(-100)
ctrlpoint:SetControlPoint2OffsetX(0)
ctrlpoint:SetControlPoint2OffsetY(-100)
leftseg:SetEndpointOffsetX(50)
leftseg:SetEndpointOffsetY(-50)
rightseg:SetEndpointOffsetX(50)
rightseg:SetEndpointOffsetY(-50)
smartshape:Save()
end
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20140720/537a0129/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: slur endpoints changed.jpg
Type: image/jpeg
Size: 85547 bytes
Desc: not available
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20140720/537a0129/attachment.jpg>
More information about the JWLua
mailing list