Frame number resolving scene index, with test. - #491
Conversation
There was a problem hiding this comment.
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}; |
There was a problem hiding this comment.
Unnecessary data member, removed.
|
|
||
| void _SetRenderPurposeTags(const PXR_NS::MayaHydraParams& delegateParams); | ||
| void _CreateSceneIndicesChainAfterMergingSceneIndex(); | ||
| void _CreateSceneIndicesChainAfterMergingSceneIndex( |
There was a problem hiding this comment.
Change interface to pass in the appropriate scene index, rather than reading it from a data member.
There was a problem hiding this comment.
Adapted from AnimCubeRenderSettings.ma
There was a problem hiding this comment.
Adapted from AnimCubeRenderSettings.usda
| { | ||
| HdSceneIndexPrim prim = GetInputSceneIndex()->GetPrim(primPath); | ||
|
|
||
| auto sceneGlobals = HdSceneGlobalsSchema::GetFromSceneIndex( |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
Get the render products in the Hydra flattened render settings prim.
| HdRenderSettingsSchemaTokens->renderSettings, | ||
| HdRenderSettingsSchemaTokens->renderProducts); | ||
|
|
||
| prim.dataSource = HdContainerDataSourceEditor(prim.dataSource) |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
| /// zero-padded or truncated to match the width of the '#' run. | ||
| /// | ||
| /// For example, given frame 57 and product name "####frame#.jpg", the | ||
| /// resolved name is "0057frame7.jpg". |
There was a problem hiding this comment.
I don't fully understand why we would need to truncate the frame number for a smaller '#' width, is there something I'm missing? Is this the existing behavior in Maya?
- I don't see why there should be multiple occurrences of # in a single product name (i.e. ####frame#.jpg ? why not just ####frame.jpg or frame####.jpg)? I see that the test scene has the product name
/mainCamFrame_#_##_###.png, so would it be mainCamFrame_7_57_057.png? What would be the use case?
a. In Maya the hash marks seem to be on one side or another (i.e. ####frame.jpg or frame####.jpg, not ####frame#.jpg?) - Why truncate when '#' is smaller than the frame digit length? what if the product name is frame#.jpg and frame 57? wouldn't it overwrite itself every 10 frames?
There was a problem hiding this comment.
- Don't really see a use case for it, it was simple enough to implement. I looked at the code to only consider the first run of '#' characters, and it's more complex for no gain that I can think of. Therefore, since I think there's no harm in this, and the code is simpler, I suggest leaving it in, even though there's no need for it.
- As per your comment in fvpFrameNbResolvingSceneIndex.cpp, I'll remove the truncation and set the replacement as a minimal field width, thanks for picking this up.
| FrameNbResolvingSceneIndex( | ||
| const PXR_NS::HdSceneIndexBaseRefPtr& inputSceneIndex); | ||
|
|
||
| void _PrimsAdded( | ||
| const PXR_NS::HdSceneIndexBase& sender, | ||
| const PXR_NS::HdSceneIndexObserver::AddedPrimEntries& entries) override; | ||
|
|
||
| void _PrimsRemoved( | ||
| const PXR_NS::HdSceneIndexBase& sender, | ||
| const PXR_NS::HdSceneIndexObserver::RemovedPrimEntries& entries) override; | ||
|
|
||
| void _PrimsDirtied( | ||
| const PXR_NS::HdSceneIndexBase& sender, | ||
| const PXR_NS::HdSceneIndexObserver::DirtiedPrimEntries& entries) override; | ||
| }; |
There was a problem hiding this comment.
Should we add FVP_API to these? I noticed some files add it, some don't.
There was a problem hiding this comment.
Good catch, I think they should be added, if derived classes want to call these methods.
| result.append(frameStr); | ||
| } else { | ||
| // Truncate: take the rightmost runLen digits. | ||
| result.append(frameStr, frameStr.size() - runLen, runLen); |
There was a problem hiding this comment.
Wouldn't this overwrite images if the frame number digits are larger than the width of '#' (i.e. every 10, 100, ... frames) ? Unless this is intended behavior. See point 2 in the comment in: lib/flowViewport/sceneIndex/fvpFrameNbResolvingSceneIndex.h
There was a problem hiding this comment.
Will fix and will set as minimal field width, without truncation. Thanks for the comment.
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.