MaterialX: add convert nodes #15

Merged
Bogdan Nagirniak merged 8 commits from matx-add-convert-nodes into matx-export-material 2023-09-08 16:55:00 +02:00
3 changed files with 17 additions and 9 deletions
Showing only changes of commit 33d2cfc8b0 - Show all commits

View File

@ -8,11 +8,15 @@ namespace blender::nodes::materialx {
NodeItem BlackbodyNodeParser::compute() NodeItem BlackbodyNodeParser::compute()
{ {
NodeItem temperature = get_input_value("Temperature", NodeItem::Type::Float); /* This node doesn't have an implementation in MaterialX 1.38.6.
* It's added in MaterialX 1.38.8. Uncomment this code after switching to 1.38.8.
*
* NodeItem temperature = get_input_value("Temperature", NodeItem::Type::Float);
NodeItem res = create_node("blackbody", NodeItem::Type::Color3); * NodeItem res = create_node("blackbody", NodeItem::Type::Color3);
res.set_input("temperature", temperature); * res.set_input("temperature", temperature);
return res; * return res; */
return empty();
} }
} // namespace blender::nodes::materialx } // namespace blender::nodes::materialx

View File

@ -13,11 +13,15 @@ NodeItem ClampNodeParser::compute()
NodeItem min = get_input_value("Min", NodeItem::Type::Float); NodeItem min = get_input_value("Min", NodeItem::Type::Float);
NodeItem max = get_input_value("Max", NodeItem::Type::Float); NodeItem max = get_input_value("Max", NodeItem::Type::Float);
if (type == NODE_CLAMP_MINMAX) { NodeItem res = empty();
min = min.if_else(NodeItem::CompareOp::Greater, max, max, min); if (type == NODE_CLAMP_RANGE) {
res = min.if_else(
NodeItem::CompareOp::Less, max, value.clamp(min, max), value.clamp(max, min));
} }
else {
return value.clamp(min, max); res = value.clamp(min, max);
}
return res;
} }
} // namespace blender::nodes::materialx } // namespace blender::nodes::materialx