Blender V5.3
material.cpp
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2022 NVIDIA Corporation
2 * SPDX-FileCopyrightText: 2022 Blender Foundation
3 *
4 * SPDX-License-Identifier: Apache-2.0 */
5
6#include "hydra/material.h"
7#include "hydra/node_util.h"
8#include "hydra/session.h"
9#include "hydra/util.h"
10#include "scene/scene.h"
11#include "scene/shader.h"
12#include "scene/shader_graph.h"
13#include "scene/shader_nodes.h"
14
15#include <pxr/imaging/hd/material.h>
16#include <pxr/imaging/hd/materialConnectionSchema.h>
17#include <pxr/imaging/hd/materialNetworkSchema.h>
18#include <pxr/imaging/hd/materialNodeParameterSchema.h>
19#include <pxr/imaging/hd/materialNodeSchema.h>
20#include <pxr/imaging/hd/materialSchema.h>
21#include <pxr/imaging/hd/sceneDelegate.h>
22
24
25/* Normalize a material network node name to a full SdfPath. The schema may
26 * provide either a full path or a bare identifier. */
27static SdfPath MaterialNodeNameToSdfPath(const TfToken &nodeName)
28{
29 const std::string &s = nodeName.GetString();
30 if (s.empty()) {
31 return SdfPath::EmptyPath();
32 }
33 if (s[0] == '/' && SdfPath::IsValidPathString(s)) {
34 return SdfPath(s);
35 }
36 return SdfPath::AbsoluteRootPath().AppendChild(nodeName);
37}
38
39// clang-format off
40TF_DEFINE_PRIVATE_TOKENS(CyclesMaterialTokens,
41 (cycles)
42 ((cyclesSurface, "cycles:surface"))
43 ((cyclesDisplacement, "cycles:displacement"))
44 ((cyclesVolume, "cycles:volume"))
45 (UsdPreviewSurface)
46 (UsdUVTexture)
47 (UsdPrimvarReader_float)
48 (UsdPrimvarReader_float2)
49 (UsdPrimvarReader_float3)
50 (UsdPrimvarReader_float4)
51 (UsdPrimvarReader_int)
52 (UsdTransform2d)
53 (a)
54 (rgb)
55 (r)
56 (g)
57 (b)
58 (result)
59 (st)
60 (wrapS)
61 (wrapT)
62 (periodic)
63);
64// clang-format on
65
66/* Simple class to handle remapping of USDPreviewSurface nodes and parameters to Cycles
67 * equivalents. */
69 using ParamMap = std::unordered_map<TfToken, ustring, TfToken::HashFunctor>;
70
71 public:
72 UsdToCyclesMapping(const char *nodeType, ParamMap paramMap)
73 : _nodeType(nodeType), _paramMap(std::move(paramMap))
74 {
75 }
76
77 ustring nodeType() const
78 {
79 return _nodeType;
80 }
81
82 bool hasParameterMapping(const TfToken &name) const
83 {
84 return _paramMap.find(name) != _paramMap.end();
85 }
86
87 virtual std::string parameterName(const TfToken &name,
88 const ShaderInput *inputConnection,
89 VtValue * /*value*/ = nullptr) const
90 {
91 /* UsdNode.name -> Node.input. These all follow a simple pattern that we can just
92 * remap based on the name or 'Node.input' type. */
93 if (inputConnection) {
94 if (name == CyclesMaterialTokens->a) {
95 return "alpha";
96 }
97 if (name == CyclesMaterialTokens->rgb) {
98 return "color";
99 }
100 /* TODO: Is there a better mapping than 'color'? */
101 if (name == CyclesMaterialTokens->r || name == CyclesMaterialTokens->g ||
102 name == CyclesMaterialTokens->b)
103 {
104 return "color";
105 }
106
107 if (name == CyclesMaterialTokens->result) {
108 switch (inputConnection->socket_type.type) {
111 case SocketType::INT:
112 case SocketType::UINT:
113 return "alpha";
118 default:
119 return "color";
120 }
121 }
122 }
123
124 /* Simple mapping case */
125 const auto it = _paramMap.find(name);
126 return it != _paramMap.end() ? it->second.string() : name.GetString();
127 }
128
129 private:
130 const ustring _nodeType;
131 ParamMap _paramMap;
132};
133
135 public:
137
138 std::string parameterName(const TfToken &name,
139 const ShaderInput *inputConnection,
140 VtValue *value) const override
141 {
142 if (value) {
143 /* Remap UsdUVTexture.wrapS and UsdUVTexture.wrapT to cycles_image_texture.extension. */
144 if (name == CyclesMaterialTokens->wrapS || name == CyclesMaterialTokens->wrapT) {
145 const std::string valueString = VtValue::Cast<std::string>(*value).Get<std::string>();
146
147 /* A value of 'repeat' in USD is equivalent to 'periodic' in Cycles. */
148 if (valueString == "repeat") {
149 *value = VtValue(CyclesMaterialTokens->periodic);
150 }
151
152 return "extension";
153 }
154 }
155
156 return UsdToCyclesMapping::parameterName(name, inputConnection, value);
157 }
158};
159
160namespace {
161
162class UsdToCycles {
163 const UsdToCyclesMapping UsdPreviewSurface = {
164 "principled_bsdf",
165 {
166 {TfToken("diffuseColor"), ustring("base_color")},
167 {TfToken("emissiveColor"), ustring("emission")},
168 {TfToken("specularColor"), ustring("specular")},
169 {TfToken("clearcoatRoughness"), ustring("coat_roughness")},
170 {TfToken("opacity"), ustring("alpha")},
171 /* opacityThreshold */
172 /* occlusion */
173 /* displacement */
174 }};
175 const UsdToCyclesTexture UsdUVTexture = {
176 "image_texture",
177 {
178 {CyclesMaterialTokens->st, ustring("vector")},
179 {CyclesMaterialTokens->wrapS, ustring("extension")},
180 {CyclesMaterialTokens->wrapT, ustring("extension")},
181 {TfToken("file"), ustring("filename")},
182 {TfToken("sourceColorSpace"), ustring("colorspace")},
183 }};
184 const UsdToCyclesMapping UsdPrimvarReader = {"attribute",
185 {{TfToken("varname"), ustring("attribute")}}};
186
187 public:
188 const UsdToCyclesMapping *findUsd(const TfToken &usdNodeType)
189 {
190 if (usdNodeType == CyclesMaterialTokens->UsdPreviewSurface) {
191 return &UsdPreviewSurface;
192 }
193 if (usdNodeType == CyclesMaterialTokens->UsdUVTexture) {
194 return &UsdUVTexture;
195 }
196 if (usdNodeType == CyclesMaterialTokens->UsdPrimvarReader_float ||
197 usdNodeType == CyclesMaterialTokens->UsdPrimvarReader_float2 ||
198 usdNodeType == CyclesMaterialTokens->UsdPrimvarReader_float3 ||
199 usdNodeType == CyclesMaterialTokens->UsdPrimvarReader_float4 ||
200 usdNodeType == CyclesMaterialTokens->UsdPrimvarReader_int)
201 {
202 return &UsdPrimvarReader;
203 }
204
205 return nullptr;
206 }
207 const UsdToCyclesMapping *findCycles(const ustring & /*cyclesNodeType*/)
208 {
209 return nullptr;
210 }
211};
212TfStaticData<UsdToCycles> sUsdToCyles;
213
214} // namespace
215
216static void AddInstanceIdAOV(ShaderGraph *graph)
217{
218 /* Instance AOV is provided for every network, to make picking work. */
219 const ustring instanceId(HdAovTokens->instanceId.GetString());
220
221 OutputAOVNode *aovNode = graph->create_node<OutputAOVNode>();
222 aovNode->set_name(instanceId);
223
224 AttributeNode *instanceIdNode = graph->create_node<AttributeNode>();
225 instanceIdNode->set_attribute(instanceId);
226
227 graph->connect(instanceIdNode->output("Fac"), aovNode->input("Value"));
228}
229
230HdCyclesMaterial::HdCyclesMaterial(const SdfPath &sprimId) : HdMaterial(sprimId) {}
231
233
235{
236 return DirtyBits::DirtyResource | DirtyBits::DirtyParams;
237}
238
239void HdCyclesMaterial::Sync(HdSceneDelegate *sceneDelegate,
240 HdRenderParam *renderParam,
241 HdDirtyBits *dirtyBits)
242{
243 if (*dirtyBits == DirtyBits::Clean) {
244 return;
245 }
246
247 const bool dirtyParams = (*dirtyBits & DirtyBits::DirtyParams);
248 const bool dirtyResource = (*dirtyBits & DirtyBits::DirtyResource);
249
250 const SdfPath &id = GetId();
251
252 if (dirtyResource || dirtyParams) {
253 const HdSceneIndexPrim prim = GetPrim(sceneDelegate, id);
254 const HdContainerDataSourceHandle &primDs = prim.dataSource;
255
256 HdMaterialSchema matSchema = HdMaterialSchema::GetFromParent(primDs);
257 /* Prefer cycles network if it exists, otherwise use universal network. */
258 HdMaterialNetworkSchema network = matSchema.GetMaterialNetwork(CyclesMaterialTokens->cycles);
259 if (!network) {
260 network = matSchema.GetMaterialNetwork();
261 }
262
263 const SceneLock lock(renderParam);
264
265 if (network && !_nodes.empty() && !dirtyResource) {
266 UpdateParameters(network);
267 _shader->tag_update(lock.scene);
268 }
269 else {
271 if (!network) {
272 TF_WARN("Could not get a material network for %s.", id.GetText());
273 }
274 else {
275 graph = BuildShaderGraph(network);
276 if (!graph) {
277 TF_WARN("Could not build a shader graph for %s.", id.GetText());
278 }
279 }
280
281 if (!graph) {
282 /* Default shader if translation failed, so something is visible. */
283 graph = make_unique<ShaderGraph>();
284 PrincipledBsdfNode *bsdf = graph->create_node<PrincipledBsdfNode>();
285 graph->connect(bsdf->output("BSDF"), graph->output()->input("Surface"));
286 }
287
288 AddInstanceIdAOV(graph.get());
289
290 if (!_shader) {
291 _shader = lock.scene->create_node<Shader>();
292 }
293
294 _shader->set_graph(std::move(graph));
295 _shader->tag_update(lock.scene);
296 }
297 }
298
299 *dirtyBits = DirtyBits::Clean;
300}
301
302void HdCyclesMaterial::UpdateParameters(NodeDesc &nodeDesc,
303 HdMaterialNodeParameterContainerSchema params,
304 const SdfPath &nodePath)
305{
306 for (const TfToken &paramName : params.GetNames()) {
307 auto valueDs = params.Get(paramName).GetValue();
308 if (!valueDs) {
309 continue;
310 }
311 VtValue value = valueDs->GetValue(0.0f);
312
313 /* See if the parameter name is in USDPreviewSurface terms, and needs to be converted .*/
314 const UsdToCyclesMapping *inputMapping = nodeDesc.mapping;
315 const std::string inputName = inputMapping ?
316 inputMapping->parameterName(paramName, nullptr, &value) :
317 paramName.GetString();
318
319 /* Find the input to write the parameter value to. */
320 const SocketType *input = nullptr;
321 for (const SocketType &socket : nodeDesc.node->type->inputs) {
322 if (string_iequals(socket.name.string(), inputName) || socket.ui_name == inputName) {
323 input = &socket;
324 break;
325 }
326 }
327
328 if (!input) {
329 if (inputMapping) {
330 if (inputMapping->hasParameterMapping(paramName)) {
331 TF_WARN("USD input '%s' on node '%s' maps to unavailable Cycles input '%s' on '%s'",
332 paramName.GetText(),
333 nodePath.GetText(),
334 inputName.c_str(),
335 nodeDesc.node->name.c_str());
336 }
337 else {
338 TF_WARN("Unsupported USD input '%s' on node '%s' ('%s'); value ignored",
339 paramName.GetText(),
340 nodePath.GetText(),
341 nodeDesc.node->name.c_str());
342 }
343 }
344 else {
345 TF_WARN("Could not find parameter '%s' on node '%s' ('%s')",
346 paramName.GetText(),
347 nodePath.GetText(),
348 nodeDesc.node->name.c_str());
349 }
350 continue;
351 }
352
353 SetNodeValue(nodeDesc.node, *input, value);
354 }
355}
356
357void HdCyclesMaterial::UpdateParameters(HdMaterialNetworkSchema network)
358{
359 HdMaterialNodeContainerSchema nodes = network.GetNodes();
360 for (const TfToken &nodeName : nodes.GetNames()) {
361 const SdfPath nodePath = MaterialNodeNameToSdfPath(nodeName);
362
363 const auto nodeIt = _nodes.find(nodePath);
364 if (nodeIt == _nodes.end()) {
365 TF_RUNTIME_ERROR("Could not update parameters on missing node '%s'", nodePath.GetText());
366 continue;
367 }
368
369 UpdateParameters(nodeIt->second, nodes.Get(nodeName).GetParameters(), nodePath);
370 }
371}
372
373void HdCyclesMaterial::UpdateConnections(NodeDesc &nodeDesc,
374 HdMaterialNodeSchema nodeSchema,
375 const SdfPath &nodePath,
376 ShaderGraph *shaderGraph)
377{
378 HdMaterialConnectionVectorContainerSchema conns = nodeSchema.GetInputConnections();
379 for (const TfToken &dstSocketName : conns.GetNames()) {
380 HdMaterialConnectionVectorSchema connVec = conns.Get(dstSocketName);
381 const size_t count = connVec.GetNumElements();
382 if (count == 0) {
383 continue;
384 }
385
386 const UsdToCyclesMapping *inputMapping = nodeDesc.mapping;
387 const std::string inputName = inputMapping ?
388 inputMapping->parameterName(dstSocketName, nullptr) :
389 dstSocketName.GetString();
390
391 /* Find the input to connect to on the passed in node. */
392 ShaderInput *input = nullptr;
393 for (ShaderInput *in : nodeDesc.node->inputs) {
394 if (string_iequals(in->socket_type.name.string(), inputName)) {
395 input = in;
396 break;
397 }
398 }
399
400 if (!input) {
401 TF_WARN("Ignoring connection on '%s.%s', input '%s' was not found",
402 nodePath.GetText(),
403 dstSocketName.GetText(),
404 dstSocketName.GetText());
405 continue;
406 }
407
408 /* USD allows N connections per input (MaterialX <switch>, <combine>, struct
409 * inputs etc). Cycles inputs are single-connection, and the right lowering
410 * depends on the node type, so just take the first and warn. */
411 if (count > 1) {
412 TF_WARN(
413 "Ignoring multiple connections to '%s.%s'", nodePath.GetText(), dstSocketName.GetText());
414 }
415
416 HdMaterialConnectionSchema connSchema = connVec.GetElement(0);
417 const SdfPath upstreamNodePath =
418 connSchema.GetUpstreamNodePath() ?
419 MaterialNodeNameToSdfPath(connSchema.GetUpstreamNodePath()->GetTypedValue(0.0f)) :
420 SdfPath();
421 const TfToken upstreamOutputName = connSchema.GetUpstreamNodeOutputName() ?
422 connSchema.GetUpstreamNodeOutputName()->GetTypedValue(
423 0.0f) :
424 TfToken();
425
426 const auto srcNodeIt = _nodes.find(upstreamNodePath);
427 if (srcNodeIt == _nodes.end()) {
428 TF_WARN("Ignoring connection from '%s.%s' to '%s.%s', node '%s' was not found",
429 upstreamNodePath.GetText(),
430 upstreamOutputName.GetText(),
431 nodePath.GetText(),
432 dstSocketName.GetText(),
433 upstreamNodePath.GetText());
434 continue;
435 }
436
437 const UsdToCyclesMapping *outputMapping = srcNodeIt->second.mapping;
438 const std::string outputName = outputMapping ?
439 outputMapping->parameterName(upstreamOutputName, input) :
440 upstreamOutputName.GetString();
441
442 ShaderOutput *output = nullptr;
443 for (ShaderOutput *out : srcNodeIt->second.node->outputs) {
444 if (string_iequals(out->socket_type.name.string(), outputName)) {
445 output = out;
446 break;
447 }
448 }
449
450 if (!output) {
451 TF_WARN("Ignoring connection from '%s.%s' to '%s.%s', output '%s' was not found",
452 upstreamNodePath.GetText(),
453 upstreamOutputName.GetText(),
454 nodePath.GetText(),
455 dstSocketName.GetText(),
456 upstreamOutputName.GetText());
457 continue;
458 }
459
460 shaderGraph->connect(output, input);
461 }
462}
463
464unique_ptr<ShaderGraph> HdCyclesMaterial::BuildShaderGraph(HdMaterialNetworkSchema network)
465{
466 _nodes.clear();
467
468 unique_ptr<ShaderGraph> graph = make_unique<ShaderGraph>();
469
470 HdMaterialNodeContainerSchema nodes = network.GetNodes();
471
472 /* Iterate all the nodes first and build a complete but unconnected graph with parameters set. */
473 for (const TfToken &nodeName : nodes.GetNames()) {
474 HdMaterialNodeSchema nodeSchema = nodes.Get(nodeName);
475 const SdfPath nodePath = MaterialNodeNameToSdfPath(nodeName);
476
477 NodeDesc nodeDesc = {};
478
479 const auto nodeIt = _nodes.find(nodePath);
480 /* Create new node only if it does not exist yet. */
481 if (nodeIt != _nodes.end()) {
482 nodeDesc = nodeIt->second;
483 }
484 else {
485 /* E.g. cycles_principled_bsdf or UsdPreviewSurface. */
486 const TfToken nodeTypeIdToken = nodeSchema.GetNodeIdentifier() ?
487 nodeSchema.GetNodeIdentifier()->GetTypedValue(0.0f) :
488 TfToken();
489 const std::string &nodeTypeId = nodeTypeIdToken.GetString();
490
491 ustring cyclesType(nodeTypeId);
492 if (nodeTypeId.starts_with("cycles_") || nodeTypeId.starts_with("cycles:")) {
493 /* Native Cycles note embedded in USDShade. */
494 cyclesType = nodeTypeId.substr(strlen("cycles_"));
495 nodeDesc.mapping = sUsdToCyles->findCycles(cyclesType);
496 }
497 else {
498 /* Check if any remapping is needed (e.g. for USDPreviewSurface to Cycles nodes). */
499 nodeDesc.mapping = sUsdToCyles->findUsd(nodeTypeIdToken);
500 if (nodeDesc.mapping) {
501 cyclesType = nodeDesc.mapping->nodeType();
502 }
503 }
504
505 /* If it's a native Cycles' node-type, just do the lookup now. */
506 if (const NodeType *nodeType = NodeType::find(cyclesType)) {
507 nodeDesc.node = graph->create_node(nodeType);
508 _nodes.emplace(nodePath, nodeDesc);
509 }
510 else {
511 TF_RUNTIME_ERROR("Could not create node '%s'", nodePath.GetText());
512 continue;
513 }
514 }
515
516 UpdateParameters(nodeDesc, nodeSchema.GetParameters(), nodePath);
517 }
518
519 /* Now that all nodes have been constructed, iterate the network again and build up any
520 * connections between nodes. */
521 for (const TfToken &nodeName : nodes.GetNames()) {
522 const SdfPath nodePath = MaterialNodeNameToSdfPath(nodeName);
523
524 const auto nodeIt = _nodes.find(nodePath);
525 if (nodeIt == _nodes.end()) {
526 TF_RUNTIME_ERROR("Could not find node '%s' to connect", nodePath.GetText());
527 continue;
528 }
529
530 UpdateConnections(nodeIt->second, nodes.Get(nodeName), nodePath, graph.get());
531 }
532
533 /* Finally connect the terminals to the graph output (Surface, Volume, Displacement). */
534 HdMaterialConnectionContainerSchema terminals = network.GetTerminals();
535 for (const TfToken &terminalName : terminals.GetNames()) {
536 HdMaterialConnectionSchema termSchema = terminals.Get(terminalName);
537 const SdfPath upstreamNodePath =
538 termSchema.GetUpstreamNodePath() ?
539 MaterialNodeNameToSdfPath(termSchema.GetUpstreamNodePath()->GetTypedValue(0.0f)) :
540 SdfPath();
541 const TfToken upstreamOutputName = termSchema.GetUpstreamNodeOutputName() ?
542 termSchema.GetUpstreamNodeOutputName()->GetTypedValue(
543 0.0f) :
544 TfToken();
545
546 const auto nodeIt = _nodes.find(upstreamNodePath);
547 if (nodeIt == _nodes.end()) {
548 TF_RUNTIME_ERROR("Could not find terminal node '%s'", upstreamNodePath.GetText());
549 continue;
550 }
551
552 ShaderNode *const node = nodeIt->second.node;
553
554 const char *inputName = nullptr;
555 const char *outputName = nullptr;
556 if (terminalName == HdMaterialTerminalTokens->surface ||
557 terminalName == CyclesMaterialTokens->cyclesSurface)
558 {
559 inputName = "Surface";
560 /* Find default output name based on the node if none is provided. */
561 if (node->type->name == "add_closure" || node->type->name == "mix_closure") {
562 outputName = "Closure";
563 }
564 else if (node->type->name == "emission") {
565 outputName = "Emission";
566 }
567 else {
568 outputName = "BSDF";
569 }
570 }
571 else if (terminalName == HdMaterialTerminalTokens->displacement ||
572 terminalName == CyclesMaterialTokens->cyclesDisplacement)
573 {
574 inputName = outputName = "Displacement";
575 }
576 else if (terminalName == HdMaterialTerminalTokens->volume ||
577 terminalName == CyclesMaterialTokens->cyclesVolume)
578 {
579 inputName = outputName = "Volume";
580 }
581
582 /* For native Cycles nodes we use the upstream output name as is, for
583 * mapping from e.g. UsdPreviewSurface we need to use the default output
584 * name that is known to exist. */
585 if (!upstreamOutputName.IsEmpty() && nodeIt->second.mapping == nullptr) {
586 outputName = upstreamOutputName.GetText();
587 }
588
589 ShaderInput *const input = inputName ? graph->output()->input(inputName) : nullptr;
590 if (!input) {
591 TF_RUNTIME_ERROR("Could not find terminal input '%s.%s'",
592 upstreamNodePath.GetText(),
593 inputName ? inputName : "<null>");
594 continue;
595 }
596
597 ShaderOutput *const output = outputName ? node->output(outputName) : nullptr;
598 if (!output) {
599 TF_RUNTIME_ERROR("Could not find terminal output '%s.%s'",
600 upstreamNodePath.GetText(),
601 outputName ? outputName : "<null>");
602 continue;
603 }
604
605 graph->connect(output, input);
606 }
607
608 /* Return no graph if nothing got successfully linked due unsupported nodes,
609 * avoids the surface becoming transparent then. */
610 bool any_output_linked = false;
611 for (ShaderInput *input : graph->output()->inputs) {
612 any_output_linked |= input->link != nullptr;
613 }
614 if (!any_output_linked) {
615 _nodes.clear();
616 return nullptr;
617 }
618
619 return graph;
620}
621
622void HdCyclesMaterial::Finalize(HdRenderParam *renderParam)
623{
624 if (!_shader) {
625 return;
626 }
627
628 const SceneLock lock(renderParam);
629 const bool keep_nodes = static_cast<const HdCyclesSession *>(renderParam)->keep_nodes;
630
631 _nodes.clear();
632
633 if (!keep_nodes) {
634 lock.scene->delete_node(_shader);
635 }
636 _shader = nullptr;
637}
638
volatile int lock
#define output
PXR_NS::HdDirtyBits GetInitialDirtyBitsMask() const override
Definition material.cpp:234
void Finalize(PXR_NS::HdRenderParam *renderParam) override
Definition material.cpp:622
HdCyclesMaterial(const PXR_NS::SdfPath &sprimId)
Definition material.cpp:230
~HdCyclesMaterial() override
void Sync(PXR_NS::HdSceneDelegate *sceneDelegate, PXR_NS::HdRenderParam *renderParam, PXR_NS::HdDirtyBits *dirtyBits) override
Definition material.cpp:239
T * create_node(Args &&...args)
void connect(ShaderOutput *from, ShaderInput *to)
const SocketType & socket_type
ShaderOutput * link
ShaderInput * input(const char *name)
ShaderOutput * output(const char *name)
UsdToCyclesMapping(const char *nodeType, ParamMap paramMap)
Definition material.cpp:72
bool hasParameterMapping(const TfToken &name) const
Definition material.cpp:82
virtual std::string parameterName(const TfToken &name, const ShaderInput *inputConnection, VtValue *=nullptr) const
Definition material.cpp:87
ustring nodeType() const
Definition material.cpp:77
UsdToCyclesMapping(const char *nodeType, ParamMap paramMap)
Definition material.cpp:72
std::string parameterName(const TfToken &name, const ShaderInput *inputConnection, VtValue *value) const override
Definition material.cpp:138
#define HDCYCLES_NAMESPACE_CLOSE_SCOPE
TF_DEFINE_PRIVATE_TOKENS(_tokens,(visibleInPrimaryRay)(treatAsPoint)(falloff))
HDCYCLES_NAMESPACE_OPEN_SCOPE HdSceneIndexPrim GetPrim(HdSceneDelegate *delegate, const SdfPath &id)
if(state< num_states)
static void AddInstanceIdAOV(ShaderGraph *graph)
Definition material.cpp:216
static HDCYCLES_NAMESPACE_OPEN_SCOPE SdfPath MaterialNodeNameToSdfPath(const TfToken &nodeName)
Definition material.cpp:27
void SetNodeValue(Node *node, const SocketType &socket, const VtValue &value)
bool string_iequals(const string &a, const string &b)
Definition string.cpp:57
static const NodeType * find(ustring name)
ustring name
Definition node_type.h:84
ustring ui_name
Definition node_type.h:91
Type type
Definition node_type.h:85