|
Blender V4.3
|
#include <node_item.h>
Public Types | |
| enum class | Type { Any = 0 , Empty , Multioutput , String , Filename , Boolean , Integer , Float , Vector2 , Vector3 , Color3 , Vector4 , Color4 , BSDF , EDF , DisplacementShader , SurfaceShader , Material , SurfaceOpacity } |
| enum class | CompareOp { Less = 0 , LessEq , Eq , GreaterEq , Greater , NotEq } |
| using | Inputs = std::vector<std::pair<std::string, NodeItem>> |
Public Member Functions | |
| NodeItem ()=default | |
| NodeItem (MaterialX::GraphElement *graph) | |
| ~NodeItem ()=default | |
| operator bool () const | |
| NodeItem | operator+ (const NodeItem &other) const |
| NodeItem | operator- (const NodeItem &other) const |
| NodeItem | operator- () const |
| NodeItem | operator* (const NodeItem &other) const |
| NodeItem | operator/ (const NodeItem &other) const |
| NodeItem | operator% (const NodeItem &other) const |
| NodeItem | operator^ (const NodeItem &other) const |
| NodeItem | operator[] (int index) const |
| bool | operator== (const NodeItem &other) const |
| bool | operator!= (const NodeItem &other) const |
| NodeItem | abs () const |
| NodeItem | floor () const |
| NodeItem | ceil () const |
| NodeItem | length () const |
| NodeItem | normalize () const |
| NodeItem | min (const NodeItem &other) const |
| NodeItem | max (const NodeItem &other) const |
| NodeItem | dotproduct (const NodeItem &other) const |
| NodeItem | mix (const NodeItem &val1, const NodeItem &val2) const |
| NodeItem | clamp (const NodeItem &min_val, const NodeItem &max_val) const |
| NodeItem | clamp (float min_val=0.0f, float max_val=1.0f) const |
| NodeItem | rotate (const NodeItem &angle, const NodeItem &axis) |
| NodeItem | rotate (const NodeItem &angle_xyz, bool invert=false) |
| NodeItem | sin () const |
| NodeItem | cos () const |
| NodeItem | tan () const |
| NodeItem | asin () const |
| NodeItem | acos () const |
| NodeItem | atan () const |
| NodeItem | atan2 (const NodeItem &other) const |
| NodeItem | sinh () const |
| NodeItem | cosh () const |
| NodeItem | tanh () const |
| NodeItem | ln () const |
| NodeItem | sqrt () const |
| NodeItem | sign () const |
| NodeItem | exp () const |
| NodeItem | convert (Type to_type) const |
| NodeItem | to_vector () const |
| NodeItem | if_else (CompareOp op, const NodeItem &other, const NodeItem &if_val, const NodeItem &else_val) const |
| NodeItem | empty () const |
| template<class T > | |
| NodeItem | val (const T &data) const |
| Type | type () const |
| NodeItem | create_node (const std::string &category, Type type) const |
| NodeItem | create_node (const std::string &category, Type type, const Inputs &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) |
| NodeItem | create_input (const std::string &name, const NodeItem &item) const |
| NodeItem | create_output (const std::string &name, const NodeItem &item) const |
Static Public Member Functions | |
| static Type | type (const std::string &type_str) |
| static std::string | type (Type type) |
| static bool | is_arithmetic (Type type) |
Public Attributes | |
| MaterialX::ValuePtr | value |
| MaterialX::NodePtr | node |
| MaterialX::InputPtr | input |
| MaterialX::OutputPtr | output |
This class serves as abstraction from MateralX API. It implements arithmetic operations, conversions between different types, adding new nodes, setting inputs, etc. All work should be done via this class instead of using MaterialX API directly.
Definition at line 18 of file node_item.h.
| using blender::nodes::materialx::NodeItem::Inputs = std::vector<std::pair<std::string, NodeItem>> |
Definition at line 20 of file node_item.h.
|
strong |
| Enumerator | |
|---|---|
| Less | |
| LessEq | |
| Eq | |
| GreaterEq | |
| Greater | |
| NotEq | |
Definition at line 51 of file node_item.h.
|
strong |
| Enumerator | |
|---|---|
| Any | |
| Empty | |
| Multioutput | |
| String | |
| Filename | |
| Boolean | |
| Integer | |
| Float | |
| Vector2 | |
| Vector3 | |
| Color3 | |
| Vector4 | |
| Color4 | |
| BSDF | |
| EDF | |
| DisplacementShader | |
| SurfaceShader | |
| Material | |
| SurfaceOpacity | |
Definition at line 22 of file node_item.h.
|
default |
Referenced by empty().
| blender::nodes::materialx::NodeItem::NodeItem | ( | MaterialX::GraphElement * | graph | ) |
Definition at line 13 of file node_item.cc.
|
default |
References is_arithmetic().
| NodeItem blender::nodes::materialx::NodeItem::abs | ( | ) | const |
Definition at line 250 of file node_item.cc.
| NodeItem blender::nodes::materialx::NodeItem::acos | ( | ) | const |
Definition at line 426 of file node_item.cc.
References to_vector().
| NodeItem blender::nodes::materialx::NodeItem::add_output | ( | const std::string & | out_name, |
| Type | out_type ) |
Definition at line 856 of file node_item.cc.
| NodeItem blender::nodes::materialx::NodeItem::asin | ( | ) | const |
Definition at line 421 of file node_item.cc.
References to_vector().
| NodeItem blender::nodes::materialx::NodeItem::atan | ( | ) | const |
Definition at line 431 of file node_item.cc.
References to_vector().
Definition at line 436 of file node_item.cc.
References b, and to_vector().
| NodeItem blender::nodes::materialx::NodeItem::ceil | ( | ) | const |
Definition at line 260 of file node_item.cc.
| NodeItem blender::nodes::materialx::NodeItem::clamp | ( | float | min_val = 0.0f, |
| float | max_val = 1.0f ) const |
Definition at line 375 of file node_item.cc.
Definition at line 481 of file node_item.cc.
References Any, BLI_assert_unreachable, CLOG_WARN, Color3, Color4, convert(), create_node(), Empty, empty(), Float, is_arithmetic(), blender::nodes::materialx::LOG_MATERIALX_SHADER, blender::gpu::shader::to_type(), type(), v, value, Vector2, Vector3, and Vector4.
Referenced by clamp(), blender::nodes::materialx::GroupNodeParser::compute_full(), blender::nodes::materialx::NodeParser::compute_full(), convert(), and to_vector().
| NodeItem blender::nodes::materialx::NodeItem::cos | ( | ) | const |
Definition at line 411 of file node_item.cc.
References to_vector().
| NodeItem blender::nodes::materialx::NodeItem::cosh | ( | ) | const |
Definition at line 447 of file node_item.cc.
References to_vector(), v, and val().
| NodeItem blender::nodes::materialx::NodeItem::create_input | ( | const std::string & | name, |
| const NodeItem & | item ) const |
Definition at line 863 of file node_item.cc.
References BLI_assert_unreachable, empty(), input, node, type(), and type().
Referenced by blender::nodes::materialx::NodeParser::create_input().
| NodeItem blender::nodes::materialx::NodeItem::create_node | ( | const std::string & | category, |
| Type | type ) const |
Definition at line 762 of file node_item.cc.
References CLOG_INFO, ELEM, empty(), blender::nodes::materialx::LOG_MATERIALX_SHADER, Material, node, SurfaceShader, and type().
Referenced by clamp(), convert(), create_node(), blender::nodes::materialx::NodeParser::create_node(), blender::nodes::materialx::NodeParser::create_node(), dotproduct(), if_else(), length(), mix(), normalize(), operator*(), operator+(), operator[](), and rotate().
| NodeItem blender::nodes::materialx::NodeItem::create_node | ( | const std::string & | category, |
| Type | type, | ||
| const Inputs & | inputs ) const |
Definition at line 778 of file node_item.cc.
References create_node(), inputs, and set_input().
| NodeItem blender::nodes::materialx::NodeItem::create_output | ( | const std::string & | name, |
| const NodeItem & | item ) const |
Definition at line 880 of file node_item.cc.
References BLI_assert_unreachable, empty(), input, node, output, type(), and type().
Referenced by blender::nodes::materialx::NodeParser::create_output().
Definition at line 291 of file node_item.cc.
References BLI_assert_unreachable, Color3, Color4, create_node(), Float, to_vector(), type(), v, val(), value, Vector2, Vector3, and Vector4.
Referenced by length().
| NodeItem blender::nodes::materialx::NodeItem::empty | ( | ) | const |
Definition at line 743 of file node_item.cc.
References NodeItem().
Referenced by add_output(), convert(), create_input(), create_node(), create_output(), if_else(), operator*(), operator+(), and to_vector().
| NodeItem blender::nodes::materialx::NodeItem::exp | ( | ) | const |
| NodeItem blender::nodes::materialx::NodeItem::floor | ( | ) | const |
Definition at line 255 of file node_item.cc.
| NodeItem blender::nodes::materialx::NodeItem::if_else | ( | CompareOp | op, |
| const NodeItem & | other, | ||
| const NodeItem & | if_val, | ||
| const NodeItem & | else_val ) const |
Definition at line 685 of file node_item.cc.
References b, BLI_assert_unreachable, create_node(), Empty, empty(), Eq, Float, Greater, GreaterEq, if_else(), Less, LessEq, NotEq, blender::gpu::shader::to_type(), and type().
Referenced by if_else().
|
static |
Definition at line 115 of file node_item.cc.
Referenced by convert(), operator[](), and ~NodeItem().
| NodeItem blender::nodes::materialx::NodeItem::length | ( | ) | const |
Definition at line 265 of file node_item.cc.
References create_node(), dotproduct(), Float, sqrt(), and to_vector().
Referenced by normalize().
| NodeItem blender::nodes::materialx::NodeItem::ln | ( | ) | const |
Definition at line 461 of file node_item.cc.
References to_vector().
Definition at line 281 of file node_item.cc.
References b.
| NodeItem blender::nodes::materialx::NodeItem::mix | ( | const NodeItem & | val1, |
| const NodeItem & | val2 ) const |
Definition at line 338 of file node_item.cc.
References BLI_assert, BSDF, create_node(), EDF, ELEM, Float, blender::gpu::shader::to_type(), type(), val(), and value.
| NodeItem blender::nodes::materialx::NodeItem::normalize | ( | ) | const |
Definition at line 273 of file node_item.cc.
References create_node(), length(), to_vector(), and Vector3.
| blender::nodes::materialx::NodeItem::operator bool | ( | ) | const |
Definition at line 120 of file node_item.cc.
References output.
| bool blender::nodes::materialx::NodeItem::operator!= | ( | const NodeItem & | other | ) | const |
Definition at line 245 of file node_item.cc.
Definition at line 177 of file node_item.cc.
References b.
Definition at line 153 of file node_item.cc.
References b, BLI_assert_unreachable, BSDF, Color3, create_node(), EDF, ELEM, empty(), Float, and type().
Definition at line 125 of file node_item.cc.
References b, BLI_assert_unreachable, BSDF, create_node(), EDF, ELEM, empty(), and type().
| NodeItem blender::nodes::materialx::NodeItem::operator- | ( | ) | const |
Definition at line 148 of file node_item.cc.
References val().
Definition at line 143 of file node_item.cc.
References b.
Definition at line 172 of file node_item.cc.
References b.
| bool blender::nodes::materialx::NodeItem::operator== | ( | const NodeItem & | other | ) | const |
Definition at line 221 of file node_item.cc.
References Empty, blender::gpu::shader::to_type(), and value.
Definition at line 188 of file node_item.cc.
References BLI_assert, BLI_assert_unreachable, Color3, Color4, create_node(), Float, is_arithmetic(), type(), v, val(), Vector2, Vector3, and Vector4.
Definition at line 183 of file node_item.cc.
References b.
| NodeItem blender::nodes::materialx::NodeItem::rotate | ( | const NodeItem & | angle, |
| const NodeItem & | axis ) |
Definition at line 380 of file node_item.cc.
References BLI_assert, create_node(), Float, type(), and Vector3.
Referenced by rotate().
| void blender::nodes::materialx::NodeItem::set_input | ( | const std::string & | in_name, |
| const NodeItem & | item ) |
Definition at line 789 of file node_item.cc.
References BLI_assert_unreachable, Boolean, CLOG_WARN, Color3, Color4, Float, input, Integer, blender::nodes::materialx::LOG_MATERIALX_SHADER, node, output, set_input(), String, SurfaceShader, type(), type(), value, Vector2, Vector3, and Vector4.
| void blender::nodes::materialx::NodeItem::set_input | ( | const std::string & | in_name, |
| const T & | value, | ||
| Type | in_type ) |
Definition at line 156 of file node_item.h.
References type().
Referenced by create_node(), and set_input().
| NodeItem blender::nodes::materialx::NodeItem::sign | ( | ) | const |
Definition at line 471 of file node_item.cc.
| NodeItem blender::nodes::materialx::NodeItem::sin | ( | ) | const |
Definition at line 406 of file node_item.cc.
References to_vector().
| NodeItem blender::nodes::materialx::NodeItem::sinh | ( | ) | const |
Definition at line 441 of file node_item.cc.
References to_vector(), v, and val().
| NodeItem blender::nodes::materialx::NodeItem::sqrt | ( | ) | const |
| NodeItem blender::nodes::materialx::NodeItem::tan | ( | ) | const |
Definition at line 416 of file node_item.cc.
References to_vector().
| NodeItem blender::nodes::materialx::NodeItem::tanh | ( | ) | const |
Definition at line 453 of file node_item.cc.
References b, exp(), to_vector(), and v.
| NodeItem blender::nodes::materialx::NodeItem::to_vector | ( | ) | const |
Definition at line 664 of file node_item.cc.
References BLI_assert_unreachable, Color3, Color4, convert(), empty(), Float, type(), Vector2, Vector3, and Vector4.
Referenced by acos(), asin(), atan(), atan2(), cos(), cosh(), dotproduct(), exp(), length(), ln(), normalize(), sin(), sinh(), sqrt(), tan(), and tanh().
| NodeItem::Type blender::nodes::materialx::NodeItem::type | ( | ) | const |
Definition at line 748 of file node_item.cc.
Referenced by add_output(), clamp(), blender::nodes::materialx::NodeParser::compute_full(), convert(), create_input(), create_node(), create_output(), if_else(), blender::nodes::materialx::NodeParser::node_name(), operator*(), operator+(), operator[](), rotate(), set_input(), set_input(), to_vector(), and type().
|
static |
Definition at line 15 of file node_item.cc.
References BLI_assert_unreachable, Boolean, BSDF, Color3, Color4, DisplacementShader, EDF, Empty, Filename, Float, Integer, Material, Multioutput, String, SurfaceShader, Vector2, Vector3, and Vector4.
Referenced by clamp(), create_input(), create_output(), dotproduct(), mix(), and set_input().
|
static |
Definition at line 70 of file node_item.cc.
References Any, BLI_assert_unreachable, Boolean, BSDF, Color3, Color4, DisplacementShader, EDF, Filename, Float, Integer, Material, Multioutput, String, SurfaceOpacity, SurfaceShader, Vector2, Vector3, and Vector4.
Definition at line 148 of file node_item.h.
References value.
Referenced by clamp(), cosh(), dotproduct(), mix(), operator-(), operator[](), rotate(), sinh(), and blender::nodes::materialx::NodeParser::val().
| MaterialX::InputPtr blender::nodes::materialx::NodeItem::input |
Definition at line 56 of file node_item.h.
Referenced by blender::nodes::materialx::GroupInputNodeParser::compute_full(), create_input(), create_output(), and set_input().
| MaterialX::NodePtr blender::nodes::materialx::NodeItem::node |
Definition at line 55 of file node_item.h.
Referenced by blender::nodes::materialx::DefaultMaterialNodeParser::compute(), blender::nodes::materialx::DefaultMaterialNodeParser::compute_error(), blender::nodes::materialx::NodeParser::compute_full(), create_input(), create_node(), create_output(), blender::nodes::materialx::export_to_materialx(), set_input(), and blender::nodes::materialx::NodeParser::texcoord_node().
| MaterialX::OutputPtr blender::nodes::materialx::NodeItem::output |
Definition at line 57 of file node_item.h.
Referenced by add_output(), blender::nodes::materialx::GroupNodeParser::compute(), blender::nodes::materialx::GroupOutputNodeParser::compute_full(), create_output(), and set_input().
| MaterialX::ValuePtr blender::nodes::materialx::NodeItem::value |
Definition at line 54 of file node_item.h.
Referenced by clamp(), convert(), dotproduct(), mix(), operator==(), set_input(), and val().