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 :
146 const bool is_active_uvmap = attribute_name ==
"" ||
152 const std::string &geomprop = (is_active_uvmap) ?
155 res =
create_node(
"geompropvalue", type, {{
"geomprop",
val(geomprop)}});
157 res.
node->setName(name);
169 switch (socket.
type) {
175 res.
value = MaterialX::Value::createValue<bool>(
v);
180 res.
value = MaterialX::Value::createValue<int>(
v);
184 float v = socket.default_value_typed<bNodeSocketValueFloat>()->value;
185 res.
value = MaterialX::Value::createValue<float>(
v);
189 const float *
v = socket.default_value_typed<bNodeSocketValueVector>()->value;
190 res.
value = MaterialX::Value::createValue<MaterialX::Vector3>(
191 MaterialX::Vector3(
v[0],
v[1],
v[2]));
195 const float *
v = socket.default_value_typed<bNodeSocketValueRGBA>()->value;
196 res.
value = MaterialX::Value::createValue<MaterialX::Color4>(
197 MaterialX::Color4(
v[0],
v[1],
v[2],
v[3]));
209 bool use_group_default)
211 const bNodeLink *link = socket.link;
212 if (!(link && link->is_used())) {
216 const bNode *from_node = link->fromnode;
219 while (from_node->is_reroute()) {
220 link = from_node->input_socket(0).link;
221 if (!(link && link->is_used())) {
224 from_node = link->fromnode;
227 if (from_node->is_group()) {
232 if (from_node->is_group_input()) {
233 return GroupInputNodeParser(
238 if (!from_node->typeinfo->materialx_fn) {
240 "Unsupported node: %s [%d]",
242 from_node->typeinfo->type_legacy);
247 from_node->typeinfo->materialx_fn(&
data,
const_cast<bNode *
>(from_node), link->fromsock);
255 res = get_default(socket,
to_type);
#define CLOG_DEBUG(clg_ref,...)
#define CLOG_WARN(clg_ref,...)
GroupNodeParser(NodeGraph &graph, const bNode *node, const bNodeSocket *socket_out, NodeItem::Type to_type, GroupNodeParser *group_parser, bool use_group_default)
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_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
CLG_LOGREF_DECLARE_GLOBAL(LOG_IO_MATERIALX, "io.materialx")
constexpr StringRef TEXCOORD_NODE_NAME
CLG_LogRef * LOG_IO_MATERIALX
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
ATTR_WARN_UNUSED_RESULT const BMVert * v
BMesh const char void * data
bke::bNodeType * 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