forked from blender/blender
Fix linux build #33
@ -69,7 +69,7 @@ NodeItem GroupOutputNodeParser::compute()
|
|||||||
Vector<NodeItem> outputs;
|
Vector<NodeItem> outputs;
|
||||||
for (int i = 0; i < values.size(); ++i) {
|
for (int i = 0; i < values.size(); ++i) {
|
||||||
if (values[i]) {
|
if (values[i]) {
|
||||||
outputs.append(create_output("output" + std::to_string(i + 1), values[i]));
|
outputs.append(create_output(out_name(node_->input_sockets()[i]), values[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return outputs[socket_out_->index()];
|
return outputs[socket_out_->index()];
|
||||||
@ -91,7 +91,7 @@ NodeItem GroupOutputNodeParser::compute_full()
|
|||||||
NodeItem res = empty();
|
NodeItem res = empty();
|
||||||
|
|
||||||
/* Checking if output was already computed */
|
/* Checking if output was already computed */
|
||||||
res.output = graph_->getOutput("output" + std::to_string(socket_out_->index() + 1));
|
res.output = graph_->getOutput(out_name(socket_out_));
|
||||||
if (res.output) {
|
if (res.output) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -103,6 +103,11 @@ NodeItem GroupOutputNodeParser::compute_full()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string GroupOutputNodeParser::out_name(const bNodeSocket *out_socket)
|
||||||
|
{
|
||||||
|
return MaterialX::createValidName(std::string("out_") + out_socket->name);
|
||||||
|
}
|
||||||
|
|
||||||
NodeItem GroupInputNodeParser::compute()
|
NodeItem GroupInputNodeParser::compute()
|
||||||
{
|
{
|
||||||
#ifdef USE_MATERIALX_NODEGRAPH
|
#ifdef USE_MATERIALX_NODEGRAPH
|
||||||
@ -114,7 +119,7 @@ NodeItem GroupInputNodeParser::compute()
|
|||||||
if (value.value) {
|
if (value.value) {
|
||||||
value = group_parser_->create_node("constant", value.type(), {{"value", value}});
|
value = group_parser_->create_node("constant", value.type(), {{"value", value}});
|
||||||
}
|
}
|
||||||
return create_input("input" + std::to_string(socket_out_->index() + 1), value);
|
return create_input(in_name(), value);
|
||||||
#else
|
#else
|
||||||
return group_parser_->get_input_link(socket_out_->index(), to_type_);
|
return group_parser_->get_input_link(socket_out_->index(), to_type_);
|
||||||
BogdanNagirniak marked this conversation as resolved
|
|||||||
#endif
|
#endif
|
||||||
@ -132,8 +137,8 @@ NodeItem GroupInputNodeParser::compute_full()
|
|||||||
#ifdef USE_MATERIALX_NODEGRAPH
|
#ifdef USE_MATERIALX_NODEGRAPH
|
||||||
NodeItem res = empty();
|
NodeItem res = empty();
|
||||||
|
|
||||||
/* Checking if output was already computed */
|
/* Checking if input was already computed */
|
||||||
res.input = graph_->getInput("input" + std::to_string(socket_out_->index() + 1));
|
res.input = graph_->getInput(in_name());
|
||||||
if (res.input) {
|
if (res.input) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -145,4 +150,9 @@ NodeItem GroupInputNodeParser::compute_full()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string GroupInputNodeParser::in_name() const
|
||||||
|
{
|
||||||
|
return MaterialX::createValidName(std::string("in_") + socket_out_->name);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace blender::nodes::materialx
|
} // namespace blender::nodes::materialx
|
||||||
|
@ -29,6 +29,9 @@ class GroupOutputNodeParser : public NodeParser {
|
|||||||
using NodeParser::NodeParser;
|
using NodeParser::NodeParser;
|
||||||
NodeItem compute() override;
|
NodeItem compute() override;
|
||||||
NodeItem compute_full() override;
|
NodeItem compute_full() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static std::string out_name(const bNodeSocket *out_socket);
|
||||||
};
|
};
|
||||||
|
|
||||||
class GroupInputNodeParser : public NodeParser {
|
class GroupInputNodeParser : public NodeParser {
|
||||||
@ -36,6 +39,9 @@ class GroupInputNodeParser : public NodeParser {
|
|||||||
using NodeParser::NodeParser;
|
using NodeParser::NodeParser;
|
||||||
NodeItem compute() override;
|
NodeItem compute() override;
|
||||||
NodeItem compute_full() override;
|
NodeItem compute_full() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string in_name() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace blender::nodes::materialx
|
} // namespace blender::nodes::materialx
|
||||||
|
Loading…
Reference in New Issue
Block a user
get_input_value(...
Otherwise, the input socket's default value is ignored.