Code improvements + Mix node #30

Merged
Bogdan Nagirniak merged 18 commits from BogdanNagirniak/blender:matx-code-improvements into matx-export-material 2023-09-22 18:23:13 +02:00
3 changed files with 9 additions and 8 deletions
Showing only changes of commit aaa31cdd9d - Show all commits

View File

@ -291,31 +291,31 @@ NodeItem NodeItem::dotproduct(const NodeItem &other) const
float f = 0.0f;
switch (d.type()) {
case Type::Float: {
f = value->asA<float>();
f = d.value->asA<float>();
break;
}
case Type::Vector2: {
auto v = value->asA<MaterialX::Vector2>();
auto v = d.value->asA<MaterialX::Vector2>();
f = v[0] + v[1];
break;
}
case Type::Vector3: {
auto v = value->asA<MaterialX::Vector3>();
auto v = d.value->asA<MaterialX::Vector3>();
f = v[0] + v[1] + v[2];
break;
}
case Type::Vector4: {
auto v = value->asA<MaterialX::Vector4>();
auto v = d.value->asA<MaterialX::Vector4>();
f = v[0] + v[1] + v[2] + v[3];
break;
}
case Type::Color3: {
auto v = value->asA<MaterialX::Color3>();
auto v = d.value->asA<MaterialX::Color3>();
f = v[0] + v[1] + v[2];
break;
}
case Type::Color4: {
auto v = value->asA<MaterialX::Color4>();
auto v = d.value->asA<MaterialX::Color4>();
f = v[0] + v[1] + v[2] + v[3];
break;
}

View File

@ -20,7 +20,7 @@ class GroupNodeParser;
/**
* This is base abstraction class for parsing Blender nodes into MaterialX nodes.
* NodeParser::compute() should be overrides in child classes.
* NodeParser::compute() should be overrided in child classes.
*/
class NodeParser {
protected:

View File

@ -219,7 +219,8 @@ NODE_SHADER_MATERIALX_BEGIN
bool invert = node_->custom2;
NodeItem vector = get_input_value("Vector", NodeItem::Type::Vector3);
NodeItem center = get_input_value("Center", NodeItem::Type::Vector3);
NodeItem center = get_input_value("Center", NodeItem::Type::Vector3) *
val(MaterialX::Vector3(1.0f, 1.0f, -1.0f));
vector = vector - center;
if (mode == NODE_VECTOR_ROTATE_TYPE_EULER_XYZ) {