From cb833138633e1c402c87115e504c492a12451810 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Fri, 10 Sep 2021 22:48:49 -0500 Subject: Nodes: Add vector min/max support to new socket builder API Also use it to fix an incorrect min and max in the cube mesh primitive node. --- source/blender/nodes/NOD_socket_declarations.hh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source/blender/nodes/NOD_socket_declarations.hh') diff --git a/source/blender/nodes/NOD_socket_declarations.hh b/source/blender/nodes/NOD_socket_declarations.hh index 1a5873c37b5..11352111356 100644 --- a/source/blender/nodes/NOD_socket_declarations.hh +++ b/source/blender/nodes/NOD_socket_declarations.hh @@ -102,6 +102,8 @@ class Int : public SocketDeclaration { class Vector : public SocketDeclaration { private: float3 default_value_ = {0, 0, 0}; + float soft_min_value_ = -FLT_MAX; + float soft_max_value_ = FLT_MAX; PropertySubType subtype_ = PROP_NONE; public: @@ -117,6 +119,18 @@ class Vector : public SocketDeclaration { return *this; } + Vector &min(const float min) + { + soft_min_value_ = min; + return *this; + } + + Vector &max(const float max) + { + soft_max_value_ = max; + return *this; + } + bNodeSocket &build(bNodeTree &ntree, bNode &node, eNodeSocketInOut in_out) const override; bool matches(const bNodeSocket &socket) const override; bNodeSocket &update_or_build(bNodeTree &ntree, bNode &node, bNodeSocket &socket) const override; -- cgit v1.2.3