forked from blender/blender
Fix linux build #33
@ -3,7 +3,6 @@
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "group_nodes.h"
|
||||
#include "node_item.h"
|
||||
#include "node_parser.h"
|
||||
|
||||
#include "BLI_vector.hh"
|
||||
@ -33,14 +32,8 @@ NodeItem GroupNodeParser::compute()
|
||||
#endif
|
||||
|
||||
NodeItem out =
|
||||
GroupOutputNodeParser(graph,
|
||||
depsgraph_,
|
||||
material_,
|
||||
node_out,
|
||||
socket_out_,
|
||||
to_type_,
|
||||
this,
|
||||
export_image_fn_)
|
||||
GroupOutputNodeParser(
|
||||
graph, depsgraph_, material_, node_out, socket_out_, to_type_, this, export_image_fn_)
|
||||
.compute_full();
|
||||
|
||||
#ifdef USE_MATERIALX_NODEGRAPH
|
||||
@ -66,7 +59,8 @@ NodeItem GroupOutputNodeParser::compute()
|
||||
#ifdef USE_MATERIALX_NODEGRAPH
|
||||
Vector<NodeItem> values;
|
||||
for (auto socket_in : node_->input_sockets()) {
|
||||
NodeItem value = get_input_value(socket_in->index(), NodeItem::Type::Any);
|
||||
NodeItem value = get_input_value(
|
||||
socket_in->index(), NodeItem::is_arithmetic(to_type_) ? NodeItem::Type::Any : to_type_);
|
||||
if (value.value) {
|
||||
value = create_node("constant", value.type(), {{"value", value}});
|
||||
}
|
||||
@ -80,15 +74,19 @@ NodeItem GroupOutputNodeParser::compute()
|
||||
}
|
||||
return outputs[socket_out_->index()];
|
||||
#else
|
||||
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
|
||||
}
|
||||
|
||||
NodeItem GroupOutputNodeParser::compute_full()
|
||||
{
|
||||
CLOG_INFO(LOG_MATERIALX_SHADER,
|
||||
1,
|
||||
"%s [%d] => %s",
|
||||
node_->name,
|
||||
node_->typeinfo->type,
|
||||
NodeItem::type(to_type_).c_str());
|
||||
|
||||
#ifdef USE_MATERIALX_NODEGRAPH
|
||||
NodeItem res = empty();
|
||||
|
||||
@ -98,13 +96,6 @@ NodeItem GroupOutputNodeParser::compute_full()
|
||||
return res;
|
||||
}
|
||||
|
||||
CLOG_INFO(LOG_MATERIALX_SHADER,
|
||||
1,
|
||||
"%s [%d] => %s",
|
||||
node_->name,
|
||||
node_->typeinfo->type,
|
||||
NodeItem::type(to_type_).c_str());
|
||||
|
||||
res = compute();
|
||||
return res;
|
||||
#else
|
||||
@ -121,19 +112,23 @@ NodeItem GroupInputNodeParser::compute()
|
||||
}
|
||||
|
||||
if (value.value) {
|
||||
value = 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);
|
||||
#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
|
||||
}
|
||||
|
||||
NodeItem GroupInputNodeParser::compute_full()
|
||||
{
|
||||
BogdanNagirniak marked this conversation as resolved
|
||||
CLOG_INFO(LOG_MATERIALX_SHADER,
|
||||
1,
|
||||
"%s [%d] => %s",
|
||||
node_->name,
|
||||
node_->typeinfo->type,
|
||||
NodeItem::type(to_type_).c_str());
|
||||
|
||||
#ifdef USE_MATERIALX_NODEGRAPH
|
||||
NodeItem res = empty();
|
||||
|
||||
@ -143,13 +138,6 @@ NodeItem GroupInputNodeParser::compute_full()
|
||||
return res;
|
||||
}
|
||||
|
||||
CLOG_INFO(LOG_MATERIALX_SHADER,
|
||||
1,
|
||||
"%s [%d] => %s",
|
||||
node_->name,
|
||||
node_->typeinfo->type,
|
||||
NodeItem::type(to_type_).c_str());
|
||||
|
||||
res = compute();
|
||||
return res;
|
||||
#else
|
||||
|
@ -167,6 +167,10 @@ NodeItem NodeParser::texcoord_node(NodeItem::Type type)
|
||||
NodeItem NodeParser::get_default(const bNodeSocket &socket, NodeItem::Type to_type)
|
||||
{
|
||||
NodeItem res = empty();
|
||||
if (!NodeItem::is_arithmetic(to_type) && to_type != NodeItem::Type::Any) {
|
||||
return res;
|
||||
}
|
||||
|
||||
switch (socket.type) {
|
||||
case SOCK_CUSTOM:
|
||||
/* Return empty */
|
||||
|
Loading…
Reference in New Issue
Block a user
get_input_value(...
Otherwise, the input socket's default value is ignored.