matx-extend-create_node #25

Merged
Bogdan Nagirniak merged 4 commits from BogdanNagirniak/blender:matx-extend-create_node into matx-export-material 2023-09-19 18:28:04 +02:00
29 changed files with 159 additions and 217 deletions
Showing only changes of commit 722c08a810 - Show all commits

View File

@ -3,6 +3,7 @@
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "node_item.h"
#include "node_parser.h"
#include "BLI_assert.h"
#include "BLI_utildefines.h"
@ -120,9 +121,7 @@ NodeItem NodeItem::operator+(const NodeItem &other) const
/* Special case: add BSDF/EDF shaders */
NodeItem res = empty();
if (other.type() == type) {
res = create_node("add", type);
res.set_input("in1", *this);
res.set_input("in2", other);
res = create_node("add", type, {{"in1", *this}, {"in2", other}});
}
else {
BLI_assert_unreachable();
@ -151,9 +150,7 @@ NodeItem NodeItem::operator*(const NodeItem &other) const
NodeItem res = empty();
Type other_type = other.type();
if (ELEM(other_type, Type::Float, Type::Color3)) {
res = create_node("multiply", type);
res.set_input("in1", *this);
res.set_input("in2", other);
res = create_node("multiply", type, {{"in1", *this}, {"in2", other}});
}
else {
BLI_assert_unreachable();
@ -540,8 +537,7 @@ NodeItem NodeItem::convert(Type to_type) const
}
}
else {
res = create_node("convert", to_type);
res.set_input("in", *this);
res = create_node("convert", to_type, {{"in", *this}});
}
return res;
}
@ -597,11 +593,8 @@ NodeItem NodeItem::if_else(CompareOp op,
res = func(value->asA<float>(), other.value->asA<float>()) ? item1 : item2;
}
else {
res = create_node(category, to_type);
res.set_input("value1", *this);
res.set_input("value2", other);
res.set_input("in1", item1);
res.set_input("in2", item2);
res = create_node(
category, to_type, {{"value1", *this}, {"value2", other}, {"in1", item1}, {"in2", item2}});
}
return res;
@ -610,9 +603,7 @@ NodeItem NodeItem::if_else(CompareOp op,
NodeItem NodeItem::extract(const int index) const
{
/* TODO: Add check if (value) { ... } */
NodeItem res = create_node("extract", Type::Float);
res.set_input("in", *this);
res.set_input("index", val(index));
NodeItem res = create_node("extract", Type::Float, {{"in", *this}, {"index", val(index)}});
return res;
}
@ -644,6 +635,19 @@ NodeItem NodeItem::create_node(const std::string &category, NodeItem::Type type)
return res;
}
NodeItem NodeItem::create_node(const std::string &category,
NodeItem::Type type,
const std::map<std::string, NodeItem> &inputs) const
{
NodeItem res = create_node(category, type);
for (auto &it : inputs) {
if (it.second) {
res.set_input(it.first, it.second);
}
}
return res;
}
void NodeItem::set_input(const std::string &in_name, const NodeItem &item)
{
if (item.value) {
@ -821,8 +825,7 @@ NodeItem NodeItem::arithmetic(const std::string &category, std::function<float(f
type = type == Type::Color3 ? Type::Vector3 : Type::Vector4;
v = v.convert(type);
}
res = create_node(category, type);
res.set_input("in", v);
res = create_node(category, type, {{"in", v}});
}
return res;
}
@ -887,9 +890,7 @@ NodeItem NodeItem::arithmetic(const NodeItem &other,
}
}
else {
res = create_node(category, to_type);
res.set_input("in1", item1);
res.set_input("in2", item2);
res = create_node(category, to_type, {{"in1", item1}, {"in2", item2}});
}
return res;
}

View File

@ -4,6 +4,8 @@
#pragma once
#include <map>
#include <MaterialXCore/Node.h>
namespace blender::nodes::materialx {
@ -107,6 +109,7 @@ class NodeItem {
/* Node functions */
NodeItem create_node(const std::string &category, NodeItem::Type type) const;
NodeItem create_node(const std::string &category, NodeItem::Type type, const std::map<std::string, NodeItem> &inputs) const;
template<class T> void set_input(const std::string &in_name, const T &value, Type in_type);
void set_input(const std::string &in_name, const NodeItem &item);
NodeItem add_output(const std::string &out_name, Type out_type);

View File

@ -84,6 +84,13 @@ NodeItem NodeParser::create_node(const std::string &category, NodeItem::Type typ
return empty().create_node(category, type);
}
NodeItem NodeParser::create_node(const std::string &category,
NodeItem::Type type,
const std::map<std::string, NodeItem> &inputs)
{
return empty().create_node(category, type, inputs);
}
NodeItem NodeParser::create_input(const std::string &name, const NodeItem &item)
{
return empty().create_input(name, item);

View File

@ -44,6 +44,9 @@ class NodeParser {
protected:
std::string node_name() const;
NodeItem create_node(const std::string &category, NodeItem::Type type);
NodeItem create_node(const std::string &category,
NodeItem::Type type,
const std::map<std::string, NodeItem> &inputs);
NodeItem create_input(const std::string &name, const NodeItem &item);
NodeItem create_output(const std::string &name, const NodeItem &item);
NodeItem get_input_default(const std::string &name, NodeItem::Type to_type);

View File

@ -45,13 +45,9 @@ NODE_SHADER_MATERIALX_BEGIN
NodeItem roughness = get_input_value("Roughness", NodeItem::Type::Float);
NodeItem normal = get_input_link("Normal", NodeItem::Type::Vector3);
NodeItem res = create_node("oren_nayar_diffuse_bsdf", NodeItem::Type::BSDF);
res.set_input("color", color);
res.set_input("roughness", roughness);
if (normal) {
res.set_input("normal", normal);
}
return res;
return create_node("oren_nayar_diffuse_bsdf",
NodeItem::Type::BSDF,
{{"color", color}, {"roughness", roughness}, {"normal", normal}});
}
#endif
NODE_SHADER_MATERIALX_END

View File

@ -54,35 +54,29 @@ NODE_SHADER_MATERIALX_BEGIN
NodeItem ior = get_input_value("IOR", NodeItem::Type::Float);
NodeItem normal = get_input_link("Normal", NodeItem::Type::Vector3);
NodeItem dielectric = create_node("dielectric_bsdf", NodeItem::Type::BSDF);
if (normal) {
dielectric.set_input("normal", normal);
}
dielectric.set_input("tint", color);
dielectric.set_input("roughness", roughness);
dielectric.set_input("ior", ior);
dielectric.set_input("scatter_mode", val(std::string("RT")));
NodeItem dielectric = create_node("dielectric_bsdf",
NodeItem::Type::BSDF,
{{"normal", normal},
{"tint", color},
{"roughness", roughness},
{"ior", ior},
{"scatter_mode", val(std::string("RT"))}});
NodeItem artistic_ior = create_node("artistic_ior", NodeItem::Type::Multioutput);
artistic_ior.set_input("reflectivity", color);
artistic_ior.set_input("edge_color", color);
NodeItem artistic_ior = create_node("artistic_ior",
NodeItem::Type::Multioutput,
{{"reflectivity", color}, {"edge_color", color}});
NodeItem ior_out = artistic_ior.add_output("ior", NodeItem::Type::Color3);
NodeItem extinction_out = artistic_ior.add_output("extinction", NodeItem::Type::Color3);
NodeItem conductor = create_node("conductor_bsdf", NodeItem::Type::BSDF);
if (normal) {
conductor.set_input("normal", normal);
}
conductor.set_input("ior", ior_out);
conductor.set_input("extinction", extinction_out);
conductor.set_input("roughness", roughness);
NodeItem conductor = create_node("conductor_bsdf",
NodeItem::Type::BSDF,
{{"normal", normal},
{"ior", ior_out},
{"extinction", extinction_out},
{"roughness", roughness}});
NodeItem res = create_node("mix", NodeItem::Type::BSDF);
res.set_input("fg", dielectric);
res.set_input("bg", conductor);
res.set_input("mix", val(0.5f));
return res;
return create_node(
"mix", NodeItem::Type::BSDF, {{"fg", dielectric}, {"bg", conductor}, {"mix", val(0.5f)}});
}
#endif
NODE_SHADER_MATERIALX_END

View File

@ -69,24 +69,19 @@ NODE_SHADER_MATERIALX_BEGIN
NodeItem normal = get_input_link("Normal", NodeItem::Type::Vector3);
NodeItem tangent = get_input_link("Tangent", NodeItem::Type::Vector3);
NodeItem artistic_ior = create_node("artistic_ior", NodeItem::Type::Multioutput);
artistic_ior.set_input("reflectivity", color);
artistic_ior.set_input("edge_color", color);
NodeItem artistic_ior = create_node("artistic_ior",
NodeItem::Type::Multioutput,
{{"reflectivity", color}, {"edge_color", color}});
NodeItem ior_out = artistic_ior.add_output("ior", NodeItem::Type::Color3);
NodeItem extinction_out = artistic_ior.add_output("extinction", NodeItem::Type::Color3);
NodeItem res = create_node("conductor_bsdf", NodeItem::Type::BSDF);
if (normal) {
res.set_input("normal", normal);
}
if (tangent) {
res.set_input("tangent", tangent);
}
res.set_input("ior", ior_out);
res.set_input("extinction", extinction_out);
res.set_input("roughness", roughness);
return res;
return create_node("conductor_bsdf",
NodeItem::Type::BSDF,
{{"normal", normal},
{"tangent", tangent},
{"ior", ior_out},
{"extinction", extinction_out},
{"roughness", roughness}});
}
#endif
NODE_SHADER_MATERIALX_END

View File

@ -331,52 +331,39 @@ NODE_SHADER_MATERIALX_BEGIN
subsurface_radius = subsurface_radius * subsurface_scale;
/* Creating standard_surface */
NodeItem res = create_node("standard_surface", NodeItem::Type::SurfaceShader);
res.set_input("base", val(1.0f));
res.set_input("base_color", base_color);
res.set_input("diffuse_roughness", roughness);
if (normal) {
res.set_input("normal", normal);
}
if (tangent) {
res.set_input("tangent", tangent);
}
res.set_input("metalness", metallic);
res.set_input("specular", specular);
res.set_input("specular_color", base_color);
res.set_input("specular_roughness", roughness);
res.set_input("specular_IOR", ior);
res.set_input("specular_anisotropy", anisotropic);
res.set_input("specular_rotation", anisotropic_rotation);
res.set_input("transmission", transmission);
res.set_input("transmission_color", base_color);
res.set_input("transmission_extra_roughness", roughness);
res.set_input("subsurface", subsurface);
res.set_input("subsurface_color", base_color);
res.set_input("subsurface_radius", subsurface_radius);
res.set_input("subsurface_anisotropy", anisotropic);
res.set_input("sheen", sheen);
res.set_input("sheen_color", base_color);
res.set_input("sheen_roughness", roughness);
res.set_input("coat", coat);
res.set_input("coat_color", base_color);
res.set_input("coat_roughness", coat_roughness);
res.set_input("coat_IOR", ior);
res.set_input("coat_anisotropy", anisotropic);
res.set_input("coat_rotation", anisotropic_rotation);
if (coat_normal) {
res.set_input("coat_normal", coat_normal);
}
res.set_input("emission", emission_strength);
res.set_input("emission_color", emission);
return res;
return create_node("standard_surface",
NodeItem::Type::SurfaceShader,
{{"base", val(1.0f)},
{"base_color", base_color},
{"diffuse_roughness", roughness},
{"normal", normal},
{"tangent", tangent},
{"metalness", metallic},
{"specular", specular},
{"specular_color", base_color},
{"specular_roughness", roughness},
{"specular_IOR", ior},
{"specular_anisotropy", anisotropic},
{"specular_rotation", anisotropic_rotation},
{"transmission", transmission},
{"transmission_color", base_color},
{"transmission_extra_roughness", roughness},
{"subsurface", subsurface},
{"subsurface_color", base_color},
{"subsurface_radius", subsurface_radius},
{"subsurface_anisotropy", anisotropic},
{"sheen", sheen},
{"sheen_color", base_color},
{"sheen_roughness", roughness},
{"coat", coat},
{"coat_color", base_color},
{"coat_roughness", coat_roughness},
{"coat_IOR", ior},
{"coat_anisotropy", anisotropic},
{"coat_rotation", anisotropic_rotation},
{"coat_normal", coat_normal},
{"emission", emission_strength},
{"emission_color", emission}});
}
#endif
NODE_SHADER_MATERIALX_END

