[Bf-blender-cvs] [96609ade045] temp-nodes-group-declarations: Merge branch 'master' into temp-nodes-group-declarations

Hans Goudey noreply at git.blender.org
Mon Jan 9 22:35:49 CET 2023


Commit: 96609ade0459393c75cd13d5d4edaf3cfac6d614
Author: Hans Goudey
Date:   Mon Jan 9 16:35:40 2023 -0500
Branches: temp-nodes-group-declarations
https://developer.blender.org/rB96609ade0459393c75cd13d5d4edaf3cfac6d614

Merge branch 'master' into temp-nodes-group-declarations

===================================================================



===================================================================

diff --cc source/blender/editors/space_node/node_relationships.cc
index 0dc51ba49ff,c3ed050e8e4..e012d7b6da4
--- a/source/blender/editors/space_node/node_relationships.cc
+++ b/source/blender/editors/space_node/node_relationships.cc
@@@ -905,22 -899,16 +899,20 @@@ static void add_dragged_links_to_tree(b
      if (!link.tosock || !link.fromsock) {
        continue;
      }
-     /* before actually adding the link,
-      * let nodes perform special link insertion handling
-      */
+     /* Before actually adding the link let nodes perform special link insertion handling. */
      bNodeLink *new_link = MEM_new<bNodeLink>(__func__, link);
      if (link.fromnode->typeinfo->insert_link) {
 -      link.fromnode->typeinfo->insert_link(&ntree, link.fromnode, new_link);
 +      if (!link.fromnode->typeinfo->insert_link(&ntree, link.fromnode, new_link)) {
 +        continue;
 +      }
      }
      if (link.tonode->typeinfo->insert_link) {
 -      link.tonode->typeinfo->insert_link(&ntree, link.tonode, new_link);
 +      if (!link.tonode->typeinfo->insert_link(&ntree, link.tonode, new_link)) {
 +        continue;
 +      }
      }
  
-     /* add link to the node tree */
+     /* Add link to the node tree. */
      BLI_addtail(&ntree.links, new_link);
      BKE_ntree_update_tag_link_added(&ntree, new_link);
  
diff --cc source/blender/nodes/NOD_node_declaration.hh
index 934e44ceed8,8a7606df777..e58c4138f40
--- a/source/blender/nodes/NOD_node_declaration.hh
+++ b/source/blender/nodes/NOD_node_declaration.hh
@@@ -300,12 -459,8 +460,13 @@@ class NodeDeclaration 
   public:
    Vector<SocketDeclarationPtr> inputs;
    Vector<SocketDeclarationPtr> outputs;
+   std::unique_ptr<aal::RelationsInNode> anonymous_attribute_relations_;
  
 +  /** Leave the sockets in place, even if they don't match the declaration. Used for dynamic
 +   * declarations when the information used to build the declaration is missing, but might become
 +   * available again in the future. */
 +  bool skip_updating_sockets = false;
 +
    friend NodeDeclarationBuilder;
  
    bool matches(const bNode &node) const;
@@@ -354,10 -523,47 +529,50 @@@ void id_or_index(const bNode &node, voi
  }  // namespace implicit_field_inputs
  
  void build_node_declaration(const bNodeType &typeinfo, NodeDeclaration &r_declaration);
 +void build_node_declaration_dynamic(const bNodeTree &node_tree,
 +                                    const bNode &node,
 +                                    NodeDeclaration &r_declaration);
  
+ template<typename SocketDecl>
+ typename SocketDeclarationBuilder<SocketDecl>::Self &SocketDeclarationBuilder<
+     SocketDecl>::reference_pass(const Span<int> input_indices)
+ {
+   aal::RelationsInNode &relations = node_decl_builder_->get_anonymous_attribute_relations();
+   for (const int from_input : input_indices) {
+     aal::ReferenceRelation relation;
+     relation.from_field_input = from_input;
+     relation.to_field_output = index_;
+     relations.reference_relations.append(relation);
+   }
+   return *(Self *)this;
+ }
+ 
+ template<typename SocketDecl>
+ typename SocketDeclarationBuilder<SocketDecl>::Self &SocketDeclarationBuilder<
+     SocketDecl>::field_on(const Span<int> indices)
+ {
+   aal::RelationsInNode &relations = node_decl_builder_->get_anonymous_attribute_relations();
+   if (decl_->in_out == SOCK_IN) {
+     this->supports_field();
+     for (const int input_index : indices) {
+       aal::EvalRelation relation;
+       relation.field_input = index_;
+       relation.geometry_input = input_index;
+       relations.eval_relations.append(relation);
+     }
+   }
+   else {
+     this->field_source();
+     for (const int output_index : indices) {
+       aal::AvailableRelation relation;
+       relation.field_output = index_;
+       relation.geometry_output = output_index;
+       relations.available_relations.append(relation);
+     }
+   }
+   return *(Self *)this;
+ }
+ 
  /* -------------------------------------------------------------------- */
  /** \name #OutputFieldDependency Inline Methods
   * \{ */



More information about the Bf-blender-cvs mailing list