construct::rendering::ViewportFeed
Keeps one worker viewport showing one document.
| Declared in | src/libs/libconstruct/construct/rendering/ViewportFeed.hpp |
| Inherits | QObject |
| Group | construct |
Detailed description
A worker viewport draws from data, never from the live model. A structural edit hands it a whole ConstructSnapshot, and a parameter edit hands it a WorkerSceneDelta that it applies in place with nothing compiled (construct-scene-evaluator §EV-A3). The feed decides which of the two an edit needs. It also turns a burst of edits into one hand-off per event-loop turn, numbers the snapshots, and turns a delta into a snapshot when a delta cannot carry the change.
These rules are the same for every worker viewport. They were members of ConstructShell until the definition editor's preview needed the same rules (construct-multi-document MD-38), so both use this class now.
The rules:
- scheduleSnapshot() and scheduleDelta() coalesce. All calls in one turn leave as one snapshot, or as one delta that names every changed item.
- A snapshot carries every value. It drops the pending delta ids, and a delta queued in the same turn as a snapshot is not sent.
- Each snapshot gets the next structure version. A delta names the version that it applies to, and the worker drops a delta for a scene that it does not have.
- An item whose out-of-band payload changed (a mesh soup, a tet mesh, a proxy version, see Hooks::payloadIdentity) causes a snapshot, because a delta carries no payloads.
- A document with items that gives an empty snapshot is a defect. The previous scene stays on screen and is not blanked.
What differs per client is in Hooks: where the viewport and the document are, how the snapshot is built, and how an item is prepared for the worker. hooksFor() gives the plain answers.
GUI thread only.
See also SceneWorkerWidget, WorkerSceneDelta.