MaterialX: Fix group nodes. #32

Merged
Bogdan Nagirniak merged 3 commits from Vasyl-Pidhirskyi/blender:fix_group_nodes into matx-export-material 2023-09-22 18:37:41 +02:00

View File

@ -3,6 +3,7 @@
* SPDX-License-Identifier: GPL-2.0-or-later */ * SPDX-License-Identifier: GPL-2.0-or-later */
#include "group_nodes.h" #include "group_nodes.h"
#include "node_item.h"
#include "node_parser.h" #include "node_parser.h"
#include "BLI_vector.hh" #include "BLI_vector.hh"
@ -37,7 +38,7 @@ NodeItem GroupNodeParser::compute()
material_, material_,
node_out, node_out,
socket_out_, socket_out_,
NodeItem::Type::Any, to_type_,
this, this,
export_image_fn_) export_image_fn_)
.compute_full(); .compute_full();
@ -79,7 +80,10 @@ NodeItem GroupOutputNodeParser::compute()
} }
return outputs[socket_out_->index()]; return outputs[socket_out_->index()];
#else #else
return get_input_value(socket_out_->index(), NodeItem::Type::Any); if (NodeItem::is_arithmetic(to_type_)) {
return get_input_value(socket_out_->index(), to_type_);
}
return get_input_link(socket_out_->index(), to_type_);
#endif #endif
} }
@ -121,6 +125,9 @@ NodeItem GroupInputNodeParser::compute()
} }
return create_input("input" + std::to_string(socket_out_->index() + 1), value); return create_input("input" + std::to_string(socket_out_->index() + 1), value);
#else #else
if (NodeItem::is_arithmetic(to_type_)) {
return group_parser_->get_input_value(socket_out_->index(), to_type_);
}
return group_parser_->get_input_link(socket_out_->index(), to_type_); return group_parser_->get_input_link(socket_out_->index(), to_type_);
#endif #endif
} }