feat(annotations): broadcast stroke events to plugin_events_group#299
Open
richardssam wants to merge 1 commit into
Open
feat(annotations): broadcast stroke events to plugin_events_group#299richardssam wants to merge 1 commit into
richardssam wants to merge 1 commit into
Conversation
AnnotationBasePtr is not Python-bound, so Python plugins cannot subscribe to live_edit_event_group directly. Serialize the cumulative in-progress stroke via Annotation::serialise() and broadcast it as a JsonStore alongside (event_atom, annotation_data_atom, user_id, stroke_completed) via plugin_events_group(), so Python plugins can render partial strokes directly from event geometry instead of polling/hot-scanning bookmarks. Shapes (Square/Circle/Arrow/Line/ Ellipse) are only broadcast on pen-up, since a shape isn't a meaningful annotation until the drag completes. Also fix subscribe_to_plugin_events: BroadcastActor forwards messages via send_as(current_sender(), subscriber, msg), so a Python subscriber sees the owning actor as the sender, not the broadcast group. The 2-arg add_message_callback() only registered the group's address, so plugin_events_ messages were silently dropped. Pass the plugin's actor as the owner_actor (3rd arg), mirroring the same fix already applied to subscribe_to_event_group. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org>
af98db1 to
12d28cd
Compare
Contributor
Author
|
Ted, this is dependant on #303 being approved. So if that is no good, I'll probably need to rethink this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Broadcasts in-progress annotation stroke geometry to
plugin_events_group()so Python plugins can render partial strokes directly from event data, instead
of polling/scanning bookmarks.
AnnotationBasePtris not Python-bound, so Python plugins can't subscribe tolive_edit_event_groupdirectly. This serialises the cumulative in-progressstroke via
Annotation::serialise()and broadcasts it as aJsonStorealongside
(event_atom, annotation_data_atom, user_id, stroke_completed).Shapes (Square/Circle/Arrow/Line/Ellipse) are broadcast only on pen-up, since a
shape isn't meaningful until the drag completes.
Also updates
subscribe_to_plugin_events(plugin_base.py) to pass the plugin'sactor as the owner actor (3rd arg):
BroadcastActorforwards viasend_as(current_sender(), ...), so a Python subscriber sees the owning actoras sender, not the broadcast group — the 2-arg form silently dropped
plugin_events_messages.Depends on #303
The
plugin_base.pychange relies on the owner-actor routing added in#303 (
EventToPythonThreadLockerActor/add_message_callback3rd arg).Please review/merge #303 first.
Changes
annotations_core_plugin.cpp: broadcast serialised stroke geometry viaplugin_events_group(); shapes only on pen-up.plugin_base.py:subscribe_to_plugin_eventspasses the owner actor as the3rd arg to
add_message_callback.This was developed with the assistance of claude code.