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 25 additions and 0 deletions
Showing only changes of commit f900c67ce0 - Show all commits

View File

@ -147,6 +147,7 @@ set(LIB
if(WITH_MATERIALX) if(WITH_MATERIALX)
list(APPEND SRC list(APPEND SRC
materialx/material.cc materialx/material.cc
materialx/nodes/blackbody.cc
materialx/nodes/brightness.cc materialx/nodes/brightness.cc
materialx/nodes/bsdf_principled.cc materialx/nodes/bsdf_principled.cc
materialx/nodes/huesatval.cc materialx/nodes/huesatval.cc

View File

@ -0,0 +1,22 @@
/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "node_parser.h"
namespace blender::nodes::materialx {
NodeItem BlackbodyNodeParser::compute()
{
/* This node doesn't have an implementation in MaterialX 1.38.6.
* It's added in MaterialX 1.38.8. Uncomment this code after switching to 1.38.8.
BogdanNagirniak marked this conversation as resolved Outdated

It is exists in pbrlib_def.mtlx, can be used here

It is exists in pbrlib_def.mtlx, can be used here
*
* NodeItem temperature = get_input_value("Temperature", NodeItem::Type::Float);
* NodeItem res = create_node("blackbody", "color3");
* res.set_input("temperature", temperature);
* return res; */
return empty();
}
} // namespace blender::nodes::materialx

View File

@ -132,6 +132,7 @@ NodeItem NodeParser::get_input_link(const bNodeSocket &socket)
break; break;
switch (from_node->typeinfo->type) { switch (from_node->typeinfo->type) {
CASE_NODE_TYPE(SH_NODE_BLACKBODY, BlackbodyNodeParser)
CASE_NODE_TYPE(SH_NODE_BRIGHTCONTRAST, BrightContrastNodeParser) CASE_NODE_TYPE(SH_NODE_BRIGHTCONTRAST, BrightContrastNodeParser)
CASE_NODE_TYPE(SH_NODE_BSDF_PRINCIPLED, BSDFPrincipledNodeParser) CASE_NODE_TYPE(SH_NODE_BSDF_PRINCIPLED, BSDFPrincipledNodeParser)
CASE_NODE_TYPE(SH_NODE_COMBINE_COLOR, CombineColorNodeParser) CASE_NODE_TYPE(SH_NODE_COMBINE_COLOR, CombineColorNodeParser)

View File

@ -63,6 +63,7 @@ template<class T> NodeItem NodeParser::value(const T &data) const
NodeItem compute() override; \ NodeItem compute() override; \
}; };
DECLARE_PARSER(BlackbodyNodeParser)
DECLARE_PARSER(BrightContrastNodeParser) DECLARE_PARSER(BrightContrastNodeParser)
DECLARE_PARSER(BSDFPrincipledNodeParser) DECLARE_PARSER(BSDFPrincipledNodeParser)
DECLARE_PARSER(CombineColorNodeParser) DECLARE_PARSER(CombineColorNodeParser)