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:
authorJacques Lucke <jacques@blender.org>2021-11-04 16:44:21 +0300
committerJacques Lucke <jacques@blender.org>2021-11-04 16:44:21 +0300
commitbe4478d1f8b6c75b50c951f02cf0116f78e68d6d (patch)
tree605122f23a1c7fb2c08d33c0d83aa42f2c550c90 /source/blender/nodes/NOD_node_declaration.hh
parentff4959eeaa5368d79f15d482da6576a1ccba5dca (diff)
Fix T92814: improve automatic linking when inserting Float Curve node
This solves the issue in a more general that can also be used to solve similar issues for other nodes in the future. Nodes can specify their "main" socket in their declaration so that we don't have to rely on heuristics. Differential Revision: https://developer.blender.org/D13108
Diffstat (limited to 'source/blender/nodes/NOD_node_declaration.hh')
-rw-r--r--source/blender/nodes/NOD_node_declaration.hh13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/nodes/NOD_node_declaration.hh b/source/blender/nodes/NOD_node_declaration.hh
index 1481e69c00e..e9f2996bb30 100644
--- a/source/blender/nodes/NOD_node_declaration.hh
+++ b/source/blender/nodes/NOD_node_declaration.hh
@@ -89,6 +89,7 @@ class SocketDeclaration {
bool is_multi_input_ = false;
bool no_mute_links_ = false;
bool is_attribute_name_ = false;
+ bool is_default_link_socket_ = false;
InputSocketFieldType input_field_type_ = InputSocketFieldType::None;
OutputFieldDependency output_field_dependency_;
@@ -107,6 +108,7 @@ class SocketDeclaration {
StringRefNull description() const;
StringRefNull identifier() const;
bool is_attribute_name() const;
+ bool is_default_link_socket() const;
InputSocketFieldType input_field_type() const;
const OutputFieldDependency &output_field_dependency() const;
@@ -171,6 +173,12 @@ class SocketDeclarationBuilder : public BaseSocketDeclarationBuilder {
return *(Self *)this;
}
+ Self &is_default_link_socket(bool value = true)
+ {
+ decl_->is_default_link_socket_ = value;
+ return *(Self *)this;
+ }
+
/** The input socket allows passing in a field. */
Self &supports_field()
{
@@ -363,6 +371,11 @@ inline bool SocketDeclaration::is_attribute_name() const
return is_attribute_name_;
}
+inline bool SocketDeclaration::is_default_link_socket() const
+{
+ return is_default_link_socket_;
+}
+
inline InputSocketFieldType SocketDeclaration::input_field_type() const
{
return input_field_type_;