Skip to content

MayaUSD RenderSettings DG node#4569

Open
derlerk wants to merge 3 commits intodevfrom
derlerk/EMSUSDC-373_2
Open

MayaUSD RenderSettings DG node#4569
derlerk wants to merge 3 commits intodevfrom
derlerk/EMSUSDC-373_2

Conversation

@derlerk
Copy link
Copy Markdown
Collaborator

@derlerk derlerk commented Apr 7, 2026

MayaUSD RenderSettings DG node

EMSUSDC-373

What

Adds a generic, singleton USD settings DG node family to mayaUsdPlugin, and ships the first concrete instance: UsdDefaultRenderSettings. Each settings node owns an in-memory USD stage that is serialized into the Maya scene file (no external .usd asset).

The infrastructure is generic so future settings (e.g. OpenEXR) drop in as a single registration call.

How

  • UsdSettingsNode — pure DG node (UsdDefaultSettings), locked at creation, name == lookup key. Implements ProxyStageProvider. Persists root + session layers via two hidden string attrs.
  • UsdSceneSettingsManager — name-keyed populator registry, MObjectHandle-tracked singletons, scene-callback lifecycle (kAfterNew / kAfterSceneReadAndRecordEdits / kBeforeSave), stage observer hook UFE plugs into.
  • sceneRenderSettings.cpp — registers "UsdDefaultRenderSettings"; populator builds the /Render scope + UsdRenderSettings prim and publishes the path as stage metadata renderSettingsPrimPath.

UFE

  • ProxyShapeHierarchy[Handler]GatewayHierarchy[Handler] (file + class rename) so the same hierarchy can serve any Maya-side gateway, not only proxy shapes. No behavioural change for proxy-shape paths.
  • DG UFE plumbing: dgNodeToUfePath() + DGPathSeparator = '\0'. Utils::getStage / stagePath gain a settings-node fallback so DG-segment paths resolve and StagesSubject::stageChanged can map a settings stage back to its UFE path. UsdStageMap stays proxy-shape-only.
  • MayaStagesSubject::observeStage() (idempotent, sweeps stale weak-ptr entries) wires settings-node stages into the same TfNotice flow as proxy-shape stages.
  • Reference imports of settings nodes are filtered out by isReferencedUsdSettingsNode() so they cannot collide with the local singleton.

Other changes

  • Python facade: mayaUsd.lib.UsdDefaultRenderSettings.{find, getUsdStage, getDefaultRenderSettingsPrim}.
  • mayaUsdPlugin-side init/finalize wiring lives in plugin/adsk/plugin/plugin.cpp;

@derlerk derlerk assigned derlerk and unassigned derlerk Apr 7, 2026
@derlerk derlerk assigned derlerk and unassigned derlerk Apr 22, 2026
@derlerk derlerk self-assigned this Apr 23, 2026
@derlerk derlerk force-pushed the derlerk/EMSUSDC-373_2 branch from c70d1ec to 547671f Compare April 23, 2026 18:26
@derlerk derlerk assigned derlerk and unassigned derlerk May 1, 2026
@derlerk derlerk force-pushed the derlerk/EMSUSDC-373_2 branch from 3e9f54a to bae5025 Compare May 5, 2026 00:21
@derlerk derlerk assigned derlerk and unassigned derlerk May 5, 2026
@derlerk derlerk marked this pull request as ready for review May 5, 2026 00:48
@derlerk derlerk requested review from ppt-adsk and seando-adsk May 5, 2026 00:48
ppt-adsk
ppt-adsk previously approved these changes May 5, 2026
Copy link
Copy Markdown
Collaborator

@ppt-adsk ppt-adsk left a comment

Choose a reason for hiding this comment

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

Had a quick read-through, looks good to me!

Comment thread lib/mayaUsd/nodes/usdSettingsNode.cpp Outdated
// the manager's lookup key. The const_cast is required because
// MPxNode::thisMObject() is non-const in the Maya API; the call has no
// observable mutation.
MFnDependencyNode depFn(const_cast<UsdSettingsNode*>(this)->thisMObject());
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.

MFnDependencyNode has a const-correct constructor.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Missed that, fixing! Thanks!

Comment thread lib/mayaUsd/nodes/usdSceneSettingsManager.h
Add the "activeSettingsPath" to the sceneRenderSettings, which holds the RenderSettings that should be used, with maching tests.
Lighten up the doc verbosity.
Remove locks that had no place. Locking the node doesn't lock the attribute value.
@derlerk derlerk assigned derlerk and unassigned derlerk May 5, 2026
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