forked from blender/blender
MaterialX: add support for nodes #11
@ -126,6 +126,7 @@ NodeItem NodeParser::get_input_link(const bNodeSocket &socket)
|
|||||||
|
|
||||||
switch (from_node->typeinfo->type) {
|
switch (from_node->typeinfo->type) {
|
||||||
CASE_NODE_TYPE(SH_NODE_BSDF_PRINCIPLED, BSDFPrincipledNodeParser)
|
CASE_NODE_TYPE(SH_NODE_BSDF_PRINCIPLED, BSDFPrincipledNodeParser)
|
||||||
|
CASE_NODE_TYPE(SH_NODE_COMBXYZ, CombineXYZNodeParser)
|
||||||
CASE_NODE_TYPE(SH_NODE_HUE_SAT, HueSatValNodeParser)
|
CASE_NODE_TYPE(SH_NODE_HUE_SAT, HueSatValNodeParser)
|
||||||
CASE_NODE_TYPE(SH_NODE_INVERT, InvertNodeParser)
|
CASE_NODE_TYPE(SH_NODE_INVERT, InvertNodeParser)
|
||||||
CASE_NODE_TYPE(SH_NODE_MATH, MathNodeParser)
|
CASE_NODE_TYPE(SH_NODE_MATH, MathNodeParser)
|
||||||
|
@ -62,6 +62,7 @@ template<class T> NodeItem NodeParser::value(const T &data) const
|
|||||||
};
|
};
|
||||||
|
|
||||||
DECLARE_PARSER(BSDFPrincipledNodeParser)
|
DECLARE_PARSER(BSDFPrincipledNodeParser)
|
||||||
|
DECLARE_PARSER(CombineXYZNodeParser)
|
||||||
DECLARE_PARSER(HueSatValNodeParser)
|
DECLARE_PARSER(HueSatValNodeParser)
|
||||||
DECLARE_PARSER(InvertNodeParser)
|
DECLARE_PARSER(InvertNodeParser)
|
||||||
DECLARE_PARSER(MathNodeParser)
|
DECLARE_PARSER(MathNodeParser)
|
||||||
|
28
source/blender/nodes/shader/materialx/nodes/sepcomb_xyz.cc
Normal file
28
source/blender/nodes/shader/materialx/nodes/sepcomb_xyz.cc
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||||
|
|
||||||
|
#include "node_parser.h"
|
||||||
|
|
||||||
|
namespace blender::nodes::materialx {
|
||||||
|
|
||||||
|
NodeItem SeparateXYZNodeParser::compute()
|
||||||
|
{
|
||||||
|
NodeItem vector = get_input_value("Vector");
|
||||||
|
int index = STREQ(socket_out_->name, "X") ? 0 : STREQ(socket_out_->name, "Y") ? 1 : 2;
|
||||||
|
return vector.separate(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
NodeItem CombineXYZNodeParser::compute()
|
||||||
|
{
|
||||||
|
NodeItem x = get_input_value("X");
|
||||||
|
NodeItem y = get_input_value("Y");
|
||||||
|
NodeItem z = get_input_value("Z");
|
||||||
|
NodeItem res = create_node("combine3", "vector3");
|
||||||
|
res.set_input("in1", x);
|
||||||
|
res.set_input("in2", y);
|
||||||
|
res.set_input("in3", z);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace blender::nodes::materialx
|
Loading…
Reference in New Issue
Block a user