Changeset View
Changeset View
Standalone View
Standalone View
source/blender/io/usd/intern/usd_reader_material.cc
| Show First 20 Lines • Show All 345 Lines • ▼ Show 20 Lines | void USDMaterialReader::import_usd_preview(Material *mtl, | ||||
| if (!(bmain_ && mtl && usd_shader)) { | if (!(bmain_ && mtl && usd_shader)) { | ||||
| return; | return; | ||||
| } | } | ||||
| /* Create the Material's node tree containing the principled BSDF | /* Create the Material's node tree containing the principled BSDF | ||||
| * and output shaders. */ | * and output shaders. */ | ||||
| /* Add the node tree. */ | /* Add the node tree. */ | ||||
| bNodeTree *ntree = ntreeAddTree(nullptr, "Shader Nodetree", "ShaderNodeTree"); | bNodeTree *ntree = ntreeAddTreeEmbedded(nullptr, &mtl->id, "Shader Nodetree", "ShaderNodeTree"); | ||||
| mtl->nodetree = ntree; | |||||
| mtl->use_nodes = true; | mtl->use_nodes = true; | ||||
| /* Create the Principled BSDF shader node. */ | /* Create the Principled BSDF shader node. */ | ||||
| bNode *principled = add_node(nullptr, ntree, SH_NODE_BSDF_PRINCIPLED, 0.0f, 300.0f); | bNode *principled = add_node(nullptr, ntree, SH_NODE_BSDF_PRINCIPLED, 0.0f, 300.0f); | ||||
| if (!principled) { | if (!principled) { | ||||
| std::cerr << "ERROR: Couldn't create SH_NODE_BSDF_PRINCIPLED node for USD shader " | std::cerr << "ERROR: Couldn't create SH_NODE_BSDF_PRINCIPLED node for USD shader " | ||||
| << usd_shader.GetPath() << std::endl; | << usd_shader.GetPath() << std::endl; | ||||
| ▲ Show 20 Lines • Show All 396 Lines • Show Last 20 Lines | |||||