Scene Events

class dazpy.SceneEvent(type, ts, data)[source]

Bases: object

A single scene-change event received from the SSE stream.

type: str
ts: int
data: dict
dazpy.watch_scene_events(client, categories=None, event_types=None, stream_timeout=None)[source]

Yield SceneEvent objects as DAZ Studio reports scene changes.

Opens an SSE connection to GET /scene/events and 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:
  • client (DazClient) – Connected DazClient.

  • categories (list[str] | None) – Optional subset of event categories to subscribe to server-side (see _VALID_CATEGORIES). None subscribes to all categories.

  • event_types (set[str] | None) – Optional set of exact event types to keep; all others are dropped client-side. None yields 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:
  • client (DazClient) – Connected DazClient.

  • event_type (str) – Exact event type to wait for, e.g. "node.added" or "render.finished". The category prefix (text before the first .) is used to narrow the server-side subscription.

  • timeout (float) – Maximum seconds to wait.

Returns:

The matching SceneEvent.

Raises:
Return type:

SceneEvent