MCPcopy Create free account
hub / github.com/DiligentGraphics/DiligentFX / ResolveParameter

Function ResolveParameter

Hydrogent/src/HnMaterialNetwork.cpp:417–449  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

415// corresponding value on given SdrNode.
416template <typename T>
417T ResolveParameter(const pxr::HdMaterialNode2& Node,
418 const pxr::SdrShaderNodeConstPtr& SdrNode,
419 const pxr::TfToken& Name,
420 const T& DefaultValue)
421{
422 // First consult node parameters...
423 {
424 const auto param_it = Node.parameters.find(Name);
425 if (param_it != Node.parameters.end())
426 {
427 const pxr::VtValue& Value = param_it->second;
428 if (Value.IsHolding<T>())
429 {
430 return Value.UncheckedGet<T>();
431 }
432 }
433 }
434
435 // Then fallback to SdrNode.
436 if (SdrNode)
437 {
438 if (const pxr::SdrShaderPropertyConstPtr Input = SdrNode->GetShaderInput(Name))
439 {
440 const pxr::VtValue& Value = Input->GetDefaultValue();
441 if (Value.IsHolding<T>())
442 {
443 return Value.UncheckedGet<T>();
444 }
445 }
446 }
447
448 return DefaultValue;
449}
450
451std::string ResolveAssetPath(const pxr::VtValue& Value)
452{

Callers 4

AddTextureParamMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected