forked from blender/blender
Fix linux build #33
@ -31,10 +31,16 @@ NodeItem GroupNodeParser::compute()
|
|||||||
graph = group_graph.get();
|
graph = group_graph.get();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NodeItem out =
|
NodeItem out = GroupOutputNodeParser(graph,
|
||||||
GroupOutputNodeParser(
|
depsgraph_,
|
||||||
graph, depsgraph_, material_, node_out, socket_out_, to_type_, this, export_image_fn_)
|
material_,
|
||||||
.compute_full();
|
node_out,
|
||||||
|
socket_out_,
|
||||||
|
to_type_,
|
||||||
|
this,
|
||||||
|
use_group_default_,
|
||||||
|
export_image_fn_)
|
||||||
|
.compute_full();
|
||||||
|
|
||||||
#ifdef USE_MATERIALX_NODEGRAPH
|
#ifdef USE_MATERIALX_NODEGRAPH
|
||||||
/* We have to be in NodeParser's graph_, therefore copying output */
|
/* We have to be in NodeParser's graph_, therefore copying output */
|
||||||
@ -121,6 +127,9 @@ NodeItem GroupInputNodeParser::compute()
|
|||||||
}
|
}
|
||||||
return create_input(in_name(), value);
|
return create_input(in_name(), value);
|
||||||
#else
|
#else
|
||||||
|
if (use_group_default_) {
|
||||||
|
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
|
||||||
}
|
}
|
||||||
|
@ -71,6 +71,7 @@ MaterialX::DocumentPtr export_to_materialx(Depsgraph *depsgraph,
|
|||||||
NodeItem::Type::Material,
|
NodeItem::Type::Material,
|
||||||
nullptr,
|
nullptr,
|
||||||
NodeItem(doc.get()),
|
NodeItem(doc.get()),
|
||||||
|
false,
|
||||||
export_image_fn};
|
export_image_fn};
|
||||||
output_node->typeinfo->materialx_fn(&data, output_node, nullptr);
|
output_node->typeinfo->materialx_fn(&data, output_node, nullptr);
|
||||||
}
|
}
|
||||||
@ -82,6 +83,7 @@ MaterialX::DocumentPtr export_to_materialx(Depsgraph *depsgraph,
|
|||||||
nullptr,
|
nullptr,
|
||||||
NodeItem::Type::Material,
|
NodeItem::Type::Material,
|
||||||
nullptr,
|
nullptr,
|
||||||
|
false,
|
||||||
export_image_fn)
|
export_image_fn)
|
||||||
.compute_error();
|
.compute_error();
|
||||||
}
|
}
|
||||||
@ -94,6 +96,7 @@ MaterialX::DocumentPtr export_to_materialx(Depsgraph *depsgraph,
|
|||||||
nullptr,
|
nullptr,
|
||||||
NodeItem::Type::Material,
|
NodeItem::Type::Material,
|
||||||
nullptr,
|
nullptr,
|
||||||
|
false,
|
||||||
export_image_fn)
|
export_image_fn)
|
||||||
.compute();
|
.compute();
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ NodeParser::NodeParser(MaterialX::GraphElement *graph,
|
|||||||
const bNodeSocket *socket_out,
|
const bNodeSocket *socket_out,
|
||||||
NodeItem::Type to_type,
|
NodeItem::Type to_type,
|
||||||
GroupNodeParser *group_parser,
|
GroupNodeParser *group_parser,
|
||||||
|
bool use_group_default,
|
||||||
ExportImageFunction export_image_fn)
|
ExportImageFunction export_image_fn)
|
||||||
: graph_(graph),
|
: graph_(graph),
|
||||||
depsgraph_(depsgraph),
|
depsgraph_(depsgraph),
|
||||||
@ -29,6 +30,7 @@ NodeParser::NodeParser(MaterialX::GraphElement *graph,
|
|||||||
socket_out_(socket_out),
|
socket_out_(socket_out),
|
||||||
to_type_(to_type),
|
to_type_(to_type),
|
||||||
group_parser_(group_parser),
|
group_parser_(group_parser),
|
||||||
|
use_group_default_(use_group_default),
|
||||||
export_image_fn_(export_image_fn)
|
export_image_fn_(export_image_fn)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -199,7 +201,9 @@ NodeItem NodeParser::get_default(const bNodeSocket &socket, NodeItem::Type to_ty
|
|||||||
return res.convert(to_type);
|
return res.convert(to_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeItem NodeParser::get_input_link(const bNodeSocket &socket, NodeItem::Type to_type)
|
NodeItem NodeParser::get_input_link(const bNodeSocket &socket,
|
||||||
|
NodeItem::Type to_type,
|
||||||
|
bool use_group_default)
|
||||||
{
|
{
|
||||||
const bNodeLink *link = socket.link;
|
const bNodeLink *link = socket.link;
|
||||||
if (!(link && link->is_used())) {
|
if (!(link && link->is_used())) {
|
||||||
@ -225,6 +229,7 @@ NodeItem NodeParser::get_input_link(const bNodeSocket &socket, NodeItem::Type to
|
|||||||
link->fromsock,
|
link->fromsock,
|
||||||
to_type,
|
to_type,
|
||||||
group_parser_,
|
group_parser_,
|
||||||
|
use_group_default,
|
||||||
export_image_fn_)
|
export_image_fn_)
|
||||||
.compute_full();
|
.compute_full();
|
||||||
}
|
}
|
||||||
@ -236,6 +241,7 @@ NodeItem NodeParser::get_input_link(const bNodeSocket &socket, NodeItem::Type to
|
|||||||
link->fromsock,
|
link->fromsock,
|
||||||
to_type,
|
to_type,
|
||||||
group_parser_,
|
group_parser_,
|
||||||
|
use_group_default,
|
||||||
export_image_fn_)
|
export_image_fn_)
|
||||||
.compute_full();
|
.compute_full();
|
||||||
}
|
}
|
||||||
@ -248,15 +254,21 @@ NodeItem NodeParser::get_input_link(const bNodeSocket &socket, NodeItem::Type to
|
|||||||
return empty();
|
return empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeParserData data = {
|
NodeParserData data = {graph_,
|
||||||
graph_, depsgraph_, material_, to_type, group_parser_, empty(), export_image_fn_};
|
depsgraph_,
|
||||||
|
material_,
|
||||||
|
to_type,
|
||||||
|
group_parser_,
|
||||||
|
empty(),
|
||||||
|
use_group_default,
|
||||||
|
export_image_fn_};
|
||||||
from_node->typeinfo->materialx_fn(&data, const_cast<bNode *>(from_node), link->fromsock);
|
from_node->typeinfo->materialx_fn(&data, const_cast<bNode *>(from_node), link->fromsock);
|
||||||
return data.result;
|
return data.result;
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeItem NodeParser::get_input_value(const bNodeSocket &socket, NodeItem::Type to_type)
|
NodeItem NodeParser::get_input_value(const bNodeSocket &socket, NodeItem::Type to_type)
|
||||||
{
|
{
|
||||||
NodeItem res = get_input_link(socket, to_type);
|
NodeItem res = get_input_link(socket, to_type, true);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
res = get_default(socket, to_type);
|
res = get_default(socket, to_type);
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ class NodeParser {
|
|||||||
const bNodeSocket *socket_out_;
|
const bNodeSocket *socket_out_;
|
||||||
NodeItem::Type to_type_;
|
NodeItem::Type to_type_;
|
||||||
GroupNodeParser *group_parser_;
|
GroupNodeParser *group_parser_;
|
||||||
|
bool use_group_default_;
|
||||||
ExportImageFunction export_image_fn_;
|
ExportImageFunction export_image_fn_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -43,6 +44,7 @@ class NodeParser {
|
|||||||
const bNodeSocket *socket_out,
|
const bNodeSocket *socket_out,
|
||||||
NodeItem::Type to_type,
|
NodeItem::Type to_type,
|
||||||
GroupNodeParser *group_parser,
|
GroupNodeParser *group_parser,
|
||||||
|
bool use_group_default,
|
||||||
ExportImageFunction export_image_fn);
|
ExportImageFunction export_image_fn);
|
||||||
virtual ~NodeParser() = default;
|
virtual ~NodeParser() = default;
|
||||||
|
|
||||||
@ -71,7 +73,9 @@ class NodeParser {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
NodeItem get_default(const bNodeSocket &socket, NodeItem::Type to_type);
|
NodeItem get_default(const bNodeSocket &socket, NodeItem::Type to_type);
|
||||||
NodeItem get_input_link(const bNodeSocket &socket, NodeItem::Type to_type);
|
NodeItem get_input_link(const bNodeSocket &socket,
|
||||||
|
NodeItem::Type to_type,
|
||||||
|
bool use_group_default = false);
|
||||||
NodeItem get_input_value(const bNodeSocket &socket, NodeItem::Type to_type);
|
NodeItem get_input_value(const bNodeSocket &socket, NodeItem::Type to_type);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -103,6 +107,7 @@ struct NodeParserData {
|
|||||||
NodeItem::Type to_type;
|
NodeItem::Type to_type;
|
||||||
GroupNodeParser *group_parser;
|
GroupNodeParser *group_parser;
|
||||||
NodeItem result;
|
NodeItem result;
|
||||||
|
bool use_group_default;
|
||||||
ExportImageFunction export_image_fn;
|
ExportImageFunction export_image_fn;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -130,6 +135,7 @@ struct NodeParserData {
|
|||||||
out, \
|
out, \
|
||||||
d->to_type, \
|
d->to_type, \
|
||||||
d->group_parser, \
|
d->group_parser, \
|
||||||
|
d->use_group_default, \
|
||||||
d->export_image_fn) \
|
d->export_image_fn) \
|
||||||
.compute_full(); \
|
.compute_full(); \
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user