Skip to content

Frame number resolving scene index, with test. - #491

Draft
ppt-adsk wants to merge 1 commit into
devfrom
tremblp/HYDRA-2428/hash_marks_in_product_name
Draft

Frame number resolving scene index, with test.#491
ppt-adsk wants to merge 1 commit into
devfrom
tremblp/HYDRA-2428/hash_marks_in_product_name

Conversation

@ppt-adsk

@ppt-adsk ppt-adsk commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Provides support for authoring the USD RenderProduct.productName property with one or more sequences of hash marks ('#'). These hash mark sequences will be replaced with the current frame number at render time by a new frame resolving scene index.

@ppt-adsk
ppt-adsk requested a review from benyoon-adsk August 17, 2026 20:20

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.

Not directly related to this change, but useful for debugging.

std::unique_ptr<PXR_NS::HdxTaskController> _taskController;
PXR_NS::HdPluginRenderDelegateUniqueHandle _renderDelegate = nullptr;
PXR_NS::HdSceneIndexBaseRefPtr _lastFilteringSceneIndexBeforeCustomFiltering {nullptr};
PXR_NS::HdSceneIndexBaseRefPtr _inputSceneIndexOfFilteringSceneIndicesChain {nullptr};

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.

Unnecessary data member, removed.


void _SetRenderPurposeTags(const PXR_NS::MayaHydraParams& delegateParams);
void _CreateSceneIndicesChainAfterMergingSceneIndex();
void _CreateSceneIndicesChainAfterMergingSceneIndex(

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.

Change interface to pass in the appropriate scene index, rather than reading it from a data member.

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.

Adapted from AnimCubeRenderSettings.ma

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.

Adapted from AnimCubeRenderSettings.usda

{
HdSceneIndexPrim prim = GetInputSceneIndex()->GetPrim(primPath);

auto sceneGlobals = HdSceneGlobalsSchema::GetFromSceneIndex(

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.

If we have no scene globals to get time from, can't do anything.

auto activeRenderSettingsDs = sceneGlobals.GetActiveRenderSettingsPrim();
if (!activeRenderSettingsDs
|| activeRenderSettingsDs->GetTypedValue(0) != primPath) {
return prim;

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.

At this point USD render products have been flattened into data sources in the render settings prims. If this prim is not the active render settings prim, nothing to do, pass through.

return prim;
}

auto renderProductsDs = HdVectorDataSource::Cast(

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.

Get the render products in the Hydra flattened render settings prim.

HdRenderSettingsSchemaTokens->renderSettings,
HdRenderSettingsSchemaTokens->renderProducts);

prim.dataSource = HdContainerDataSourceEditor(prim.dataSource)

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.

Resolve all render products for frame number.

// (but n is usually small), and requires the FrameNbResolvingSceneIndex to
// be downstream of the scene globals scene index.
//
HdSceneIndexObserver::DirtiedPrimEntries augmented(entries);

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.

Did the time change in the scene globals? If so, dirty the render products in the active render settings prim. This might dirty too much, if the render products are not animated (default value) and have no '#' sequences (but that is not a very interesting use case), or if the render products are animated (time sampled) and have no '#' sequences. This is plausible, but we are not dirtying much, so the simplicity of this approach is worth it.

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.

1 participant