Page MenuHome

Tools speeding up creating node setups
Closed, ArchivedPublic

Description

Project: Blender Extensions
Tracker: Py Scripts Release
Blender: 2.66
Script name: node_efficiency_tools.py
Homepage: bartekskorupa.com
Wiki page: http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Nodes/Nodes_Efficiency_Tools
Author(s): Bartek Skorupa
Category: Compositing
SVN Download: https://svn.blender.org/svnroot/bf-extensions/trunk/py/scripts/addons/node_efficiency_tools.py
Status: Open

Set of several tools that speed up working with nodes.

- Merge selected nodes using mix nodes, math nodes or mix/add shaders.
- Batch change blend type, math operation
- Align nodes
- Copy properties from active to selected nodes
- Add Image texture setup
- Add switches to outputs of selected nodes with automatic labels additions
- Relink from Render Layer to OpenEXR MultiLayer input image and vice versa

Event Timeline

Added Wiki Page and ChangeLog page. All Keyboard shortcuts and instructions included there. Add-On has received very good response from users who downloaded and tested it. Please check thread on blenderartists: http://blenderartists.org/forum/showthread.php?274755-Compositing-Nodes-Efficiency-Tools

One week using this addon, and I'm asking myself how did I composite without it. Could save you easily 30% of your time working with nodes. Great job!

Updated to version 1.5:
Changelog entry:
UI changes, automatic output type detection to use proper nodes for merging, copy label option added, code cleanup, few minor keyboard shortcut changes

version 1.51

This is in fact kind of "a" version. Just a small fix in menus.

version 1.6

Improved behavior of "Align Nodes". Takes nodes' width and height into account.

version 1.7

bug fix: When copying nodes' settings some links were breaking. It's fixed now.

version 1.8

some poll functions corrected and "Add Texture Setup" operator improvements.

This add-on was a God-send, please make it official. I also will be very thankful if this add-on enable by default..

Regards

+1 this add on is a super time saver for a lot of daily basic operations. I definitely hope to see it as an official one!

+1 again. This add-on is wonderful. Please include this in official releases.
To the developer, great job! I only have one suggestion: when doing node alignment, would it be possible to only change the nodes' position opposite of the alignment. For example, when aligning horizontally, would it be possible to only change the nodes' vertical position? Currently, it changes the horizontal too; it spaces them evenly apart. This throws off previous alignments.
Again, this add-on is great! Awesome job. It's now on of the add-ons I will always add to my inventory.

If you simply want to align nodes let's say horizontally without evenly distributing them you can use standard blender's tools. Simply press S, Y, 0 - and you're done.
Because this behavior can be easily achieved without my Add On I didn't include it into the tool.

version 1.9

Changes in "Link Active to Selected". Links are made to first of the input sockets that have the same type as output. If none of input sockets of selected node has the same time - link is made to first socket.
At the moment "Link Active to Selected" always overrides existing links. I intend to change this behavior. Now I'm testing some possibilities trying to find good balance between amount of possibilities and simplicity for the user.

Can we use bracket key to select node inside frame? also why I need to select all node inside frame to copy paste (ctrl+c, ctrl+v) or duplicate (shift+d), i suggest to only select frame to duplicate the whole frame with node inside. The frame behavior is similiar like parent in 3D viewport IMO, I've made a quick tip about this in here, https://www.youtube.com/watch?v=l5JY8wJPoB8. Can we apply the same key to frame node selection?

Regards

version 2.0

Added option to select nodes inside frame (children) or select "parent", i.e. frame(s) that the nodes are attached to. Keyboard shortcuts - '[ - select "parent", ']' - select "children".
This doesn't deselect selected nodes, but it adds to selection.

thanks a lot, this is time-saver :D

version 2.0.01

Added menu items for selecting parent / children to "select" menu in node editor.

One of the users spotted an issue. Add-On doesn't work properly inside node groups. I will investigate this and try to fix it.

version 2.0.02

Fixed issue from previous post. Now everything works fine even when we are editing nodes inside node group.
Additionally fixed behavior of "Align Nodes". Previously when aligning nodes - unexpected shift appeared. It's been fixed in this version.

version 2.0.03

Immediate update due to mistake I made in previous version.
When trying to fix behavior inside groups I have set some testing functions incorrectly. This resulted in very weird behavior in some cases. It's been fixed now.

version 2.0.04

Change axes in "Align Nodes". Now Vertically means that nodes are "scaled" down to zero along Y axis and Horizontally - nodes scale down to zero along X axis.
This change is a result of discussion with users who pointed that such behavior is more logical

