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:
Diffstat (limited to 'source/blender/nodes/NOD_node_declaration.hh')
-rw-r--r--source/blender/nodes/NOD_node_declaration.hh21
1 files changed, 20 insertions, 1 deletions
diff --git a/source/blender/nodes/NOD_node_declaration.hh b/source/blender/nodes/NOD_node_declaration.hh
index af2130ec452..113e8ffc93d 100644
--- a/source/blender/nodes/NOD_node_declaration.hh
+++ b/source/blender/nodes/NOD_node_declaration.hh
@@ -95,6 +95,7 @@ class SocketDeclaration {
bool compact_ = false;
bool is_multi_input_ = false;
bool no_mute_links_ = false;
+ bool is_unavailable_ = false;
bool is_attribute_name_ = false;
bool is_default_link_socket_ = false;
@@ -185,12 +186,23 @@ class SocketDeclarationBuilder : public BaseSocketDeclarationBuilder {
decl_->description_ = std::move(value);
return *(Self *)this;
}
+
Self &no_muted_links(bool value = true)
{
decl_->no_mute_links_ = value;
return *(Self *)this;
}
+ /**
+ * Used for sockets that are always unavailable and should not be seen by the user.
+ * Ideally, no new calls to this method should be added over time.
+ */
+ Self &unavailable(bool value = true)
+ {
+ decl_->is_unavailable_ = value;
+ return *(Self *)this;
+ }
+
Self &is_attribute_name(bool value = true)
{
decl_->is_attribute_name_ = value;
@@ -288,10 +300,13 @@ class NodeDeclarationBuilder {
/**
* All inputs support fields, and all outputs are fields if any of the inputs is a field.
- * Calling field status definitions on each socket is unnecessary.
+ * Calling field status definitions on each socket is unnecessary. Must be called before adding
+ * any sockets.
*/
void is_function_node(bool value = true)
{
+ BLI_assert_msg(declaration_.inputs().is_empty() && declaration_.outputs().is_empty(),
+ "is_function_node() must be called before any socket is created");
declaration_.is_function_node_ = value;
}
@@ -476,6 +491,10 @@ inline typename DeclType::Builder &NodeDeclarationBuilder::add_socket(StringRef
socket_decl->name_ = name;
socket_decl->identifier_ = identifier.is_empty() ? name : identifier;
socket_decl->in_out_ = in_out;
+ if (declaration_.is_function_node()) {
+ socket_decl->input_field_type_ = InputSocketFieldType::IsSupported;
+ socket_decl->output_field_dependency_ = OutputFieldDependency::ForDependentField();
+ }
declarations.append(std::move(socket_decl));
Builder &socket_decl_builder_ref = *socket_decl_builder;
builders_.append(std::move(socket_decl_builder));