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
Showing only changes of commit cf191c8add - Show all commits

View File

@ -55,6 +55,23 @@ static void node_shader_init_ambient_occlusion(bNodeTree * /*ntree*/, bNode *nod
node->custom2 = 0;
}
NODE_SHADER_MATERIALX_BEGIN
{
/* TODO: observed crash while rendering MaterialX_v1_38_6::ExceptionShaderGenError */
/*
* NodeItem maxdistance = get_input_value("Distance", NodeItem::Type::Float);
* NodeItem res = create_node("ambientocclusion", NodeItem::Type::Float);
* res.set_input("coneangle", val(90.0f));
* res.set_input("maxdistance", maxdistance);
*/
NodeItem res = val(MaterialX::Color4(1.0f, 0.0f, 1.0f, 1.0f));
BogdanNagirniak marked this conversation as resolved
Review
NodeItem color = get_input_value("Color", NodeItem::Type::Color4);
NodeItem res = color;
``` NodeItem color = get_input_value("Color", NodeItem::Type::Color4); NodeItem res = color; ```
if (STREQ(socket_out_->name, "AO")) {
res = res.extract(3);
}
return res;
}
NODE_SHADER_MATERIALX_END
} // namespace blender::nodes::node_shader_ambient_occlusion_cc
/* node type definition */
@ -69,6 +86,7 @@ void register_node_type_sh_ambient_occlusion()
ntype.draw_buttons = file_ns::node_shader_buts_ambient_occlusion;
ntype.initfunc = file_ns::node_shader_init_ambient_occlusion;
ntype.gpu_fn = file_ns::node_shader_gpu_ambient_occlusion;
ntype.materialx_fn = file_ns::node_shader_materialx;
nodeRegisterType(&ntype);
}