Skip to content

Commit

Permalink
Update from 24.03 to 24.05.
Browse files Browse the repository at this point in the history
  • Loading branch information
ppt-adsk committed May 8, 2024
1 parent 888bbd7 commit 8c55c4c
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions lib/mayaHydra/hydraExtensions/sceneIndex/mayaHydraSceneIndexUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@

PXR_NAMESPACE_OPEN_SCOPE

#if PXR_VERSION > 2311
static bool
_ConvertHdMaterialNetworkToHdDataSources(
const HdMaterialNetworkMap &hdNetworkMap,
HdContainerDataSourceHandle *result)
#if PXR_VERSION >= 2405

static
HdContainerDataSourceHandle
_ToMaterialNetworkSchema(
const HdMaterialNetworkMap& hdNetworkMap)
{
HD_TRACE_FUNCTION();

Expand Down Expand Up @@ -91,7 +92,8 @@ _ConvertHdMaterialNetworkToHdDataSources(
.SetValue(
HdRetainedTypedSampledDataSource<VtValue>::New(
item.second.value))
.SetColorSpace(item.second.colorSpace.IsEmpty()
.SetColorSpace(
item.second.colorSpace.IsEmpty()
? nullptr
: HdRetainedTypedSampledDataSource<TfToken>::New(
item.second.colorSpace))
Expand All @@ -108,7 +110,7 @@ _ConvertHdMaterialNetworkToHdDataSources(
TfSmallVector<HdDataSourceBaseHandle, 8> cValues;

for (const HdMaterialRelationship &rel : hdNetwork.relationships) {
if (rel.outputId == node.path) {
if (rel.outputId == node.path) {
TfToken outputPath = rel.inputId.GetToken();
TfToken outputName = TfToken(rel.inputName.GetString());

Expand Down Expand Up @@ -171,22 +173,30 @@ _ConvertHdMaterialNetworkToHdDataSources(

HdContainerDataSourceHandle nodesDefaultContext =
HdRetainedContainerDataSource::New(
nodeNames.size(),
nodeNames.size(),
nodeNames.data(),
nodeValues.data());

HdContainerDataSourceHandle terminalsDefaultContext =
HdRetainedContainerDataSource::New(
terminalsNames.size(),
terminalsNames.size(),
terminalsNames.data(),
terminalsValues.data());

// Create the material network, potentially one per network selector
HdDataSourceBaseHandle network = HdMaterialNetworkSchema::Builder()
return HdMaterialNetworkSchema::Builder()
.SetNodes(nodesDefaultContext)
.SetTerminals(terminalsDefaultContext)
.Build();

}

static bool
_ConvertHdMaterialNetworkToHdDataSources(
const HdMaterialNetworkMap &hdNetworkMap,
HdContainerDataSourceHandle *result)
{
// Create the material network, potentially one per network selector
HdDataSourceBaseHandle network = _ToMaterialNetworkSchema(hdNetworkMap);

TfToken defaultContext = HdMaterialSchemaTokens->universalRenderContext;
*result = HdMaterialSchema::BuildRetained(
1,
Expand All @@ -195,7 +205,9 @@ _ConvertHdMaterialNetworkToHdDataSources(

return true;
}

#else

static bool
_ConvertHdMaterialNetworkToHdDataSources(
const HdMaterialNetworkMap &hdNetworkMap,
Expand Down

0 comments on commit 8c55c4c

Please sign in to comment.