"""Asynchronous access to the application's actual Blender WebEngine. This is a WebEngine command interface, not the desktop bpy module. """ import json import contextvars from _web_blender_host import request as _request _session_run = contextvars.ContextVar('web_blender_run', default=0) async def _call(method, value): response = await _request(_session_run.get(), method, json.dumps(value, allow_nan=False)) return json.loads(response) async def snapshot(): """Read the current authoritative scene snapshot.""" return await _call('snapshot', {}) async def context(): """Read the active native workspace, screen, area and bound editor data.""" return await _call('context', {}) async def command(payload): """Apply one WebEngine command through the normal Main transaction path.""" if not isinstance(payload, dict): raise TypeError('command requires a dictionary') return await _call('command', payload) async def operators(): """List operators implemented by the compiled WebEngine.""" return await _call('operators', {}) async def operator(identifier, **properties): """Invoke a source-backed operator in the current WebEngine context.""" return await _call('operator', {'operator': identifier, 'properties': properties}) async def data_blocks(**query): return await _call('data_blocks', query) async def properties(**query): return await _call('properties', query)