View File

@ -52,16 +52,13 @@ NODE_SHADER_MATERIALX_BEGIN
NodeItem ior = get_input_value("IOR", NodeItem::Type::Float);
NodeItem normal = get_input_link("Normal", NodeItem::Type::Vector3);
NodeItem res = create_node("dielectric_bsdf", NodeItem::Type::BSDF);
if (normal) {
res.set_input("normal", normal);
}
res.set_input("tint", color);
res.set_input("roughness", roughness);
res.set_input("ior", ior);
res.set_input("scatter_mode", val(std::string("T")));
return res;
return create_node("dielectric_bsdf",
NodeItem::Type::BSDF,
{{"normal", normal},
{"tint", color},
{"roughness", roughness},
{"ior", ior},
{"scatter_mode", val(std::string("T"))}});
}
#endif
NODE_SHADER_MATERIALX_END

View File

@ -58,14 +58,10 @@ NODE_SHADER_MATERIALX_BEGIN
NodeItem roughness = get_input_value("Roughness", NodeItem::Type::Float);
NodeItem normal = get_input_link("Normal", NodeItem::Type::Vector3);
NodeItem res = create_node("sheen_bsdf", NodeItem::Type::BSDF);
res.set_input("color", color);
res.set_input("weight", roughness);
res.set_input("roughness", roughness);
if (normal) {
res.set_input("normal", normal);
}
return res;
return create_node(
"sheen_bsdf",
NodeItem::Type::BSDF,
{{"color", color}, {"weight", roughness}, {"roughness", roughness}, {"normal", normal}});
}
#endif
NODE_SHADER_MATERIALX_END

