forked from blender/blender
MaterialX: Implement export of Input nodes #20
@ -34,7 +34,7 @@ NodeItem NodeParser::compute_full()
|
|||||||
/* Checking if node was already computed */
|
/* Checking if node was already computed */
|
||||||
res.node = graph_->getNode(node_name());
|
res.node = graph_->getNode(node_name());
|
||||||
if (res.node) {
|
if (res.node) {
|
||||||
return res;
|
return res.convert(to_type_);
|
||||||
}
|
}
|
||||||
|
|
||||||
CLOG_INFO(LOG_MATERIALX_SHADER,
|
CLOG_INFO(LOG_MATERIALX_SHADER,
|
||||||
@ -101,6 +101,16 @@ NodeItem NodeParser::get_input_value(int index, NodeItem::Type to_type)
|
|||||||
return get_input_value(node_->input_socket(index), to_type);
|
return get_input_value(node_->input_socket(index), to_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NodeItem NodeParser::get_output_default(const std::string &name)
|
||||||
|
{
|
||||||
|
return get_output_default(node_->output_by_identifier(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
NodeItem NodeParser::get_output_default(int index)
|
||||||
|
{
|
||||||
|
return get_output_default(node_->output_socket(index));
|
||||||
|
}
|
||||||
|
|
||||||
NodeItem NodeParser::empty() const
|
NodeItem NodeParser::empty() const
|
||||||
{
|
{
|
||||||
return NodeItem(graph_);
|
return NodeItem(graph_);
|
||||||
@ -118,6 +128,17 @@ NodeItem NodeParser::texcoord_node()
|
|||||||
}
|
}
|
||||||
|
|
||||||
NodeItem NodeParser::get_input_default(const bNodeSocket &socket, NodeItem::Type to_type)
|
NodeItem NodeParser::get_input_default(const bNodeSocket &socket, NodeItem::Type to_type)
|
||||||
|
{
|
||||||
|
NodeItem res = get_value_default(socket);
|
||||||
|
return res.convert(to_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
NodeItem NodeParser::get_output_default(const bNodeSocket &socket)
|
||||||
|
{
|
||||||
|
return get_value_default(socket);
|
||||||
|
}
|
||||||
|
|
||||||
|
NodeItem NodeParser::get_value_default(const bNodeSocket &socket)
|
||||||
{
|
{
|
||||||
NodeItem res = empty();
|
NodeItem res = empty();
|
||||||
switch (socket.type) {
|
switch (socket.type) {
|
||||||
@ -142,7 +163,7 @@ NodeItem NodeParser::get_input_default(const bNodeSocket &socket, NodeItem::Type
|
|||||||
CLOG_WARN(LOG_MATERIALX_SHADER, "Unsupported socket type: %d", socket.type);
|
CLOG_WARN(LOG_MATERIALX_SHADER, "Unsupported socket type: %d", socket.type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res.convert(to_type);
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeItem NodeParser::get_input_link(const bNodeSocket &socket, NodeItem::Type to_type)
|
NodeItem NodeParser::get_input_link(const bNodeSocket &socket, NodeItem::Type to_type)
|
||||||
|
@ -42,6 +42,8 @@ class NodeParser {
|
|||||||
NodeItem create_node(const std::string &category, NodeItem::Type type);
|
NodeItem create_node(const std::string &category, NodeItem::Type type);
|
||||||
NodeItem get_input_default(const std::string &name, NodeItem::Type to_type);
|
NodeItem get_input_default(const std::string &name, NodeItem::Type to_type);
|
||||||
NodeItem get_input_default(int index, NodeItem::Type to_type);
|
NodeItem get_input_default(int index, NodeItem::Type to_type);
|
||||||
|
NodeItem get_output_default(const std::string &name);
|
||||||
|
NodeItem get_output_default(int index);
|
||||||
NodeItem get_input_link(const std::string &name, NodeItem::Type to_type);
|
NodeItem get_input_link(const std::string &name, NodeItem::Type to_type);
|
||||||
NodeItem get_input_link(int index, NodeItem::Type to_type);
|
NodeItem get_input_link(int index, NodeItem::Type to_type);
|
||||||
NodeItem get_input_value(const std::string &name, NodeItem::Type to_type);
|
NodeItem get_input_value(const std::string &name, NodeItem::Type to_type);
|
||||||
@ -52,6 +54,8 @@ class NodeParser {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
NodeItem get_input_default(const bNodeSocket &socket, NodeItem::Type to_type);
|
NodeItem get_input_default(const bNodeSocket &socket, NodeItem::Type to_type);
|
||||||
|
NodeItem get_output_default(const bNodeSocket &socket);
|
||||||
|
NodeItem get_value_default(const bNodeSocket &socket);
|
||||||
NodeItem get_input_link(const bNodeSocket &socket, NodeItem::Type to_type);
|
NodeItem get_input_link(const bNodeSocket &socket, NodeItem::Type to_type);
|
||||||
NodeItem get_input_value(const bNodeSocket &socket, NodeItem::Type to_type);
|
NodeItem get_input_value(const bNodeSocket &socket, NodeItem::Type to_type);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user