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
4 changed files with 10 additions and 14 deletions
Showing only changes of commit 51c2e94a6c - Show all commits

View File

@ -8,15 +8,11 @@ namespace blender::nodes::materialx {
NodeItem BlackbodyNodeParser::compute()
{
/* 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 temperature = get_input_value("Temperature", NodeItem::Type::Float);
* NodeItem res = create_node("blackbody", NodeItem::Type::Color3);
* res.set_input("temperature", temperature);
* return res; */
return empty();
NodeItem res = create_node("blackbody", NodeItem::Type::Color3);
res.set_input("temperature", temperature);
return res;
}
} // namespace blender::nodes::materialx

View File

@ -21,7 +21,7 @@ NodeItem::Type NodeItem::type(const std::string &type_str)
return Type::Filename;
}
if (type_str == "boolean") {
return Type::Bool;
return Type::Boolean;
}
if (type_str == "integer") {
return Type::Integer;
@ -67,7 +67,7 @@ std::string NodeItem::type(Type type)
return "string";
case Type::Filename:
return "filename";
case Type::Bool:
case Type::Boolean:
return "boolean";
case Type::Integer:
return "integer";
@ -638,7 +638,7 @@ void NodeItem::set_input(const std::string &in_name, const NodeItem &item)
case Type::String:
set_input(in_name, item.value->asA<std::string>(), item_type);
break;
case Type::Bool:
case Type::Boolean:
set_input(in_name, item.value->asA<bool>(), item_type);
break;
case Type::Integer:

View File

@ -17,7 +17,7 @@ class NodeItem {
/* Value types */
String,
Filename,
Bool,
Boolean,
Integer,
/* Block of arithmetic types. Ordered by type cast */
Float,

View File

@ -8,9 +8,9 @@ namespace blender::nodes::materialx {
NodeItem RGBToBWNodeParser::compute()
{
NodeItem color = get_input_value("Color", NodeItem::Type::Color3);
NodeItem color = get_input_value("Color", NodeItem::Type::Color4);
NodeItem res = create_node("luminance", NodeItem::Type::Color3);
NodeItem res = create_node("luminance", NodeItem::Type::Color4);
res.set_input("in", color);
return res;
}