24 socket_out_(socket_out),
26 group_parser_(group_parser)
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 :
128 return get_default(
node_->output_socket(index),
to_type);
147 const bool is_active_uvmap = attribute_name ==
"" ||
153 const std::string &geomprop = (is_active_uvmap) ?
156 res =
create_node(
"geompropvalue", type, {{
"geomprop",
val(geomprop)}});
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,...)
ATTR_WARN_UNUSED_RESULT const BMVert * v
NodeItem create_input(const std::string &name, const NodeItem &item) const
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)
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
std::string new_active_uvmap_name
std::string original_active_uvmap_name
NodeItem get_node(StringRef name) const
std::string unique_node_name(const bNode *node, StringRef socket_out_name, NodeItem::Type to_type)
const ExportParams & export_params
NodeItem empty_node() const