View File

@ -39,12 +39,8 @@ NODE_SHADER_MATERIALX_BEGIN
NodeItem color = get_input_value("Color", NodeItem::Type::Color3);
NodeItem normal = get_input_link("Normal", NodeItem::Type::Vector3);
NodeItem res = create_node("translucent_bsdf", NodeItem::Type::BSDF);
res.set_input("color", color);
if (normal) {
res.set_input("normal", normal);
}
return res;
return create_node(
"translucent_bsdf", NodeItem::Type::BSDF, {{"color", color}, {"normal", normal}});
}
#endif
NODE_SHADER_MATERIALX_END

View File

@ -34,9 +34,7 @@ NODE_SHADER_MATERIALX_BEGIN
NodeItem color = get_input_value("Color", NodeItem::Type::Color3);
NodeItem strength = get_input_value("Strength", NodeItem::Type::Float);
NodeItem res = create_node("uniform_edf", NodeItem::Type::EDF);
res.set_input("color", color * strength);
return res;
return create_node("uniform_edf", NodeItem::Type::EDF, {{"color", color * strength}});
}
#endif
NODE_SHADER_MATERIALX_END

View File

@ -66,16 +66,13 @@ NODE_SHADER_MATERIALX_BEGIN
std::string name = socket_out_->name;
if (name == "Position") {
res = create_node("position", NodeItem::Type::Vector3);
res.set_input("space", val(std::string("world")));
res = create_node("position", NodeItem::Type::Vector3, {{"space", val(std::string("world"))}});
}
else if (name == "Normal") {
res = create_node("normal", NodeItem::Type::Vector3);
res.set_input("space", val(std::string("world")));
res = create_node("normal", NodeItem::Type::Vector3, {{"space", val(std::string("world"))}});
}
else if (ELEM(name, "Tangent", "True Normal")) {
res = create_node("tangent", NodeItem::Type::Vector3);
res.set_input("space", val(std::string("world")));
res = create_node("tangent", NodeItem::Type::Vector3, {{"space", val(std::string("world"))}});
}
else {
res = get_output_default(name, NodeItem::Type::Any);

View File

@ -43,15 +43,10 @@ NODE_SHADER_MATERIALX_BEGIN
/* Modifier to follow Cycles result */
hue = hue - val(0.5f);
NodeItem combine = create_node("combine3", NodeItem::Type::Vector3);
combine.set_input("in1", hue);
combine.set_input("in2", saturation);
combine.set_input("in3", value);
NodeItem combine = create_node(
"combine3", NodeItem::Type::Vector3, {{"in1", hue}, {"in2", saturation}, {"in3", value}});
NodeItem res = create_node("hsvadjust", NodeItem::Type::Color3);
res.set_input("in", color);
res.set_input("amount", combine);
return res;
return create_node("hsvadjust", NodeItem::Type::Color3, {{"in", color}, {"amount", combine}});
}
#endif
NODE_SHADER_MATERIALX_END

