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

View File

@ -3,6 +3,7 @@
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "group_nodes.h"
#include "node_item.h"
#include "node_parser.h"
#include "BLI_vector.hh"
@ -31,10 +32,9 @@ NodeItem GroupNodeParser::compute()
graph = group_graph.get();
#endif
NodeItem out =
GroupOutputNodeParser(
graph, depsgraph_, material_, node_out, socket_out_, NodeItem::Type::Any, this)
.compute_full();
NodeItem out = GroupOutputNodeParser(
graph, depsgraph_, material_, node_out, socket_out_, to_type_, this)
.compute_full();
#ifdef USE_MATERIALX_NODEGRAPH
/* We have to be in NodeParser's graph_, therefore copying output */
@ -73,7 +73,10 @@ NodeItem GroupOutputNodeParser::compute()
}
return outputs[socket_out_->index()];
#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
}
@ -115,6 +118,9 @@ NodeItem GroupInputNodeParser::compute()
}
return create_input("input" + std::to_string(socket_out_->index() + 1), value);
#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_);
#endif
}