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:
@@ -4,6 +4,7 @@
|
||||
#include "../core/MaterialManager.h"
|
||||
#include "IconManager.h"
|
||||
#include "MaterialPreviewRenderer.h"
|
||||
#include "NodeThumbnailCache.h"
|
||||
#include <pxr/usd/usd/stage.h>
|
||||
#include <pxr/usd/sdf/path.h>
|
||||
#include <pxr/usd/sdf/valueTypeName.h>
|
||||
@@ -88,6 +89,7 @@ private:
|
||||
/// MaterialX standard_surface + image nodes fed by a texcoord node.
|
||||
void CreateUsdPresetGraph();
|
||||
void CreateMaterialXPresetGraph();
|
||||
void CreateArnoldPresetGraph();
|
||||
void RenderNodeGraphCanvas();
|
||||
void RenderPreviewPanel();
|
||||
void HandleCreateAndDelete();
|
||||
@@ -113,6 +115,9 @@ private:
|
||||
void CreateConnection(const PinInfo& destInput, const PinInfo& sourceOutput);
|
||||
void DeleteNode(const pxr::SdfPath& nodePath);
|
||||
void DisconnectAttr(const pxr::SdfPath& destNode, const std::string& destInput);
|
||||
/// Resolved on-disk path of a texture node's image (its Asset-typed `file`
|
||||
/// input), or empty if unauthored/unresolvable. Feeds the thumbnail cache.
|
||||
std::string ResolveTextureFilePath(const ShaderGraphNode& node) const;
|
||||
void SyncFromUsd();
|
||||
void PersistNodePosition(ax::NodeEditor::NodeId nodeId);
|
||||
bool IsPinLinked(const pxr::SdfPath& nodePath, const std::string& pinName, bool isOutput) const;
|
||||
@@ -146,6 +151,8 @@ private:
|
||||
std::unordered_map<uintptr_t, LinkInfo> m_linkIdToInfo;
|
||||
|
||||
MaterialPreviewRenderer m_preview;
|
||||
/// Per-node in-canvas thumbnails (texture images + material shader balls).
|
||||
NodeThumbnailCache m_thumbnails;
|
||||
|
||||
ImVec2 m_pendingCreateNodePos{0.0f, 0.0f};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user