[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4491] trunk/py/scripts/addons/ node_efficiency_tools.py: In 'Merge Nodes' when first selected node is linked to anything - last added merging node will be linked to the same sockets .
Bartek Skorupa
bartekskorupa at bartekskorupa.com
Fri Apr 26 18:08:20 CEST 2013
Revision: 4491
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4491
Author: bartekskorupa
Date: 2013-04-26 16:08:19 +0000 (Fri, 26 Apr 2013)
Log Message:
-----------
In 'Merge Nodes' when first selected node is linked to anything - last added merging node will be linked to the same sockets. This gives possibility to kind of 'insert' merges into existing noodle.
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-04-26 12:31:19 UTC (rev 4490)
+++ trunk/py/scripts/addons/node_efficiency_tools.py 2013-04-26 16:08:19 UTC (rev 4491)
@@ -19,7 +19,7 @@
bl_info = {
'name': "Nodes Efficiency Tools",
'author': "Bartek Skorupa",
- 'version': (2, 25),
+ 'version': (2, 26),
'blender': (2, 6, 6),
'location': "Node Editor Properties Panel (Ctrl-SPACE)",
'description': "Nodes Efficiency Tools",
@@ -294,8 +294,14 @@
count_adds = i + 1
count_after = len(nodes)
index = count_after - 1
+ first_selected = nodes[nodes_list[0][0]]
+ # "last" node has been added as first, so its index is count_before.
+ 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)
# add link from "first" selected and "first" add node
- links.new(nodes[nodes_list[0][0]].outputs[0], nodes[count_after - 1].inputs[first])
+ links.new(first_selected.outputs[0], nodes[count_after - 1].inputs[first])
# add links between added ADD nodes and between selected and ADD nodes
for i in range(count_adds):
if i < count_adds - 1:
@@ -304,7 +310,7 @@
links.new(nodes[index].inputs[second], nodes[nodes_list[i + 1][0]].outputs[0])
index -= 1
# set "last" of added nodes as active
- nodes.active = nodes[count_before]
+ nodes.active = last_add
for i, x, y in nodes_list:
nodes[i].select = False
More information about the Bf-extensions-cvs
mailing list