Great changes to a very usefull script. This makes large repetitive node construction much easier and allows you to create clean tidy node layouts. Much better for others to understand. I believe that that is a goal of Blender.org? That is education of users.

sent code review
https://codereview.appspot.com/7235078/

version 2.0.05

Addressed most of issues pointed in code review. Thank you Campbell. I have doubts about two suggestions and I have given comments here: https://codereview.appspot.com/7235078/

version 2.0.06

Keymap items handling corrected according to: http://www.blender.org/documentation/blender_python_api_2_65_9/info_tutorial_addon.html#keymap
Works as expected. When I tested this solurion earlier I must have made some mistakes. This is where my doubts came from.

Hi Bartek, checked the updated script and LGTM.
+1 to commit into contrib.

Moved from Py Scripts Upload to Py Scripts Contrib

version 2.0.07:

- "Add Switches to outputs" changed to "Add Reroutes to Outputs" (new shortcut - SLASH)
- "Add Reroutes to Outputs" added options to add to all or only to loose outputs.
- Added - "Swap Reroutes and Switches" (Shift-S) - change reroutes to switches and vice-verca.
- Changed "Copy Label" - new options: "from active", "from node", "from socket" (Shift-C)
- Added "Clear Label" (Alt-L)
- Merge Nodes change - now new merging node added even of only one node selected

Code Clean Up:
- Made use of new available attributes - 'node.width', 'output.links', 'input.links'
(classes affected: NodesCopySettings)

version 2.0.08:

- Updates needed to match API changes. When adding nodes - different way of identifying nodes' types needed.
WARNING: Doesn't work with previous versions of Blender including official 266a release.

2. Marge Nodes: Ctrl-0 merges all selected nodes except Shaders using 'Mix' node with 'Mix' blend type.
3. When nodes with mixed output types are selected - 'Mix' nodes will be used (doesn't apply to SHADERS).

version 2.0.09:

Additional keyboard shortcuts for merging nodes, changing blend types or operations.
The goal was to allow to use not only numpad keys, but regular keys as well.
In 'Add Reroutes to Outputs' - now it's possible to use numpad slash and regular slash.

version 2.0.10:

Code clean up. No functional changes.
- change names of some properties of classes.
- replacing EnumProperties with StringProperties.
- Changes in some menus, adding new menus to match new classes properties.
- Different handling of keymap items. Because of large number of keymap items - their properties wrapped in tuples.

version 2.0.11:
In LinkActiveToSelected:
- change name of variable to more meaningful name.

In ReroutesSwitchesSwap:
- Bug fix - When swapping nodes not linked to anything - error occured. Now it's fixed.

version 2.0.12:
Added several options and changed some keyboard shortcuts:

Swap Nodes (Shift-S):
This allows to replace selected nodes with nodes of a different type.
Previously only exchanging between 'REROUTE' and 'SWITCH' nodes were possible.
This commit adds options to change some nodes' types to:
'MIX_RGB', 'MATH, 'ALPHAOVER', 'SWITCH' and 'REROUTE'.
I'm planning to add option to change shaders to other shaders.

Link Active To Selected (Shift-F, Ctrl-Shift-F, Alt-F):
This allows to link active node to all selected nodes.
It's possible to link without replacing existing links (Shift-F). First input of the same type as active node's output will be linked if it's free.
To replace existing links - use (Ctrl-Shift-F).
This behavior is similiar to standard (F) or (Ctrl-F), but links active to selected instead of basing on nodes' location.
(Alt-F) will link active to selected basing on names. Menu is called and user can select option to use active node's name/label and compare it with selected nodes' names,
or base on outputs' names. This option can be useful when user decides to replace input Render Layers node with pre-rendered MultiLayerOpenEXR.

Add Reroutes to Selected Nodes' Outputs (Slash) or (Numpad Slash):
This adds 'REROUTE' nodes and links them to all outputs of selected nodes.
Option to add them to all outputs no matter if they are linked or not.
If adding reroutes to already linked outputs - newly added reroutes are inserted into link. Behaves exactly as if we dropped node onto the link.
In this function I changed spacing between newly added reroutes to match latest changes in displaying outputs of nodes. They are now a bit more apart from one another.

The addon is almost ready to go to trunk. Only one thing left to do: Adding option to swap shaders.

Wiki Page updated. All latest commits covered there. Keyboard shortcuts shown on wiki match current addon's state (ver. 2.0.12)

version 2.1.0:
Added 'Swap Shaders' option plus some minor changes.

In SwapNodes:
- added option to swap shaders.
- replaced lists with tuples when defining 'replace' variable.

General:
- minor changes in some 'for' loops


Now I consider this Add On READY.
All options that I had in mind when creating those tools have been implemented.
The last thing left to do is to update video tutorial.
Please consider including this AddOn in official releases of Blender.
I'm open to all suggestions for improving the tools.

version 2.1.1:
Fixed behavior of 'Link Active To Selected' when outputs names are used.
When relinking between Render Layers inputs and pre-rendered MultiLayerEXR - names of outputs of both types of nodes are taken.

Now it's really ready to go to TRUNK :-)

version 2.1.2:
In 'Add Reroutes to Outputs' added option 'to Linked Outputs'.

version 2.1.3
Code clean up:
Changed properties of several classes from StringProperty to EnumProperty or BoolProperty.

version 2.1.4
Code clean up after code review by Campbell Barton:
https://codereview.appspot.com/7651047/diff/1/node_efficiency_tools.py#skiplinks-148
Addressed all of the issues. I'd appreciate a final code review before moving the Add On to trunk.
Thank you Campbell for devoting some of your valuable time to look through my code.

Moved from Py Scripts Contrib to Py Scripts Release

Current version 2.20
After code cleanup by Campbell Barton Nodes Efficiency Tools committed to trunk.

Hi Bartek,

New feature in node editor (r55703), 'find' (alt+F) is clash with latest node effeciency tools, 'link active to selected'. Can you remap the key? 'L' for link option is good IMO.

Thanks and Regards.

version 2.21:
Keymap Item for LinkUseNamesMenu changed from alt-F to Shift-Alt-F.
Recent changes introduced 'Find' option and keyboard shortcut for that is 'Alt-F', so there was a conflict.

I used Shift-Alt-F to keep consistency. F key is used for making all kinds of links.
Thank you Adidia.

version 2.22:
SSS Shader added in 'Swap Shaders', shortucts conflicts addressed.
- New Subsurface Scattering Shader has been added, so Nodes Efficiency Tools 'Swap Shaders' needed to be updated to take SSS into account.
- Revision 55718 changed keyboard shortcuts for 'Find nodes' and 'Make Links with Replace'.
(Ctrl-F for 'Find Nodes' and Shift-F for 'Make Links with Replace')
Those changes caused shortcuts conflicts with Nodes Efficiency Tools 'Link Active To Selected'.
New shortcuts for 'Link Active to Selected' are as follows:
BACK_SLASH - call 'Link Active to Selected' menu
K - link to all selected, don't replace links.
Shift-K - link to all selected, replace links.
QUOTE - link to selected when node name matches, don't replace links.
Shift - QUOTE - link to selected when node name matches, replace links.
SEMI_COLON - link to selected when outputs names matche, don't replace links.
Shift - SEMI_COLON - link to selected when outputs names match, replace links.

version 2.24:
Better behavior of 'Swap Nodes'. More options passed from old node to new one.

version 2.25

Changed axes in 'Align Nodes'. Reverted unwanted change introduced when cleaning the code. Now 'Align Horizontally' is the equivelent of s -> x -> 0 with even spacing and 'Vertically': s -> y -> 0 with even spacing

2013-04-26 - ver. 2.26:
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.
2013-05-04 - ver. 2.27:
In 'Swap Nodes' when swapping shaders - sockets' default value is passed when names of old and new nodes' sockets match

Tested on trunk r56868 windows7 x64
Strange Thing: 1) Factory settings 2) enable addon 3) in 3d viewport hit spacebar and invoke "to sphere" operator and confirm 4) look at weird error in console or info panel

Thank you for this report. Fixed in Revision: 4538.
Current version: 2.30.

Hello Bartek,

In the just released version 2.67b (r57141) I get the following error in the console from your add-on (version 2.31) :

Traceback (most recent call last):
File "D:\Blender_2.67_stable\2.67\scripts\modules\addon_utils.py", line 269, in enable
mod = __import__(module_name)
File "D:\Blender_2.67_stable\2.67\scripts\addons\node_efficiency_tools.py", line 1133
):
^
SyntaxError: invalid syntax

I am running Blender (64 bit version) on Windows 7 Pro, 64bit.

Thank you in anticipation for your attention and for your very useful add-on.

Hey,

I know about this issue. It has been solved some time ago, but because of my mistake it was not included in blender 2.67b release. Sorry for that.
The version without this error is in trunk. You can get the proper version and build it into your blender 2.67b and below is the instruction how to do it:
(Please mind that you are going to change the source script, so do it only if you are not afraid of such actions. If you make mistakes you may have to install blender again)

1. Go to User Preferences, AddOns tab and find Nodes Efficiency Tools.
2. Open its panel and check the path to node_efficiency_tools.py
3. Open this file in Text Editor inside blender.
4. In the Web Browser open the current "Trunk" version of Nodes Efficiency Tools. Here is the url: https://svn.blender.org/svnroot/bf-extensions/trunk/py/scripts/addons/node_efficiency_tools.py
5. Copy all the text of the addon from the web browser.
6. In Text Editor where you have your original add on open (the one with the error), delete all of the text and paste the one copied from the web page.
7 Save this text.
8 Move the mouse away from the text editor and hit F8 to refresh add ons.
9. In Properties panel activate Nodes Efficiency Tools.

Sorry for all this inconvenience.

Thank you very much Bartek!

2.68 will have a new Cycles node - Toon BSDF. Will it be added in "Swap Shaders"?

Hi Bartek, and everyone else,
I've been working on an some personal improvements to this awesome addon, mainly for use in Cycles material nodes. I don't know if anyone else could benefit from my additions/changes, so here's a summary of what I've done:

1. Added an option not to hide mix/math nodes when they are added by the 'Merge Nodes' function
2. Mix/math nodes created by merging are now positioned between the two nodes it's merging, rather than at the bottom (with an option to use the original method)
3. Organised code a bit, making lists of shader and texture types so as to avoid duplicate code
4. Updated lists to include new shader and texture types (eg Toon)
5. Allow the use of "Add Image Texture (Ctrl+T)" on texture nodes, but instead of adding the whole setup, only add the texture coordinate and mapping nodes. All shaders except Background would get an image texture with UV coordinates (background gets environment texture with generated coords). Image texture gets UVs, procedurals get generated coordinates.
6. Force viewport render update when linking a shader to the output (it wouldn't update for some reason)
7. Created an "Emission Viewer" function - for shading in cycles, hitting the 'E' key will connect the active node to a new emission shader and connect that to the output, effectively creating a Viewer node for materials. Hitting 'E' again for the same node will connect the next output to the Emission Viewer (and if there are no more outputs, jump back to the top output). If the emission node already exists it wont be created again, simply connected to the output. Hitting 'E' on a shader node will simply connect that shader to the output (same as the existing feature 'Link to Output'). Compensates for the scene's "Film Exposure" so that white is always white and not grey or brighter.

And here's the code: https://www.dropbox.com/s/gmnty8eyt8oo0e5/node_efficiency_tools.py
You may want to use a service like diffchecker.com or text-compare.com to see exactly what's changed.

For anyone who finds this in future, I've released my code in a separate addon: http://adaptivesamples.com/node-wrangler/

I got in contact with Greg and we decided to merge the codes.

This task was automatically closed as archived as part of migration, because it was determined to be no longer active.

The authoritative list of addons is on the wiki, we no longer have a report for each addon to track bugs and updates. Bugs can be reported individually and assigned to the addon developers. See the Addons project page for more information on the workflow.

Nobody (None) closed this task as Archived.Dec 15 2012, 1:42 AM

Hi! The addon is very helpful & comfortable.
I have a proposal to add function: Node - Image Texture -> edit texture externally On my poinion, this option very need in UV/Image editor.

Hi Bartek! These tool are fantastic! But one seems missing for me. Hope it is realizable. When I drag a connection line from the output of a node to a void space, I would like that the nodes list opens, and then, when you choose the new node, it is created linked to the node from the connection started.
For example: I have a Diffuse shader node. I drag from the output a connection line and I drop it to the void space. Then the node list appears and I choose a mix node. The new mix node is created already linked to the diffuse shader node.

Hope this is not too complex. Let me now and thanks again.

Lell

some visual bug: when having diffrent blender ui dpi setting (for example 83) lazy connect inside frame node have offseted "preview frames" can post image

btw: just some idea: merge nodes:extend F6 dialog: for example after ctr+alt+0 F6 could have "Convert Premul"
I`m not convinced if its worth the coding effort since N panel node properties do the job on hidden nodes...

@Czarek Kopias (kopias):
Lazy Connect: Yes, we noticed this. Will try to fix as soon as possible.
Extended F6 dialog: This is not a bad idea. Some of us (included me) use F6 pretty heavily, so I think that it IS worth some coding effort. I will take a look at it and try to think about the possibilities.
BTW: When you go to User Prefs and open Node Wrangler you can set some preferences. One of them is that newly added "Mix" nodes (Alpha Over included) can be by default hidden or not. If you want them unhidden - you can change the setting.

Hi Bartek!

Please can you the "View Image" function reinstall (as in 3.10)
So, when I click on an Image Texture-Node, I can see the image in the UV / Image Editor.