Custom Business Endpoint
By default, the Blender side uses DefaultBusinessEndpoint to process business_request, emit business_event, and return business_response.
What the default endpoint supports
DefaultBusinessEndpoint carries the built-in Blender data bridge and handles these names:
rna.listrna.getrna.setrna.describerna.callops.pollops.callwatch.subscribewatch.unsubscribewatch.read
Watch invalidation is delivered as the business_event named watch.dirty.
Every business_request, business_response, and business_event now carries explicit version fields:
protocolVersionschemaVersion
Current defaults are protocolVersion = 1 and schemaVersion = 1.
On the C# side, the current BlenderApi surface for Rna, Ops, and Observe depends on these default business names.
If the Blender side replaces the endpoint with a custom one and does not keep these names compatible, the built-in BlenderApi can no longer be used directly.
Interface contract
Implement BusinessEndpoint with one entry point:
class BusinessEndpoint:
def invoke(self, request):
raise NotImplementedErrorrequest is a BusinessRequest, and the return value is a BusinessResponse.
BusinessRequest.response(...) fills the current protocol and schema versions automatically, so simple custom handlers do not need to repeat them manually.
Minimal custom example
from .core import (
BusinessEndpoint,
BusinessRequest,
BusinessError,
BridgeConfig,
BridgeController,
)
class MyBusinessEndpoint(BusinessEndpoint):
def invoke(self, request):
if request.name == "ping":
return BusinessRequest.response(
reply_to=request.message_id,
payload={"pong": True},
)
return BusinessRequest.response(
reply_to=request.message_id,
ok=False,
error=BusinessError(
code="unsupported_business_request",
message=f"Unsupported business request: {request.name}",
),
)
controller = BridgeController(
BridgeConfig(executable_path="C:/path/to/YourAvaloniaApp.exe"),
business_endpoint=MyBusinessEndpoint(),
)Current limitation
- With
DefaultBusinessEndpoint, the built-inBlenderApiworks directly - If you replace it with a custom endpoint, the built-in
BlenderApistops working unless the custom endpoint keepsrna.*,ops.*, andwatch.*compatible - When only adding a few app-specific commands, keep
DefaultBusinessEndpointand extend on top of it