Skip to content

vp2RenderDelegate: avoid color query warnings in batch mode - #4762

Open
jufrantz wants to merge 1 commit into
Autodesk:devfrom
jufrantz:isp/silence_vp2RenderDelegate_displayRGBColor_warnings_in_maya_batch
Open

jufrantz wants to merge 1 commit into
Autodesk:devfrom
jufrantz:isp/silence_vp2RenderDelegate_displayRGBColor_warnings_in_maya_batch

Conversation

@jufrantz

@jufrantz jufrantz commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

In a batch maya session, the displayRGBColor command is unavailable and the colorIndex command returns nothing, so when using maya.cmds.ogsRender, color queries emitted warnings such as:

Warning: line 1: displayRGBColor is unavailable in batch mode
Warning: Failed to obtain selection highlight color for 'mesh' objects
Warning: Failed to obtain display color polymeshDormant.
Warning: Failed to obtain default color

Skip these queries when Maya is not interactive and return the default colors directly, the same ones that were returned on failure.

…Render)

In a batch maya session, `displayRGBColor` is unavailable and `colorIndex`
returns nothing, so color queries emitted warnings such as:

Warning: line 1: displayRGBColor is unavailable in batch mode
Warning: Failed to obtain selection highlight color for 'mesh' objects
Warning: Failed to obtain display color polymeshDormant.
Warning: Failed to obtain default color

Skip these queries when maya is not interactive and return the default
colors directly, the same ones that were returned on failure.
@seando-adsk seando-adsk added unit test Related to unit tests (both python or c++) vp2renderdelegate Related to VP2RenderDelegate and removed unit test Related to unit tests (both python or c++) labels Oct 1, 2026
@AramAzhari-adsk
AramAzhari-adsk requested a balanced review from Copilot October 9, 2026 18:34

Copilot AI 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.

🟡 Changes recommended

The new batch-mode behavior lacks regression coverage.

1 open finding
What changed in this PR

Prevents unsupported Maya display-color queries during non-interactive rendering.

Changes:

  • Detects whether Maya is interactive.
  • Returns existing fallback colors in batch mode.
File Description
lib/​mayaUsd/​render/​vp2RenderDelegate/​proxyRenderDelegate.cpp Skips display-color commands outside interactive Maya.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

// warning and `colorIndex` command returns nothing.
bool _CanQueryDisplayColors()
{
static const bool isMayaInteractive = MGlobal::mayaState() == MGlobal::kInteractive;
{
static const GfVec3f kDefaultColor(0.000f, 0.016f, 0.376f);

if (!_CanQueryDisplayColors()) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

the early return also hides the "unsupported class" warnings in batch mode. In GetDefaultColor and GetSelectionHighlightColor, the new check runs before the className dispatch. In batch mode, an unsupported prim type now returns silently instead of reaching this warning:
line 2128

    TF_WARN(
        "ProxyRenderDelegate::GetDefaultColor - unsupported class: '%s'",
        className.IsEmpty() ? "empty" : className.GetString().c_str());
    return kDefaultColor;
}

return className.IsEmpty() ? kDefaultLeadColor : kDefaultActiveColor;
#else
if (!_CanQueryDisplayColors()) {
return className.IsEmpty() ? kDefaultLeadColor : kDefaultActiveColor;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same here, hides warning at line 2267

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

Labels

vp2renderdelegate Related to VP2RenderDelegate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants