Support group nodes #22

Merged
Bogdan Nagirniak merged 18 commits from BogdanNagirniak/blender:matx-group-nodes into matx-export-material 2023-09-18 12:49:19 +02:00
Showing only changes of commit 90b89b4d10 - Show all commits

View File

@ -609,8 +609,8 @@ NodeItem NodeItem::if_else(CompareOp op,
NodeItem NodeItem::extract(const int index) const NodeItem NodeItem::extract(const int index) const
{ {
NodeItem res = empty(); /* TODO: Add check if (value) { ... } */
res = create_node("extract", Type::Float); NodeItem res = create_node("extract", Type::Float);
res.set_input("in", *this); res.set_input("in", *this);
res.set_input("index", val(index)); res.set_input("index", val(index));
return res; return res;
@ -817,7 +817,7 @@ NodeItem NodeItem::arithmetic(const std::string &category, std::function<float(f
if (ELEM(type, Type::Color3, Type::Color4) && if (ELEM(type, Type::Color3, Type::Color4) &&
ELEM(category, "sin", "cos", "tan", "asin", "acos", "atan2", "sqrt", "ln", "exp")) ELEM(category, "sin", "cos", "tan", "asin", "acos", "atan2", "sqrt", "ln", "exp"))
{ {
/* Such fucntions doesn't have implementation in MaterialX, converting to Vector types */ /* These functions haven't implementation in MaterialX, converting to Vector types */
type = type == Type::Color3 ? Type::Vector3 : Type::Vector4; type = type == Type::Color3 ? Type::Vector3 : Type::Vector4;
v = v.convert(type); v = v.convert(type);
} }