Changeset View
Changeset View
Standalone View
Standalone View
source/blender/io/wavefront_obj/importer/obj_import_mtl.cc
| Show First 20 Lines • Show All 374 Lines • ▼ Show 20 Lines | static void add_image_textures(Main *bmain, | ||||
| } | } | ||||
| } | } | ||||
| bNodeTree *create_mtl_node_tree(Main *bmain, | bNodeTree *create_mtl_node_tree(Main *bmain, | ||||
| const MTLMaterial &mtl, | const MTLMaterial &mtl, | ||||
| Material *mat, | Material *mat, | ||||
| bool relative_paths) | bool relative_paths) | ||||
| { | { | ||||
| bNodeTree *ntree = ntreeAddTree(nullptr, "Shader Nodetree", ntreeType_Shader->idname); | bNodeTree *ntree = ntreeAddTreeEmbedded( | ||||
| nullptr, &mat->id, "Shader Nodetree", ntreeType_Shader->idname); | |||||
| bNode *bsdf = add_node(ntree, SH_NODE_BSDF_PRINCIPLED, node_locx_bsdf, node_locy_top); | bNode *bsdf = add_node(ntree, SH_NODE_BSDF_PRINCIPLED, node_locx_bsdf, node_locy_top); | ||||
| bNode *output = add_node(ntree, SH_NODE_OUTPUT_MATERIAL, node_locx_output, node_locy_top); | bNode *output = add_node(ntree, SH_NODE_OUTPUT_MATERIAL, node_locx_output, node_locy_top); | ||||
| set_bsdf_socket_values(bsdf, mat, mtl); | set_bsdf_socket_values(bsdf, mat, mtl); | ||||
| add_image_textures(bmain, ntree, bsdf, mat, mtl, relative_paths); | add_image_textures(bmain, ntree, bsdf, mat, mtl, relative_paths); | ||||
| link_sockets(ntree, bsdf, "BSDF", output, "Surface"); | link_sockets(ntree, bsdf, "BSDF", output, "Surface"); | ||||
| nodeSetActive(ntree, output); | nodeSetActive(ntree, output); | ||||
| return ntree; | return ntree; | ||||
| } | } | ||||
| } // namespace blender::io::obj | } // namespace blender::io::obj | ||||