39 const std::string res_node_name =
node_name();
51 res.
node->setName(res_node_name);
63 const StringRef socket_out_name = (override_output_name) ? override_output_name :
93 return get_default(
node_->input_by_identifier(name),
to_type);
123 return get_default(
node_->output_by_identifier(name),
to_type);
128 return get_default(
node_->output_socket(index),
to_type);
133 return graph_.empty_node();
147 const bool is_active_uvmap = attribute_name ==
"" ||
148 attribute_name ==
graph_.export_params.original_active_uvmap_name;
149 if (
graph_.export_params.new_active_uvmap_name ==
"st" && is_active_uvmap) {
153 const std::string &geomprop = (is_active_uvmap) ?
154 graph_.export_params.new_active_uvmap_name :
156 res =
create_node(
"geompropvalue", type, {{
"geomprop",
val(geomprop)}});
158 res.
node->setName(name);
170 switch (socket.
type) {
176 res.
value = MaterialX::Value::createValue<float>(
v);
181 res.
value = MaterialX::Value::createValue<MaterialX::Vector3>(
182 MaterialX::Vector3(
v[0],
v[1],
v[2]));
187 res.
value = MaterialX::Value::createValue<MaterialX::Color4>(
188 MaterialX::Color4(
v[0],
v[1],
v[2],
v[3]));
200 bool use_group_default)
203 if (!(link && link->is_used())) {
210 while (from_node->is_reroute()) {
211 link = from_node->input_socket(0).link;
212 if (!(link && link->is_used())) {
218 if (from_node->is_group()) {
219 return GroupNodeParser(
223 if (from_node->is_group_input()) {
224 return GroupInputNodeParser(
229 if (!from_node->
typeinfo->materialx_fn) {
231 "Unsupported node: %s [%d]",
246 res = get_default(socket,
to_type);
#define CLOG_WARN(clg_ref,...)
#define CLG_LOGREF_DECLARE_GLOBAL(var, id)
#define CLOG_INFO(clg_ref, level,...)
struct bNodeLink bNodeLink
struct bNodeSocket bNodeSocket
BMesh const char void * data
ATTR_WARN_UNUSED_RESULT const BMVert * v
NodeItem create_input(const std::string &name, const NodeItem &item) const
static bool is_arithmetic(Type type)
MaterialX::ValuePtr value
NodeItem convert(Type to_type) const
NodeItem create_output(const std::string &name, const NodeItem &item) const
static bool is_convertible(eNodeSocketDatatype from_type, Type to_type)
static Type type(const std::string &type_str)
std::vector< std::pair< std::string, NodeItem > > Inputs
NodeItem create_node(const std::string &category, Type type) const
GroupNodeParser * group_parser_
NodeItem get_input_value(const std::string &name, NodeItem::Type to_type)
virtual NodeItem compute()=0
virtual NodeItem compute_full()
const bNodeSocket * socket_out_
std::string node_name(const char *override_output_name=nullptr) const
NodeParser(NodeGraph &graph, const bNode *node, const bNodeSocket *socket_out, NodeItem::Type to_type, GroupNodeParser *group_parser)
NodeItem create_input(const std::string &name, const NodeItem &item)
NodeItem get_input_link(const std::string &name, NodeItem::Type to_type)
NodeItem texcoord_node(NodeItem::Type type=NodeItem::Type::Vector2, const std::string &attribute_name="")
NodeItem get_input_default(const std::string &name, NodeItem::Type to_type)
NodeItem get_output_default(const std::string &name, NodeItem::Type to_type)
NodeItem create_node(const std::string &category, NodeItem::Type type)
NodeItem create_output(const std::string &name, const NodeItem &item)
NodeItem val(const T &data) const
static Type to_type(const eGPUType type)
struct CLG_LogRef * LOG_MATERIALX_SHADER
constexpr StringRef TEXCOORD_NODE_NAME
static blender::bke::bNodeSocketTemplate inputs[]
bNodeTypeHandle * typeinfo
NodeItem get_node(StringRef name) const