Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-09-11 06:48:49 +0300
committerHans Goudey <h.goudey@me.com>2021-09-11 06:48:49 +0300
commitcb833138633e1c402c87115e504c492a12451810 (patch)
tree1d89905d270e7938796b1ce39918242bf2904e2a /source/blender/nodes/NOD_socket_declarations.hh
parenteab26f13347dca6f14cf961d755b987dcad404fa (diff)
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.
Diffstat (limited to 'source/blender/nodes/NOD_socket_declarations.hh')
-rw-r--r--source/blender/nodes/NOD_socket_declarations.hh14
1 files changed, 14 insertions, 0 deletions
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;