View File

@ -31,7 +31,7 @@ NODE_SHADER_MATERIALX_BEGIN
{
NodeItem fac = get_input_value("Fac", NodeItem::Type::Float);
NodeItem color = get_input_value("Color", NodeItem::Type::Color3);
return fac.blend(color, fac.val(1.0f) - color);
return fac.blend(color, val(1.0f) - color);
}
#endif
NODE_SHADER_MATERIALX_END

View File

@ -475,14 +475,14 @@ NODE_SHADER_MATERIALX_BEGIN
BLI_assert_unreachable();
}
NodeItem res = create_node("range", type);
res.set_input("in", value);
res.set_input("inlow", from_min);
res.set_input("inhigh", from_max);
res.set_input("outlow", to_min);
res.set_input("outhigh", to_max);
res.set_input("doclamp", val(bool(map_range->clamp)));
return res;
return create_node("range",
type,
{{"in", value},
{"inlow", from_min},
{"inhigh", from_max},
{"outlow", to_min},
{"outhigh", to_max},
{"doclamp", val(bool(map_range->clamp))}});
}
#endif
NODE_SHADER_MATERIALX_END

View File

@ -41,10 +41,7 @@ NODE_SHADER_MATERIALX_BEGIN
res = shader2 * fac;
}
else if (shader1 && shader2) {
res = create_node("mix", to_type_);
res.set_input("fg", shader1);
res.set_input("bg", shader2);
res.set_input("mix", fac);
res = create_node("mix", to_type_, {{"fg", shader1}, {"bg", shader2}, {"mix", fac}});
}
break;
}

View File

@ -147,11 +147,9 @@ NODE_SHADER_MATERIALX_BEGIN
BLI_assert_unreachable();
}
NodeItem res = create_node("normalmap", NodeItem::Type::Vector3);
res.set_input("in", color);
res.set_input("scale", strength);
res.set_input("space", val(space));
return res;
return create_node("normalmap",
NodeItem::Type::Vector3,
{{"in", color}, {"scale", strength}, {"space", val(space)}});
}
#endif
NODE_SHADER_MATERIALX_END

View File

@ -38,8 +38,7 @@ NODE_SHADER_MATERIALX_BEGIN
std::string name = socket_out_->name;
if (name == "Location") {
res = create_node("position", NodeItem::Type::Vector3);
res.set_input("space", val(std::string("world")));
res = create_node("position", NodeItem::Type::Vector3, {{"space", val(std::string("world"))}});
}
/* TODO: This node doesn't have an implementation in MaterialX.
* It's added in MaterialX 1.38.8. Uncomment this code after switching to 1.38.8.

View File

@ -61,9 +61,7 @@ NODE_SHADER_MATERIALX_BEGIN
else {
surface = get_input_link("Surface", NodeItem::Type::SurfaceShader);
}
NodeItem res = create_node("surfacematerial", NodeItem::Type::Material);
res.set_input("surfaceshader", surface);
return res;
return create_node("surfacematerial", NodeItem::Type::Material, {{"surfaceshader", surface}});
}
#endif
NODE_SHADER_MATERIALX_END

View File

@ -30,9 +30,7 @@ NODE_SHADER_MATERIALX_BEGIN
#ifdef WITH_MATERIALX
{
NodeItem color = get_output_default("Color", NodeItem::Type::Color4);
NodeItem res = create_node("constant", NodeItem::Type::Color4);
res.set_input("value", color);
return res;
return create_node("constant", NodeItem::Type::Color4, {{"value", color}});
}
#endif
NODE_SHADER_MATERIALX_END

View File

@ -31,10 +31,7 @@ NODE_SHADER_MATERIALX_BEGIN
#ifdef WITH_MATERIALX
{
NodeItem color = get_input_value("Color", NodeItem::Type::Color4);
NodeItem res = create_node("luminance", NodeItem::Type::Color4);
res.set_input("in", color);
return res;
return create_node("luminance", NodeItem::Type::Color4, {{"in", color}});
}
#endif
NODE_SHADER_MATERIALX_END

View File

@ -82,8 +82,7 @@ NODE_SHADER_MATERIALX_BEGIN
case NODE_COMBSEP_COLOR_HSV:
case NODE_COMBSEP_COLOR_HSL:
/* NOTE: HSL is unsupported color model, using HSV instead */
convert = create_node("rgbtohsv", NodeItem::Type::Color3);
convert.set_input("in", color);
convert = create_node("rgbtohsv", NodeItem::Type::Color3, {{"in", color}});
break;
default:
BLI_assert_unreachable();

