Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions engine/viewport.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ def view_update(engine, context, depsgraph, changes=None):
traceback.print_exc()
return

# Check for color management changes first
current_display_device = depsgraph.scene_eval.display_settings.display_device
if not hasattr(engine, 'last_display_device') or current_display_device != engine.last_display_device:
engine.last_display_device = current_display_device
# Don't trigger a full re-export, just redraw to apply the new settings
engine.tag_redraw()
return

s = time()
changes = engine.exporter.get_changes(depsgraph, context, changes)
delta_t = (time() - s) * 1000
Expand All @@ -115,6 +123,7 @@ def view_update(engine, context, depsgraph, changes=None):
# Only restart the session if the view transform didn't change by itself
force_session_restart(engine)
return

s = time()
# We have to re-assign the session because it might have been replaced due to filmsize change
engine.session = engine.exporter.update(depsgraph, context, engine.session, changes)
Expand Down Expand Up @@ -185,6 +194,12 @@ def view_draw(engine, context, depsgraph):
# camera) do not trigger a view_update() call, but only a view_draw() call.
changes = engine.exporter.get_viewport_changes(depsgraph, context)

# New logic to handle color management changes in view_draw
if changes & export.Change.REQUIRES_VIEW_UPDATE:
if framebuffer:
framebuffer.update_color_management(context)
changes &= ~export.Change.VIEW_TRANSFORM

if changes & export.Change.REQUIRES_VIEW_UPDATE:
engine.tag_redraw()
# view_update(engine, context, depsgraph, changes) # Disabled, see comment on force_session_restart()
Expand Down
3 changes: 2 additions & 1 deletion export/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class Change:
WORLD = 1 << 5
IMAGEPIPELINE = 1 << 6
HALT = 1 << 7

REQUIRES_SCENE_EDIT = CAMERA | OBJECT | MATERIAL | VISIBILITY | WORLD
REQUIRES_VIEW_UPDATE = CONFIG
REQUIRES_SESSION_PARSE = IMAGEPIPELINE | HALT
Expand Down Expand Up @@ -446,3 +445,5 @@ def _init_stats(self, stats, config_props, scene):

stats.use_hybridbackforward.value = (config_props.Get("path.hybridbackforward.enable", [False]).GetBool()
and render_engine != "BIDIRCPU")