Hi list,
I've got a nice little method for an info class in Pd-l2ork that
tells whether an x/y coordinate lies within an object on a particular
canvas. For the new svg-style drawing commands I've added, this method
makes it possible to do some fairly simple tests within a patch to make
sure I don't break things along the way. For example, I can check the
bbox of scalars that contain transformed shapes, or check to make sure
that the stroke-width is contained within the bbox, check positions of
gop scalars, nested data structures, etc.
If the gui and core were truly separated, how would I do these tests
within Pd? To follow the Pd message-passing model, I need to get an
answer to my query in zero logical time. If the bbox data is only held
by the gui then I have to send a request over the socket, and the object
chain will have finished computing before the gui sends back its data.
If the core holds a synced copy of bbox data then the gui must either a)
constantly bombard it with updated values or b) send a message that
tells the core what got updated and let the core update data for all
relevant objects. In which case there's no longer really a separation
between gui and core.
On a related note-- for the new drawing commands I'm doing all kinds of
crazy calculations in the core for stuff like getting the bbox of an svg
path. It's ridiculous because all that math has already happened in
Tkpath, but I can cache it so Pd doesn't take a huge performance hit.
But I simply couldn't figure out a way to get that data from the gui in
a way that doesn't cause all kinds of syncronization problems. By the
time *_getrect is called the core must already have the bbox data,
otherwise it's too late. Is there some way to deal with that without
moving the entire gui logic out of the core? I couldn't think of one.
-Jonathan