Sends data to the Web UI via Websocket connection. :param data: The data to send. If None, just sends data from WebData. :param data_key: The key under which to store the data in the payload. Defaults to "data". :param event: The WebSocket event to emit. Defaults to
(
cls,
data: Optional[Any] = None,
data_key: str = "data",
event: str = "data",
namespace: str = "/blender",
use_web_data: bool = True,
)
| 257 | |
| 258 | @classmethod |
| 259 | def send_webui_data( |
| 260 | cls, |
| 261 | data: Optional[Any] = None, |
| 262 | data_key: str = "data", |
| 263 | event: str = "data", |
| 264 | namespace: str = "/blender", |
| 265 | use_web_data: bool = True, |
| 266 | ) -> None: |
| 267 | """ |
| 268 | Sends data to the Web UI via Websocket connection. |
| 269 | |
| 270 | :param data: The data to send. If None, just sends data from WebData. |
| 271 | :param data_key: The key under which to store the data in the payload. Defaults to "data". |
| 272 | :param event: The WebSocket event to emit. Defaults to "data". |
| 273 | :param namespace: The namespace for the WebSocket event. Defaults to "/blender". |
| 274 | :param use_web_data: Whether to use data from WebData. Defaults to True. |
| 275 | """ |
| 276 | |
| 277 | global ws_thread |
| 278 | payload = {} |
| 279 | |
| 280 | if use_web_data: |
| 281 | if not WebData.is_loaded: |
| 282 | WebData.load() |
| 283 | payload = WebData.data.copy() |
| 284 | |
| 285 | if data is not None: |
| 286 | payload[data_key] = data |
| 287 | |
| 288 | if ws_thread is not None and tool.Web.get_web_props().is_connected: |
| 289 | ws_thread.run_coro(cls.sio_send(payload, event, namespace)) |
| 290 | |
| 291 | @classmethod |
| 292 | def check_operator_queue(cls) -> None | float: |
no test coverage detected