View File

@ -153,11 +153,7 @@ NODE_SHADER_MATERIALX_BEGIN
NodeItem y = get_input_value("Y", NodeItem::Type::Float);
NodeItem z = get_input_value("Z", NodeItem::Type::Float);
NodeItem res = create_node("combine3", NodeItem::Type::Vector3);
res.set_input("in1", x);
res.set_input("in2", y);
res.set_input("in3", z);
return res;
return create_node("combine3", NodeItem::Type::Vector3, {{"in1", x}, {"in2", y}, {"in3", z}});
}
#endif
NODE_SHADER_MATERIALX_END

View File

@ -91,15 +91,13 @@ NODE_SHADER_MATERIALX_BEGIN
NodeItem anisotropy = get_input_value("Anisotropy", NodeItem::Type::Float);
NodeItem normal = get_input_link("Normal", NodeItem::Type::Vector3);
NodeItem res = create_node("subsurface_bsdf", NodeItem::Type::BSDF);
res.set_input("weight", val(1.0f));
res.set_input("color", color);
res.set_input("radius", radius * scale);
res.set_input("anisotropy", anisotropy);
if (normal) {
res.set_input("normal", normal);
}
return res;
return create_node("subsurface_bsdf",
NodeItem::Type::BSDF,
{{"weight", val(1.0f)},
{"color", color},
{"radius", radius * scale},
{"anisotropy", anisotropy},
{"normal", normal}});
}
#endif
NODE_SHADER_MATERIALX_END

View File

@ -82,12 +82,10 @@ NODE_SHADER_MATERIALX_BEGIN
res = texcoord_node();
}
else if (name == "Normal") {
res = create_node("normal", NodeItem::Type::Vector3);
res.set_input("space", val(std::string("world")));
res = create_node("normal", NodeItem::Type::Vector3, {{"space", val(std::string("world"))}});
}
else if (name == "Object") {
res = create_node("position", NodeItem::Type::Vector3);
res.set_input("space", val(std::string("world")));
res = create_node("position", NodeItem::Type::Vector3, {{"space", val(std::string("world"))}});
}
else {
res = get_output_default(name, NodeItem::Type::Any);

View File

@ -231,12 +231,13 @@ NODE_SHADER_MATERIALX_BEGIN
BLI_assert_unreachable();
}
res = create_node("image", NodeItem::Type::Color4);
res = create_node("image",
NodeItem::Type::Color4,
{{"texcoord", vector},
{"filtertype", val(filtertype)},
{"uaddressmode", val(addressmode)},
{"vaddressmode", val(addressmode)}});
res.set_input("file", image_path, NodeItem::Type::Filename);
res.set_input("texcoord", vector);
res.set_input("filtertype", val(filtertype));
res.set_input("uaddressmode", val(addressmode));
res.set_input("vaddressmode", val(addressmode));
}
if (STREQ(socket_out_->name, "Alpha")) {

View File

@ -267,11 +267,11 @@ NODE_SHADER_MATERIALX_BEGIN
NodeItem position = create_node("position", NodeItem::Type::Vector3);
position = position * scale;
NodeItem res = create_node("fractal3d", NodeItem::Type::Color3);
res.set_input("position", position);
res.set_input("octaves", val(int(detail.value->asA<float>())));
res.set_input("lacunarity", lacunarity);
return res;
return create_node("fractal3d",
NodeItem::Type::Color3,
{{"position", position},
{"octaves", val(int(detail.value->asA<float>()))},
{"lacunarity", lacunarity}});
}
#endif
NODE_SHADER_MATERIALX_END

View File

@ -42,9 +42,7 @@ NODE_SHADER_MATERIALX_BEGIN
#ifdef WITH_MATERIALX
{
NodeItem value = get_output_default("Value", NodeItem::Type::Float);
NodeItem res = create_node("constant", NodeItem::Type::Float);
res.set_input("value", value);
return res;
return create_node("constant", NodeItem::Type::Float, {{"value", value}});
}
#endif
NODE_SHADER_MATERIALX_END