[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4541] trunk/py/scripts/addons/ node_efficiency_tools.py: Fix in 'Merge Nodes' to prevent creating cyclic dependencies when nodes to be marged are linked between one another .
Bartek Skorupa
bartekskorupa at bartekskorupa.com
Sun May 19 14:41:21 CEST 2013
Revision: 4541
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4541
Author: bartekskorupa
Date: 2013-05-19 12:41:21 +0000 (Sun, 19 May 2013)
Log Message:
-----------
Fix in 'Merge Nodes' to prevent creating cyclic dependencies when nodes to be marged are linked between one another.
Modified Paths:
--------------
trunk/py/scripts/addons/node_efficiency_tools.py
Modified: trunk/py/scripts/addons/node_efficiency_tools.py
===================================================================
--- trunk/py/scripts/addons/node_efficiency_tools.py 2013-05-18 06:57:59 UTC (rev 4540)
+++ trunk/py/scripts/addons/node_efficiency_tools.py 2013-05-19 12:41:21 UTC (rev 4541)
@@ -19,7 +19,7 @@
bl_info = {
'name': "Nodes Efficiency Tools",
'author': "Bartek Skorupa",
- 'version': (2, 30),
+ 'version': (2, 31),
'blender': (2, 6, 7),
'location': "Node Editor Properties Panel (Ctrl-SPACE)",
'description': "Nodes Efficiency Tools",
@@ -300,7 +300,12 @@
last_add = nodes[count_before]
# add links from last_add to all links 'to_socket' of out links of first selected.
for fs_link in first_selected.outputs[0].links:
- links.new(last_add.outputs[0], fs_link.to_socket)
+ # Prevent cyclic dependencies when nodes to be marged are linked to one another.
+ # Create list of invalid indexes.
+ invalid_i = [n[0] for n in (selected_mix + selected_math + selected_shader)]
+ # Link only if "to_node" index not in invalid indexes list.
+ if fs_link.to_node not in [nodes[i] for i in invalid_i]:
+ links.new(last_add.outputs[0], fs_link.to_socket)
# add link from "first" selected and "first" add node
links.new(first_selected.outputs[0], nodes[count_after - 1].inputs[first])
# add links between added ADD nodes and between selected and ADD nodes
More information about the Bf-extensions-cvs
mailing list