|
Blender V5.0
|
#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) |
| static bool | is_convertible (eNodeSocketDatatype from_type, Type to_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 abs(), acos(), add_output(), asin(), atan(), atan2(), ceil(), clamp(), clamp(), convert(), cos(), cosh(), create_input(), create_node(), create_node(), create_output(), dotproduct(), empty(), exp(), floor(), if_else(), length(), ln(), max(), min(), mix(), normalize(), operator!=(), operator%(), operator*(), operator+(), operator-(), operator-(), operator/(), operator==(), operator[](), operator^(), rotate(), rotate(), set_input(), sign(), sin(), sinh(), sqrt(), tan(), tanh(), to_vector(), val(), and ~NodeItem().
| blender::nodes::materialx::NodeItem::NodeItem | ( | MaterialX::GraphElement * | graph | ) |
Definition at line 14 of file node_item.cc.
|
default |
| NodeItem blender::nodes::materialx::NodeItem::abs | ( | ) | const |
Definition at line 251 of file node_item.cc.
References NodeItem().
| NodeItem blender::nodes::materialx::NodeItem::acos | ( | ) | const |
Definition at line 427 of file node_item.cc.
References NodeItem(), and to_vector().
| NodeItem blender::nodes::materialx::NodeItem::add_output | ( | const std::string & | out_name, |
| Type | out_type ) |
Definition at line 922 of file node_item.cc.
References empty(), node, NodeItem(), output, and type().
| NodeItem blender::nodes::materialx::NodeItem::asin | ( | ) | const |
Definition at line 422 of file node_item.cc.
References NodeItem(), and to_vector().
| NodeItem blender::nodes::materialx::NodeItem::atan | ( | ) | const |
Definition at line 432 of file node_item.cc.
References NodeItem(), and to_vector().
Definition at line 437 of file node_item.cc.
References b, NodeItem(), and to_vector().
| NodeItem blender::nodes::materialx::NodeItem::ceil | ( | ) | const |
Definition at line 261 of file node_item.cc.
References NodeItem().
| NodeItem blender::nodes::materialx::NodeItem::clamp | ( | const NodeItem & | min_val, |
| const NodeItem & | max_val ) const |
Definition at line 359 of file node_item.cc.
References convert(), create_node(), Float, min, NodeItem(), type(), type(), and value.
Referenced by clamp().
| NodeItem blender::nodes::materialx::NodeItem::clamp | ( | float | min_val = 0.0f, |
| float | max_val = 1.0f ) const |
Definition at line 376 of file node_item.cc.
References clamp(), NodeItem(), and val().
Definition at line 517 of file node_item.cc.
References Any, BLI_assert_unreachable, BSDF, CLOG_WARN, Color3, Color4, convert(), create_node(), DisplacementShader, EDF, Empty, empty(), Float, is_arithmetic(), blender::nodes::materialx::LOG_IO_MATERIALX, Material, NodeItem(), SurfaceOpacity, SurfaceShader, blender::gpu::shader::to_type(), type(), v, value, Vector2, Vector3, and Vector4.
Referenced by clamp(), blender::nodes::materialx::GroupNodeParser::compute_full(), convert(), and to_vector().
| NodeItem blender::nodes::materialx::NodeItem::cos | ( | ) | const |
Definition at line 412 of file node_item.cc.
References NodeItem(), and to_vector().
| NodeItem blender::nodes::materialx::NodeItem::cosh | ( | ) | const |
Definition at line 448 of file node_item.cc.
References NodeItem(), to_vector(), v, and val().
| NodeItem blender::nodes::materialx::NodeItem::create_input | ( | const std::string & | name, |
| const NodeItem & | item ) const |
Definition at line 929 of file node_item.cc.
References BLI_assert_unreachable, empty(), input, name, node, NodeItem(), 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 831 of file node_item.cc.
References CLOG_DEBUG, ELEM, empty(), blender::nodes::materialx::LOG_IO_MATERIALX, Material, name, node, NodeItem(), SurfaceShader, type(), type(), and blender::nodes::materialx::NodeGraph::unique_anonymous_node_name().
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 848 of file node_item.cc.
References create_node(), inputs, NodeItem(), set_input(), and type().
| NodeItem blender::nodes::materialx::NodeItem::create_output | ( | const std::string & | name, |
| const NodeItem & | item ) const |
Definition at line 946 of file node_item.cc.
References BLI_assert_unreachable, empty(), input, name, node, NodeItem(), output, type(), and type().
Referenced by blender::nodes::materialx::NodeParser::create_output().
Definition at line 292 of file node_item.cc.
References BLI_assert_unreachable, Color3, Color4, create_node(), Float, NodeItem(), to_vector(), type(), v, val(), value, Vector2, Vector3, and Vector4.
Referenced by length().
| NodeItem blender::nodes::materialx::NodeItem::empty | ( | ) | const |
Definition at line 812 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 |
Definition at line 477 of file node_item.cc.
References NodeItem(), and to_vector().
Referenced by tanh().
| NodeItem blender::nodes::materialx::NodeItem::floor | ( | ) | const |
Definition at line 256 of file node_item.cc.
References NodeItem().
| NodeItem blender::nodes::materialx::NodeItem::if_else | ( | CompareOp | op, |
| const NodeItem & | other, | ||
| const NodeItem & | if_val, | ||
| const NodeItem & | else_val ) const |
Definition at line 754 of file node_item.cc.
References b, BLI_assert_unreachable, create_node(), Empty, empty(), Eq, Float, Greater, GreaterEq, if_else(), Less, LessEq, NodeItem(), NotEq, blender::gpu::shader::to_type(), type(), type(), and value.
Referenced by if_else().
|
static |
Definition at line 116 of file node_item.cc.
References Color4, Float, and type().
Referenced by blender::nodes::materialx::GroupOutputNodeParser::compute(), blender::nodes::materialx::GroupNodeParser::compute_full(), convert(), and operator[]().
|
static |
Definition at line 482 of file node_item.cc.
References Any, Boolean, BSDF, Color3, Color4, DisplacementShader, EDF, ELEM, Empty, Filename, Float, Integer, Material, Multioutput, SOCK_BOOLEAN, SOCK_FLOAT, SOCK_INT, SOCK_RGBA, SOCK_SHADER, SOCK_STRING, SOCK_VECTOR, String, SurfaceOpacity, SurfaceShader, blender::gpu::shader::to_type(), Vector2, Vector3, and Vector4.
Referenced by blender::nodes::materialx::DefaultMaterialNodeParser::NodeParser().
| NodeItem blender::nodes::materialx::NodeItem::length | ( | ) | const |
Definition at line 266 of file node_item.cc.
References create_node(), dotproduct(), Float, NodeItem(), sqrt(), to_vector(), and value.
Referenced by normalize().
| NodeItem blender::nodes::materialx::NodeItem::ln | ( | ) | const |
Definition at line 462 of file node_item.cc.
References NodeItem(), and to_vector().
Definition at line 287 of file node_item.cc.
References b, and NodeItem().
Definition at line 282 of file node_item.cc.
References b, and NodeItem().
| NodeItem blender::nodes::materialx::NodeItem::mix | ( | const NodeItem & | val1, |
| const NodeItem & | val2 ) const |
Definition at line 339 of file node_item.cc.
References BLI_assert, BSDF, create_node(), EDF, ELEM, Float, NodeItem(), blender::gpu::shader::to_type(), type(), val(), and value.
| NodeItem blender::nodes::materialx::NodeItem::normalize | ( | ) | const |
Definition at line 274 of file node_item.cc.
References create_node(), length(), NodeItem(), to_vector(), value, and Vector3.
| blender::nodes::materialx::NodeItem::operator bool | ( | ) | const |
| bool blender::nodes::materialx::NodeItem::operator!= | ( | const NodeItem & | other | ) | const |
Definition at line 246 of file node_item.cc.
References NodeItem().
Definition at line 178 of file node_item.cc.
References b, and NodeItem().
Definition at line 154 of file node_item.cc.
References b, BLI_assert_unreachable, BSDF, Color3, create_node(), EDF, ELEM, empty(), Float, NodeItem(), type(), and type().
Definition at line 126 of file node_item.cc.
References b, BLI_assert_unreachable, BSDF, create_node(), EDF, ELEM, empty(), NodeItem(), type(), and type().
| NodeItem blender::nodes::materialx::NodeItem::operator- | ( | ) | const |
Definition at line 149 of file node_item.cc.
References NodeItem(), and val().
Definition at line 144 of file node_item.cc.
References b, and NodeItem().
Definition at line 173 of file node_item.cc.
References b, and NodeItem().
| bool blender::nodes::materialx::NodeItem::operator== | ( | const NodeItem & | other | ) | const |
Definition at line 222 of file node_item.cc.
References Empty, node, NodeItem(), blender::gpu::shader::to_type(), and value.
| NodeItem blender::nodes::materialx::NodeItem::operator[] | ( | int | index | ) | const |
Definition at line 189 of file node_item.cc.
References BLI_assert, BLI_assert_unreachable, Color3, Color4, create_node(), Float, is_arithmetic(), NodeItem(), type(), v, val(), value, Vector2, Vector3, and Vector4.
Definition at line 184 of file node_item.cc.
References b, and NodeItem().
| NodeItem blender::nodes::materialx::NodeItem::rotate | ( | const NodeItem & | angle, |
| const NodeItem & | axis ) |
Definition at line 381 of file node_item.cc.
References angle(), BLI_assert, create_node(), Float, NodeItem(), type(), type(), and Vector3.
Referenced by rotate().
| NodeItem blender::nodes::materialx::NodeItem::rotate | ( | const NodeItem & | angle_xyz, |
| bool | invert = false ) |
Definition at line 391 of file node_item.cc.
References invert(), NodeItem(), rotate(), val(), x, y, and z().
| void blender::nodes::materialx::NodeItem::set_input | ( | const std::string & | in_name, |
| const NodeItem & | item ) |
Definition at line 859 of file node_item.cc.
References BLI_assert_unreachable, Boolean, CLOG_WARN, Color3, Color4, Float, input, Integer, blender::nodes::materialx::LOG_IO_MATERIALX, node, NodeItem(), 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 node, T, type(), and value.
Referenced by create_node(), and set_input().
| NodeItem blender::nodes::materialx::NodeItem::sign | ( | ) | const |
Definition at line 472 of file node_item.cc.
References NodeItem().
| NodeItem blender::nodes::materialx::NodeItem::sin | ( | ) | const |
Definition at line 407 of file node_item.cc.
References NodeItem(), and to_vector().
| NodeItem blender::nodes::materialx::NodeItem::sinh | ( | ) | const |
Definition at line 442 of file node_item.cc.
References NodeItem(), to_vector(), v, and val().
| NodeItem blender::nodes::materialx::NodeItem::sqrt | ( | ) | const |
Definition at line 467 of file node_item.cc.
References NodeItem(), and to_vector().
Referenced by length().
| NodeItem blender::nodes::materialx::NodeItem::tan | ( | ) | const |
Definition at line 417 of file node_item.cc.
References NodeItem(), and to_vector().
| NodeItem blender::nodes::materialx::NodeItem::tanh | ( | ) | const |
Definition at line 454 of file node_item.cc.
References b, exp(), NodeItem(), to_vector(), and v.
| NodeItem blender::nodes::materialx::NodeItem::to_vector | ( | ) | const |
Definition at line 733 of file node_item.cc.
References BLI_assert_unreachable, Color3, Color4, convert(), empty(), Float, NodeItem(), 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 817 of file node_item.cc.
References Empty, node, output, type(), and value.
Referenced by add_output(), clamp(), convert(), create_input(), create_node(), create_output(), if_else(), operator*(), operator+(), operator[](), rotate(), set_input(), set_input(), to_vector(), type(), and blender::nodes::materialx::NodeGraph::unique_node_name().
|
static |
Definition at line 16 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(), blender::nodes::materialx::GroupInputNodeParser::compute(), blender::nodes::materialx::GroupOutputNodeParser::compute(), blender::nodes::materialx::GroupInputNodeParser::compute_full(), blender::nodes::materialx::GroupOutputNodeParser::compute_full(), create_input(), create_node(), create_node(), create_output(), dotproduct(), if_else(), is_arithmetic(), mix(), operator*(), operator+(), rotate(), set_input(), type(), and ~NodeItem().
|
static |
Definition at line 71 of file node_item.cc.
References Any, BLI_assert_unreachable, Boolean, BSDF, Color3, Color4, DisplacementShader, EDF, Filename, Float, Integer, Material, Multioutput, String, SurfaceOpacity, SurfaceShader, type(), Vector2, Vector3, and Vector4.
Definition at line 148 of file node_item.h.
References data, NodeItem(), T, and 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 55 of file node_item.h.
Referenced by blender::nodes::materialx::GroupInputNodeParser::compute_full(), create_input(), create_output(), blender::nodes::materialx::NodeGraph::get_input(), operator bool(), and set_input().
| MaterialX::NodePtr blender::nodes::materialx::NodeItem::node |
Definition at line 54 of file node_item.h.
Referenced by add_output(), create_input(), create_node(), create_output(), blender::nodes::materialx::NodeGraph::get_node(), operator bool(), operator==(), set_input(), set_input(), blender::nodes::materialx::NodeGraph::set_output_node_name(), blender::nodes::materialx::NodeParser::texcoord_node(), and type().
| MaterialX::OutputPtr blender::nodes::materialx::NodeItem::output |
Definition at line 56 of file node_item.h.
Referenced by add_output(), blender::nodes::materialx::GroupNodeParser::compute(), blender::nodes::materialx::GroupOutputNodeParser::compute_full(), create_output(), blender::nodes::materialx::NodeGraph::get_output(), operator bool(), set_input(), and type().
| MaterialX::ValuePtr blender::nodes::materialx::NodeItem::value |
Definition at line 53 of file node_item.h.
Referenced by clamp(), blender::nodes::materialx::GroupInputNodeParser::compute(), blender::nodes::materialx::GroupOutputNodeParser::compute(), convert(), dotproduct(), if_else(), length(), mix(), normalize(), operator bool(), operator==(), operator[](), set_input(), set_input(), type(), val(), and ~NodeItem().