Skip to content

fix: SG-40934: Defer -eval/-pyeval until display groups exist - #1384

Open
cedrik-fuoco-adsk wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
cedrik-fuoco-adsk:SG-40934-media-cli-bad-view-setting
Open

fix: SG-40934: Defer -eval/-pyeval until display groups exist#1384
cedrik-fuoco-adsk wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
cedrik-fuoco-adsk:SG-40934-media-cli-bad-view-setting

Conversation

@cedrik-fuoco-adsk

Copy link
Copy Markdown
Contributor

SG-40934: Defer -eval/-pyeval evaluation until display groups exist

Linked issues

SG-40934

Summarize your change.

The -eval (Mu) and -pyeval (Python) command line expressions are no longer evaluated from RvSession::postInitialize(). They are split out into a new RvSession::evalCommandLineScripts() method, which the interactive path calls at the end of RvApplication::newSessionFromFiles(). After setPhysicalDevices() has created the display groups and the session is initialized.

Describe the reason for the change.

postInitialize() runs while the RvDocument is still being constructed, well before RVDisplayGroup nodes exist. Only the default RVOutputGroup is present at that point. When media is loaded via -pyeval, source_setup.py's setDisplayFromProfile() looks for an RVDisplayGroup, finds none, and silently applies nothing — so the Display Transfer Function stays "None" instead of "sRGB".

This is why enabling RV_PROGRESSIVE_SOURCE_LOADING=1 works around the bug: it defers the real media load to an async job, by which time the display groups exist. It also explains the regression window — progressive source loading was on by default before RV 2022.0.0.

Fixing the ordering addresses the root cause, so no workaround is needed in source_setup.py. It also fixes the same problem for -eval, and for the reported case of applying flop to a source from the command line.

Describe what you have tested and on which operating system.

  • rv -pyeval "from rv import commands;commands.addSourceVerbose(['some.mov'])"
    → Display Transfer Function is "sRGB", with RV_PROGRESSIVE_SOURCE_LOADING unset

Add a list of changes, and note any that might need special attention during the review.

  • RvApp/RvSession.h, RvApp/RvSession.cpp: new evalCommandLineScripts(); the
    -eval/-pyeval logic is moved verbatim out of postInitialize().
  • RvCommon/RvDocument.cpp: no longer evaluates the expressions during session
    construction.
  • RvCommon/RvApplication.cpp: calls evalCommandLineScripts() at the end of
    newSessionFromFiles().
  • rvio/main.cpp, MovieRV/MovieRV.cpp: call it immediately after
    postInitialize(). These are headless, have no display groups to wait for, and
    keep their current timing.

Needs attention:

  • Behavior change when a command line expression adds a source and file arguments are given, e.g. rv pyeval "addSourceVerbose(['a.mov'])" b.mov. Previously the expression ran first and its source was then wiped by the clear() in rebuildSessionFromFiles(), leaving only b.mov. Now both sources are loaded. Affects -eval and -pyeval equally.
  • The call is placed after the after-progressive-loading block rather than immediately after setPhysicalDevices(). That block is gated on s->loadTotal() == 0 && !files.empty(); evaluating earlier could change loadTotal() and suppress an event that must close a previously emitted before-progressive-loading.
  • The rvlink session-reuse path (rebuildSessionFromFiles() via sessionFromUrl) never called postInitialize(), so it already did not run -pyeval. That is unchanged here.
  • Pre-existing quirk, intentionally not addressed: m_initEval clears itself after running while m_pyInitEval does not, so -eval is effectively once-per-process and -pyeval is per-session, despite both being documented as "at every session start".

The -eval and -pyeval command line expressions were evaluated from
RvSession::postInitialize(), which runs while the RvDocument is still
being constructed. The RVDisplayGroup nodes are only created later, in
RvApplication::newSessionFromFiles(), so any source added by those
expressions had no display group for the source setup packages to
configure and its view settings were silently left unset.

Split the evaluation out of postInitialize() into
RvSession::evalCommandLineScripts() and call it at the end of
newSessionFromFiles(), once the display groups exist and the session is
initialized. The headless rvio and MovieRV paths call it right after
postInitialize(), preserving their current timing.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
@cedrik-fuoco-adsk
cedrik-fuoco-adsk force-pushed the SG-40934-media-cli-bad-view-setting branch from 5c109e0 to a35bb91 Compare August 20, 2026 14:31

@bernie-laberge bernie-laberge left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice !
Thank you @cedrik-fuoco-adsk !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants