Add in-canvas node thumbnails to material editor graph
Texture nodes show their decoded source image (background thread); material nodes show a shader-ball render, amortized one-per-frame. Also classifies shader nodes by Hypershade-style category and adds an Arnold preset graph alongside the existing USD/MaterialX ones. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -185,6 +185,7 @@ ShaderGraphSnapshot MaterialManager::GetShaderGraph(const pxr::SdfPath& material
|
||||
pxr::SdrShaderNodeConstPtr sdrNode =
|
||||
pxr::SdrRegistry::GetInstance().GetShaderNodeByIdentifier(shaderId);
|
||||
if (sdrNode) {
|
||||
node.category = DeriveCategory(sdrNode);
|
||||
for (const pxr::TfToken& inputName : sdrNode->GetShaderInputNames()) {
|
||||
if (auto* prop = sdrNode->GetShaderInput(inputName))
|
||||
node.inputs.push_back({inputName.GetString(), prop->GetTypeAsSdfType().GetSdfType()});
|
||||
|
||||
@@ -39,6 +39,11 @@ struct ShaderPinInfo {
|
||||
struct ShaderGraphNode {
|
||||
pxr::SdfPath path;
|
||||
std::string shaderId;
|
||||
/// Coarse Hypershade-style bucket ("Material", "Texture", "Geometry",
|
||||
/// "Utility", "Light") from the same classifier the create-node list uses;
|
||||
/// empty when the shader id isn't in the Sdr registry. Drives which nodes
|
||||
/// get an in-canvas thumbnail.
|
||||
std::string category;
|
||||
pxr::GfVec2f uiPosition{0.0f, 0.0f};
|
||||
/// False when no uiPosition custom data is authored (typical for networks
|
||||
/// referenced from .mtlx) — the editor auto-lays such nodes out instead.
|
||||
|
||||
Reference in New Issue
Block a user