forked from blender/blender
Export to MatX various Texture nodes #5
@ -353,14 +353,15 @@ NodeItem NodeParser::get_input_default(const std::string &name)
|
||||
NodeItem res = empty_value();
|
||||
|
||||
const bNodeSocket &socket = node->input_by_identifier(name);
|
||||
/* Explicit check for Detail socket of Noise Texture node since MaterialX expects integer for octaves. */
|
||||
/* Explicit check for Detail socket of Noise Texture node since MaterialX expects integer for
|
||||
* octaves. */
|
||||
if (node->typeinfo->type == SH_NODE_TEX_NOISE && STREQ(socket.name, "Detail")) {
|
||||
int v = socket.default_value_typed<bNodeSocketValueFloat>()->value;
|
||||
res.value = MaterialX::Value::createValue<int>(v);
|
||||
return res;
|
||||
}
|
||||
/* Explicit check for Scale socket of Checker Texture node since MaterialX has scales for X and Y axes
|
||||
* and Blender only single. */
|
||||
/* Explicit check for Scale socket of Checker Texture node since MaterialX has scales for X and Y
|
||||
* axes and Blender only single. */
|
||||
if (node->typeinfo->type == SH_NODE_TEX_CHECKER && STREQ(socket.name, "Scale")) {
|
||||
float v = socket.default_value_typed<bNodeSocketValueFloat>()->value;
|
||||
res.value = MaterialX::Value::createValue<MaterialX::Vector2>({v, v});
|
||||
|
@ -10,10 +10,10 @@
|
||||
#include <MaterialXFormat/XmlIo.h>
|
||||
namespace blender::nodes::materialx {
|
||||
|
||||
/* For some reason validator complains about 'octaves' input of 'fractal3d' node (which doesn't even exist here)
|
||||
* and 'in1' input of 'modulo' node, perhaps implementation is fully correct and similar to standart MaterialX
|
||||
* Checkerboard node (added in 1.38.8). Also seems like USD due to lack of support doesn't render this material,
|
||||
* but MaterialX Viewer and GraphEditor do. */
|
||||
/* For some reason validator complains about 'octaves' input of 'fractal3d' node (which doesn't
|
||||
* even exist here) and 'in1' input of 'modulo' node, perhaps implementation is fully correct and
|
||||
* similar to standart MaterialX Checkerboard node (added in 1.38.8). Also seems like USD due to
|
||||
* lack of support doesn't render this material, but MaterialX Viewer and GraphEditor do. */
|
||||
|
||||
NodeItem TexCheckerNodeParser::compute()
|
||||
{
|
||||
@ -73,14 +73,14 @@ NodeItem TexCheckerNodeParser::compute()
|
||||
ifequal.set_input("in1", MaterialX::Value::createValue<float>(1.0f));
|
||||
ifequal.set_input("in2", MaterialX::Value::createValue<float>(0.0f));
|
||||
|
||||
NodeItem mix = create_node("mix", "color3", true);
|
||||
NodeItem res = create_node("mix", "color3", true);
|
||||
NodeItem color1 = get_input_value("Color1");
|
||||
NodeItem color2 = get_input_value("Color2");
|
||||
mix.set_input("fg", color1.to_color3());
|
||||
mix.set_input("bg", color2.to_color3());
|
||||
mix.set_input("mix", ifequal);
|
||||
res.set_input("fg", color1.to_color3());
|
||||
res.set_input("bg", color2.to_color3());
|
||||
res.set_input("mix", ifequal);
|
||||
|
||||
return mix;
|
||||
return res;
|
||||
}
|
||||
|
||||
} // namespace blender::nodes::materialx
|
||||
|
Loading…
Reference in New Issue
Block a user