1
1
Fork 0

MaterialX: Implement export of Input nodes #20

Merged
Bogdan Nagirniak merged 26 commits from Vasyl-Pidhirskyi/blender:BLEN-530 into matx-export-material 2023-09-15 19:55:37 +02:00
1 changed files with 28 additions and 0 deletions
Showing only changes of commit 4c8004b49b - Show all commits

View File

@ -58,6 +58,33 @@ static int node_shader_gpu_geometry(GPUMaterial *mat,
return success;
}
NODE_SHADER_MATERIALX_BEGIN
{
/* TODO: Partially implemented, some nodes don't have an implementation in MaterialX 1.38.6.*/
CLG_LogRef *LOG_MATERIALX_SHADER = materialx::LOG_MATERIALX_SHADER;
NodeItem res = empty();
const char *output_name = socket_out_->name;
BogdanNagirniak marked this conversation as resolved
Review

maybe std::string name = socket_out_->name ?

maybe std::string name = socket_out_->name ?
if (STREQ(output_name, "Position")) {
res = create_node("position", NodeItem::Type::Vector3);
res.set_input("space", val(std::string("world")));
}
if (STREQ(output_name, "Normal")) {
res = create_node("normal", NodeItem::Type::Vector3);
res.set_input("space", val(std::string("world")));
}
if (STREQ(output_name, "Tangent")) {
res = create_node("tangent", NodeItem::Type::Vector3);
res.set_input("space", val(std::string("world")));
}
else {
CLOG_WARN(LOG_MATERIALX_SHADER, "Unimplemented output %s", output_name);
}
return res;
}
NODE_SHADER_MATERIALX_END
} // namespace blender::nodes::node_shader_geometry_cc
/* node type definition */
@ -70,6 +97,7 @@ void register_node_type_sh_geometry()
sh_node_type_base(&ntype, SH_NODE_NEW_GEOMETRY, "Geometry", NODE_CLASS_INPUT);
ntype.declare = file_ns::node_declare;
ntype.gpu_fn = file_ns::node_shader_gpu_geometry;
ntype.materialx_fn = file_ns::node_shader_materialx;
nodeRegisterType(&ntype);
}