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
3 changed files with 15 additions and 15 deletions
Showing only changes of commit f0f1b574cb - Show all commits

View File

@ -33,20 +33,18 @@ NodeItem NodeParser::compute_full()
/* Checking if node was already computed */ /* Checking if node was already computed */
res.node = graph_->getNode(node_name()); res.node = graph_->getNode(node_name());
if (res.node) { if (!res.node) {
return res.convert(to_type_); CLOG_INFO(LOG_MATERIALX_SHADER,
} 1,
"%s [%d] => %s",
node_->name,
node_->typeinfo->type,
NodeItem::type(to_type_).c_str());
CLOG_INFO(LOG_MATERIALX_SHADER, res = compute();
1, if (res.node) {
"%s [%d] => %s", res.node->setName(node_name());
node_->name, }
node_->typeinfo->type,
NodeItem::type(to_type_).c_str());
res = compute();
if (res.node) {
res.node->setName(node_name());
} }
if (NodeItem::is_arithmetic(to_type_)) { if (NodeItem::is_arithmetic(to_type_)) {
res = res.convert(to_type_); res = res.convert(to_type_);

View File

@ -29,8 +29,9 @@ static int gpu_shader_rgb(GPUMaterial *mat,
NODE_SHADER_MATERIALX_BEGIN NODE_SHADER_MATERIALX_BEGIN
#ifdef WITH_MATERIALX #ifdef WITH_MATERIALX
{ {
NodeItem color = get_output_default("Color", NodeItem::Type::Color4);
NodeItem res = create_node("constant", NodeItem::Type::Color4); NodeItem res = create_node("constant", NodeItem::Type::Color4);
res.set_input("value", get_output_default("Color", NodeItem::Type::Color4)); res.set_input("value", color);
return res; return res;
} }
#endif #endif

View File

@ -41,8 +41,9 @@ static void sh_node_value_build_multi_function(NodeMultiFunctionBuilder &builder
NODE_SHADER_MATERIALX_BEGIN NODE_SHADER_MATERIALX_BEGIN
#ifdef WITH_MATERIALX #ifdef WITH_MATERIALX
{ {
NodeItem value = get_output_default("Value", NodeItem::Type::Float);
NodeItem res = create_node("constant", NodeItem::Type::Float); NodeItem res = create_node("constant", NodeItem::Type::Float);
res.set_input("value", get_output_default("Value", NodeItem::Type::Float)); res.set_input("value", value);
return res; return res;
} }
#endif #endif