Scene Events
- class dazpy.SceneEvent(type, ts, data)[source]
Bases:
objectA single scene-change event received from the SSE stream.
- dazpy.watch_scene_events(client, categories=None, event_types=None, stream_timeout=None)[source]
Yield
SceneEventobjects as DAZ Studio reports scene changes.Opens an SSE connection to
GET /scene/eventsand yields events as they arrive, filtered server-side by categories and optionally client-side by exact event_types (e.g.{"node.added", "node.removed"}).The connection stays open until the caller stops iterating (e.g. via
break) or the server closes the stream.- Parameters:
categories (list[str] | None) – Optional subset of event categories to subscribe to server-side (see
_VALID_CATEGORIES).Nonesubscribes to all categories.event_types (set[str] | None) – Optional set of exact event types to keep; all others are dropped client-side.
Noneyields every event received.stream_timeout (float | None) – Socket timeout in seconds.
None(default) waits indefinitely — the server sends a keepalive comment every 15 seconds, so the connection never idles out.
- Raises:
ConnectionError – If the SSE endpoint could not be reached.
Example:
from dazpy import DazClient from dazpy._scene_events import watch_scene_events client = DazClient() for event in watch_scene_events(client, categories=["node", "selection"]): print(event.type, event.data) if event.type == "node.added": break
- dazpy.wait_for_scene_event(client, event_type, timeout=300.0)[source]
Block until a scene event of event_type arrives, then return it.
- Parameters:
- Returns:
The matching
SceneEvent.- Raises:
TimeoutError – If timeout elapses before a matching event arrives.
ConnectionError – If the SSE endpoint could not be reached.
- Return type: