Defer OCIO LUT processor generation in render worker and fix stale graph snapshots

- Override OCIOLutNode::Value() to ensure the processor is created/updated
  before the color transform job is emitted.
- In the worker process, mark the processor dirty on input/config changes
  instead of creating it synchronously during LoadGraph, which blocked the
  main process waiting for the graph load acknowledgement.
- Keep eager processor generation in the main GUI process so the viewer
  cache is invalidated immediately when the LUT file or direction changes.
- Mark the ProjectCopier's internal render-proxy project as modified when
  its update queue is processed, and reset the flag after RenderWorkerPool
  writes a new graph snapshot. This fixes the worker loading a stale graph
  snapshot after switching cube files or direction, which caused the old
  LUT effect to persist.

All existing tests pass.
This commit is contained in:
2026-07-13 10:19:30 +08:00
parent a753d2f787
commit ca22028a52
4 changed files with 109 additions and 44 deletions
+15
View File
@@ -62,6 +62,11 @@ void ProjectCopier::SetProject(Project *project)
original_ = project;
if (original_) {
// The copied project is only used as an in-memory render proxy. Mark it so
// downstream code (e.g. RenderWorkerPool) knows it is safe to reset its
// modified flag after serializing a snapshot.
copy_->setProperty("_oak_render_proxy", true);
// Add all nodes
for (int i = 0; i < copy_->nodes().size(); i++) {
InsertIntoCopyMap(original_->nodes().at(i), copy_->nodes().at(i));
@@ -108,10 +113,13 @@ void ProjectCopier::SetProject(Project *project)
void ProjectCopier::ProcessUpdateQueue()
{
bool copy_changed = false;
// Iterate everything that happened to the graph and do the same thing on our end
while (!graph_update_queue_.empty()) {
QueuedJob job = graph_update_queue_.front();
graph_update_queue_.pop_front();
copy_changed = true;
switch (job.type) {
case QueuedJob::kNodeAdded:
@@ -138,6 +146,13 @@ void ProjectCopier::ProcessUpdateQueue()
}
}
// The copied project is not saved, so its modified flag is only used by the
// render worker pool to decide whether the serialized graph snapshot is stale.
// Mark it modified whenever the copy has actually changed.
if (copy_changed) {
copy_->set_modified(true);
}
// Indicate that we have synchronized to this point, which is compared with the graph change
// time to see if our copied graph is up to date
UpdateLastSyncedValue();