[Bf-blender-cvs] [2df06e3172d] functions: fix issue with multiple links at same socket

Jacques Lucke noreply at git.blender.org
Wed Jul 3 19:14:26 CEST 2019


Commit: 2df06e3172d2f554d343ec33a06213b4bf1387c7
Author: Jacques Lucke
Date:   Wed Jul 3 18:49:57 2019 +0200
Branches: functions
https://developer.blender.org/rB2df06e3172d2f554d343ec33a06213b4bf1387c7

fix issue with multiple links at same socket

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

M	source/blender/blenkernel/intern/node_tree.cpp
M	source/blender/blenlib/BLI_multimap.hpp

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

diff --git a/source/blender/blenkernel/intern/node_tree.cpp b/source/blender/blenkernel/intern/node_tree.cpp
index dd24d0b6f5e..240388d1e89 100644
--- a/source/blender/blenkernel/intern/node_tree.cpp
+++ b/source/blender/blenkernel/intern/node_tree.cpp
@@ -21,12 +21,13 @@ NodeTreeQuery::NodeTreeQuery(bNodeTree *btree)
   }
 
   for (bNodeLink *blink : m_links) {
-    if (!this->is_reroute(blink->fromnode)) {
+    if (!this->is_reroute(blink->fromnode) &&
+        !m_links_without_reroutes.contains(blink->fromsock)) {
       SmallVector<bNodeSocket *> others;
       this->find_connected_sockets_right(blink->fromsock, others);
       m_links_without_reroutes.add_multiple_new(blink->fromsock, others);
     }
-    if (!this->is_reroute(blink->tonode)) {
+    if (!this->is_reroute(blink->tonode) && !m_links_without_reroutes.contains(blink->tosock)) {
       SmallVector<bNodeSocket *> others;
       this->find_connected_sockets_left(blink->tosock, others);
       m_links_without_reroutes.add_multiple_new(blink->tosock, others);
diff --git a/source/blender/blenlib/BLI_multimap.hpp b/source/blender/blenlib/BLI_multimap.hpp
index 660d21dd512..c8241770b90 100644
--- a/source/blender/blenlib/BLI_multimap.hpp
+++ b/source/blender/blenlib/BLI_multimap.hpp
@@ -92,6 +92,7 @@ template<typename K, typename V, uint N = 4> class ValueArrayMap {
 
   void add_multiple_new(const K &key, ArrayRef<V> values)
   {
+    BLI_assert(!m_map.contains(key));
     for (const V &value : values) {
       this->add(key, value);
     }



More information about the Bf-blender-cvs mailing list