diff options
author | Jacques Lucke <jacques@blender.org> | 2021-10-26 21:00:03 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-10-26 21:00:10 +0300 |
commit | 0bfae1b12078ef278a56c6e932c13be5bc9781aa (patch) | |
tree | 38122afad7575db55b0aafa3958af8022fe3cdde /source/blender/nodes/intern/node_socket_declarations.cc | |
parent | be3e09ecec5372f87b3e9779adb821867b062be1 (diff) |
Geometry Nodes: geometry component type warning system
Previously, every node had to create warnings for unsupported input
geometry manually. Now this is automated. Nodes just have to specify
the geometry types they support in the node declaration.
Differential Revision: https://developer.blender.org/D12899
Diffstat (limited to 'source/blender/nodes/intern/node_socket_declarations.cc')
-rw-r--r-- | source/blender/nodes/intern/node_socket_declarations.cc | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/source/blender/nodes/intern/node_socket_declarations.cc b/source/blender/nodes/intern/node_socket_declarations.cc index e823476f9e4..ed5691ebf7f 100644 --- a/source/blender/nodes/intern/node_socket_declarations.cc +++ b/source/blender/nodes/intern/node_socket_declarations.cc @@ -15,6 +15,7 @@ */ #include "NOD_socket_declarations.hh" +#include "NOD_socket_declarations_geometry.hh" #include "BKE_node.h" @@ -333,6 +334,46 @@ bool Geometry::matches(const bNodeSocket &socket) const return true; } +Span<GeometryComponentType> Geometry::supported_types() const +{ + return supported_types_; +} + +bool Geometry::only_realized_data() const +{ + return only_realized_data_; +} + +bool Geometry::only_instances() const +{ + return only_instances_; +} + +GeometryBuilder &GeometryBuilder::supported_type(GeometryComponentType supported_type) +{ + decl_->supported_types_ = {supported_type}; + return *this; +} + +GeometryBuilder &GeometryBuilder::supported_type( + blender::Vector<GeometryComponentType> supported_types) +{ + decl_->supported_types_ = std::move(supported_types); + return *this; +} + +GeometryBuilder &GeometryBuilder::only_realized_data(bool value) +{ + decl_->only_realized_data_ = value; + return *this; +} + +GeometryBuilder &GeometryBuilder::only_instances(bool value) +{ + decl_->only_instances_ = value; + return *this; +} + /** \} */ } // namespace blender::nodes::decl |