Blender void#74
Open
TheTechromancer wants to merge 5 commits into
Open
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Blender void
Adds a new Blender void layer that shows a live view of a Blender session — with a transparent background, so you can paint behind and around the 3D scene and treat Blender as just another layer. It pairs with a companion Blender extension (
darkly-art/blender-extension) that captures the 3D viewport (or a camera POV), encodes alpha-carrying PNG frames, and serves them over a localhost HTTP server as a single chunked response of length-prefixed frames ([4-byte big-endian length][image bytes]).Rust core
gpu/voids/blender.rs— the new void, registered through the standard modularregister()mechanism. It is a thin config over the sharedvideo_stream_voidmachinery (the same base as the camera and screenshare voids), declaringfreeze,frame_divisor, and a newurlstring param.urlis document-persisted state the frontend reads to know where to connect (defaulthttp://localhost:8765/stream); the Rust void never interprets it.CaptureKind::Stream— a third capture kind alongsideCamera/Display, serialized to the frontend as"stream"so the app knows to source frames via HTTPfetchrather than aMediaDevicesAPI.video_stream_void— the shared machinery now keeps aparam_snapshotof every param in schema order, so params it doesn't model (likeurl) round-trip throughfrom_params→param_values(save/load) andupdate_params(the properties panel) instead of being silently regenerated from their defaults. Covered by a regression test (passthrough_param_round_trips) plus unit tests on the void's registration, params, and default transform.Frontend
lib/frameSource.ts— new abstractFrameSourcebase extracted fromMediaStreamSource, owning the per-tick lifecycle every external-frame void shares: the visible / frozen / frame-divisor / has-new-frame gate, off-threadcreateImageBitmapdecode (with the document-resolution downscale cap), and theuploadVoidExternalImageGPU upload. Subclasses only supply where the frame comes from.lib/httpStreamSource.ts— the Blender-side subclass. Itfetches the stream URL, pumps the response body in the background, and reassembles complete length-prefixed frames independent of HTTP chunk boundaries. Frames decode withpremultiplyAlpha: 'none'to preserve the straight alpha the add-on emits, and the blob carries no MIME type —createImageBitmapcontent-sniffs, so the add-on can switch codecs without a frontend change. A change-drivenhasFrameReadygate means a static Blender scene drives zero decode and zero GPU work. Reconnect-on-url-change, supersede-in-flight-connection, and clean disconnect handling (with human-readable errors like "Is the add-on running?") are all covered by unit tests (httpStreamSource.test.ts).lib/mediaStreamSource.ts— refactored down to aFrameSourcesubclass that only supplies the live<video>frame and theMediaStreamlifecycle; all duplicated tick/decode/upload logic moved into the base.state/app.svelte.ts— the media-stream registry generalized to aFrameSourceregistry (streamSources,startStreamSource,stopStreamSource, …).streamvoids connect immediately on creation — no gesture or permission gate is needed for a localhost HTTP stream — while camera/screenshare keep their in-gesture acquisition path. The layer-tree reconciler additionally pushesurlchanges to a live source, and the existing reap/freeze/visibility/divisor plumbing applies unchanged.streamvoids;VoidPropertiesgains a string-param text input (used forurl) and a per-kind connect verb ("Connect to Blender" alongside "Resume camera" / "Resume screen share"), with disconnect errors surfaced in the same notice camera/screenshare use.Misc
The companion Blender extension itself lives in its own repository and is not part of this diff.