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:
authorErik Abrahamsson <erik85>2021-10-18 12:59:49 +0300
committerJacques Lucke <jacques@blender.org>2021-10-18 12:59:49 +0300
commitf9fe755dba8e99d3b7ee1fb9b0a1197c5eb5c687 (patch)
treeb425d9a20ee43e931ebd177f29c1d4780a54ed2e /source/blender/nodes/NOD_socket_declarations.hh
parenteb0d216dc1caab515eb7cf1ef6bb1632e5ca8fae (diff)
Nodes: add default value to string socket declaration
Differential Revision: https://developer.blender.org/D12758
Diffstat (limited to 'source/blender/nodes/NOD_socket_declarations.hh')
-rw-r--r--source/blender/nodes/NOD_socket_declarations.hh26
1 files changed, 25 insertions, 1 deletions
diff --git a/source/blender/nodes/NOD_socket_declarations.hh b/source/blender/nodes/NOD_socket_declarations.hh
index e22b96cd1ff..d4958f433d6 100644
--- a/source/blender/nodes/NOD_socket_declarations.hh
+++ b/source/blender/nodes/NOD_socket_declarations.hh
@@ -145,14 +145,26 @@ class ColorBuilder : public SocketDeclarationBuilder<Color> {
ColorBuilder &default_value(const ColorGeometry4f value);
};
+class StringBuilder;
+
class String : public SocketDeclaration {
+ private:
+ std::string default_value_;
+
+ friend StringBuilder;
+
public:
- using Builder = SocketDeclarationBuilder<String>;
+ using Builder = StringBuilder;
bNodeSocket &build(bNodeTree &ntree, bNode &node, eNodeSocketInOut in_out) const override;
bool matches(const bNodeSocket &socket) const override;
};
+class StringBuilder : public SocketDeclarationBuilder<String> {
+ public:
+ StringBuilder &default_value(const std::string value);
+};
+
class IDSocketDeclaration : public SocketDeclaration {
private:
const char *idname_;
@@ -323,6 +335,18 @@ inline ColorBuilder &ColorBuilder::default_value(const ColorGeometry4f value)
/** \} */
/* -------------------------------------------------------------------- */
+/** \name #StringBuilder Inline Methods
+ * \{ */
+
+inline StringBuilder &StringBuilder::default_value(std::string value)
+{
+ decl_->default_value_ = std::move(value);
+ return *this;
+}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
/** \name #IDSocketDeclaration and Children Inline Methods
* \{ */