-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use new HdSceneIndex APIs. #3275
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,19 +23,26 @@ | |
|
||
#include <usdUfe/ufe/Utils.h> | ||
|
||
#include <pxr/imaging/hd/retainedDataSource.h> | ||
|
||
#if USD_IMAGING_API_VERSION >= 20 | ||
#include <pxr/usdImaging/usdImaging/sceneIndices.h> | ||
#else | ||
#include <pxr/imaging/hd/flatteningSceneIndex.h> | ||
#if defined(HD_API_VERSION) && HD_API_VERSION >= 51 | ||
#include <pxr/imaging/hd/materialBindingsSchema.h> | ||
#else | ||
#include <pxr/imaging/hd/materialBindingSchema.h> | ||
#endif | ||
#include <pxr/imaging/hd/purposeSchema.h> | ||
#include <pxr/imaging/hd/retainedDataSource.h> | ||
#include <pxr/imaging/hd/sceneIndexPlugin.h> | ||
#include <pxr/imaging/hd/sceneIndexPluginRegistry.h> | ||
#include <pxr/usd/usd/primFlags.h> | ||
#include <pxr/usdImaging/usdImaging/delegate.h> | ||
#if PXR_VERSION >= 2302 | ||
#include <pxr/usdImaging/usdImaging/drawModeSceneIndex.h> //For USD 2302 and later | ||
#include <pxr/usdImaging/usdImaging/modelSchema.h> //For USD 2302 and later | ||
#include <pxr/usdImaging/usdImaging/niPrototypePropagatingSceneIndex.h> | ||
#include <pxr/usdImaging/usdImaging/piPrototypePropagatingSceneIndex.h> | ||
#else | ||
|
@@ -45,6 +52,7 @@ | |
#if defined(HD_API_VERSION) && HD_API_VERSION >= 54 | ||
#include <pxr/imaging/hd/flattenedMaterialBindingsDataSourceProvider.h> | ||
#endif | ||
#endif | ||
|
||
#include <maya/MObject.h> | ||
#include <maya/MObjectHandle.h> | ||
|
@@ -121,10 +129,19 @@ HdSceneIndexBaseRefPtr MayaUsdProxyShapeMayaNodeSceneIndexPlugin::_AppendSceneIn | |
|
||
auto proxyShape = dynamic_cast<MayaUsdProxyShapeBase*>(dependNodeFn.userNode()); | ||
if (TF_VERIFY(proxyShape, "Error getting MayaUsdProxyShapeBase")) { | ||
#if USD_IMAGING_API_VERSION >= 20 | ||
UsdImagingCreateSceneIndicesInfo createInfo; | ||
|
||
UsdImagingSceneIndices sceneIndices = UsdImagingCreateSceneIndices(createInfo); | ||
|
||
return MayaUsd::MayaUsdProxyShapeSceneIndex::New( | ||
proxyShape, sceneIndices.finalSceneIndex, sceneIndices.stageSceneIndex); | ||
#else | ||
|
||
// We already have PXR_VERSION >= 2211 | ||
#if PXR_VERSION < 2302 // So for 2211 | ||
auto usdImagingStageSceneIndex = UsdImagingStageSceneIndex::New(); | ||
HdSceneIndexBaseRefPtr _sceneIndex = UsdImagingGLDrawModeSceneIndex::New( | ||
HdSceneIndexBaseRefPtr sceneIndex = UsdImagingGLDrawModeSceneIndex::New( | ||
HdFlatteningSceneIndex::New( | ||
HdInstancedBySceneIndex::New(usdImagingStageSceneIndex)), | ||
/* inputArgs = */ nullptr); | ||
|
@@ -153,21 +170,30 @@ HdSceneIndexBaseRefPtr MayaUsdProxyShapeMayaNodeSceneIndexPlugin::_AppendSceneIn | |
// Flatten transforms, visibility, purpose, model, and material | ||
// bindings over hierarchies. | ||
// Do it the same way as USDView does with a SceneIndices chain | ||
HdSceneIndexBaseRefPtr _sceneIndex | ||
HdSceneIndexBaseRefPtr sceneIndex | ||
= UsdImagingPiPrototypePropagatingSceneIndex::New(usdImagingStageSceneIndex); | ||
_sceneIndex = UsdImagingNiPrototypePropagatingSceneIndex::New(_sceneIndex); | ||
#if PXR_VERSION < 2311 | ||
sceneIndex = UsdImagingNiPrototypePropagatingSceneIndex::New(sceneIndex); | ||
#else | ||
sceneIndex = UsdImagingNiPrototypePropagatingSceneIndex::New( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I am correct, this block will never be called as line 137 we already returned from the function for USD 23.11+. |
||
sceneIndex, | ||
{ HdMaterialBindingsSchema::GetSchemaToken(), | ||
HdPurposeSchema::GetSchemaToken(), | ||
UsdImagingModelSchema::GetSchemaToken() }, | ||
{}); | ||
#endif | ||
|
||
// The native prototype propagating scene index does a lot of | ||
// the flattening before inserting copies of the the prototypes | ||
// into the scene index. However, the resolved material for a prim | ||
// coming from a USD prototype can depend on the prim ancestors of | ||
// a corresponding instance. So we need to do one final resolve here. | ||
_sceneIndex = HdFlatteningSceneIndex::New(_sceneIndex, flatteningInputArgs); | ||
_sceneIndex = UsdImagingDrawModeSceneIndex::New(_sceneIndex, /* inputArgs = */ nullptr); | ||
sceneIndex = HdFlatteningSceneIndex::New(sceneIndex, flatteningInputArgs); | ||
sceneIndex = UsdImagingDrawModeSceneIndex::New(sceneIndex, /* inputArgs = */ nullptr); | ||
#endif | ||
|
||
return MayaUsd::MayaUsdProxyShapeSceneIndex::New( | ||
proxyShape, _sceneIndex, usdImagingStageSceneIndex); | ||
proxyShape, sceneIndex, usdImagingStageSceneIndex); | ||
#endif | ||
} | ||
} | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@seando-adsk : there is a missing case here which is for usd 23.08, it should contain :
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dj-mcg can you have a look at the code review comment here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dj-mcg Dan would you mind if we pushed the change to the missing 23.08 case to this PR? We are using 23.08 internally and need this fix for MayaHydra.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, so sorry to have dropped the ball on this, I was OOO and am just catching up on things.
No problem checking this in, thanks for taking care of this case!