39 const std::string res_node_name =
node_name();
50 res.
node->setName(res_node_name);
62 const StringRef socket_out_name = (override_output_name) ? override_output_name :
127 return get_default(
node_->output_socket(index),
to_type);
132 return graph_.empty_node();
146 const bool is_active_uvmap = attribute_name ==
"" ||
147 attribute_name ==
graph_.export_params.original_active_uvmap_name;
148 if (
graph_.export_params.new_active_uvmap_name ==
"st" && is_active_uvmap) {
152 const std::string &geomprop = (is_active_uvmap) ?
153 graph_.export_params.new_active_uvmap_name :
155 res =
create_node(
"geompropvalue", type, {{
"geomprop",
val(geomprop)}});
169 switch (socket.
type) {
175 res.
value = MaterialX::Value::createValue<float>(
v);
180 res.
value = MaterialX::Value::createValue<MaterialX::Vector3>(
181 MaterialX::Vector3(
v[0],
v[1],
v[2]));
186 res.
value = MaterialX::Value::createValue<MaterialX::Color4>(
187 MaterialX::Color4(
v[0],
v[1],
v[2],
v[3]));
199 bool use_group_default)
202 if (!(link && link->is_used())) {
209 while (from_node->is_reroute()) {
210 link = from_node->input_socket(0).link;
211 if (!(link && link->is_used())) {
217 if (from_node->is_group()) {
218 return GroupNodeParser(
222 if (from_node->is_group_input()) {
223 return GroupInputNodeParser(
228 if (!from_node->
typeinfo->materialx_fn) {
230 "Unsupported node: %s [%d]",
245 res = get_default(socket,
to_type);
#define CLOG_DEBUG(clg_ref,...)
#define CLOG_WARN(clg_ref,...)
#define CLG_LOGREF_DECLARE_GLOBAL(var, id)
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 GPUType type)
constexpr StringRef TEXCOORD_NODE_NAME
struct CLG_LogRef * LOG_IO_MATERIALX
static blender::bke::bNodeSocketTemplate inputs[]
bNodeTypeHandle * typeinfo
NodeItem get_node(StringRef name) const