HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SdrShaderNodeQueryUtils Namespace Reference

Functions

SDR_API VtDictionary GroupQueryResults (const SdrShaderNodeQueryResult &result)
 

Function Documentation

SDR_API VtDictionary SdrShaderNodeQueryUtils::GroupQueryResults ( const SdrShaderNodeQueryResult result)

Return shader node query results in a nested tree form.

For example, if a query result contains:

  • values ["context1", "id1"] ["context1", "id2"]
  • one shader node corresponding to the first value row
  • two shader nodes corresponding to the second value row

The grouped result will be a VtDictionary of the form

{
"context1": {
}
}

where the SdrShaderNodeConstPtr container is a VtValue holding std::vector<SdrShaderNodeConstPtr> and is sorted alphabetically by node identifier, then shadingSystem.

Values are stringified by SdrShaderNodeQueryResult::GetStringifiedValues.

Note that this utility doesn't help collapse empty values, but will rather preserve empty values as keys. For example, a query result containing values from a single node might have values:

[["a", "", "b"]]

For this above example, this function would return

{"a": {"": {"b": [<SdrShaderNodeConstPtr>] }}}

Note that innermost nodes are always contained in a list structure.

Returns an empty VtDictionary if the given query result has no keys or if the result has no nodes.