lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Find objects within a spanner


From: David Nalesnik
Subject: Re: Find objects within a spanner
Date: Tue, 7 Feb 2017 07:34:57 -0600

Hi Urs,

On Mon, Feb 6, 2017 at 5:26 AM, Urs Liska <address@hidden> wrote:
> Hi all,
>
> if I override a Tie/Slur's stencil I can easily (well, now, after your
> help ...) get to the note columns at both ends.
>
> Is it possible to retrieve a list of all objects *between* those ends too?
> Concretely I would like to know if there are ties within a slurred
> phrase and to determine peak notes/stems in order to do some sort of
> collision-handling-like layout decisions.
>

One way would be to follow pointers.  Most objects store references to
other objects.  In the case of Slur, consulting Internal Properties at
http://lilypond.org/doc/v2.19/Documentation/internals/slur_002dinterface
shows that a grob array of note columns traversed is available through
the 'note-columns property (which you would access through
ly:grob-object). BTW, you'd probably want to use ly:grob-array->list
to work with the array more conveniently..

There are then pointers to other objects held by each NoteColumn grob.

You can "go higher," too: use parentage (ly:grob-parent), or get the
grob's associated paper column with ly:item::get-column.  PaperColumn
and NonMusicalPaperColumn will store references to many grobs (through
the 'elements property from the axis-group-interface)

--

Or, you could get all elements on a line (through the 'all-elements
property of the System grob) and filter by location.  This seems a bit
inefficient to me.

Sorry, no time right now for a working code snippet, but I hope this is helpful.

Best,
David



reply via email to

[Prev in Thread] Current Thread [Next in Thread]