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() NodeItem BlackbodyNodeParser::compute()
{ {
/* This node doesn't have an implementation in MaterialX 1.38.6. NodeItem temperature = get_input_value("Temperature", NodeItem::Type::Float);
* 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

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

View File

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

View File

@ -8,9 +8,9 @@ namespace blender::nodes::materialx {
NodeItem RGBToBWNodeParser::compute() 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); res.set_input("in", color);
return res; return res;
} }