Linking materials and node groups

Similar to Blender Internal, Cycles materials can be linked from libraries. Every blend file containing linkable assets can be a library.

Linking materials is really useful practice. Let's say you have 20 different blend files with objects using an iron shader, and at a certain point of your workflow, you need to modify this iron material in all the files. By having this material linked in all the 20 files from a single blend, it is possible to update all of them at once by modifying just one shader in the library file (as you know, a linked material reflects the properties of the library material and cannot be edited, differently from an appended material that is local to the file where it has been imported from the library file).

Start Blender, go to the File menu in the left part of the main header, and select Link, or press Ctrl + Alt + O. Then perform the following steps:

  1. Browse to the directory where you store your library files. Select the blend file you want to link the material from; for example, try the provided 9931OS_02_library.blend file.
  2. Browse inside the blend structure, where the linkable assets are divided into subdirectories, shown as folders named Scene, Mesh, Material, NodeTree, Object, and so on. Note that the various folders appear only if the corresponding asset to be linked actually exists inside the blend file.
  3. Click on the Material subdirectory. Once inside it, select the material you want to link (for example, Brainy_blue) and press Enter to confirm (or click on the Link/Append from Library button in the top-right corner), as shown in the following screenshot:
    How to do it...

    Linking assets through the Blender interface

  4. Now click on the Material datablock button on the toolbar of the Node Editor window and select the name of the linked material—the material labeled with a LF prefix; L is for linked and F is for fake user.
  5. This is because, in the library file, we assigned the fake user to the material by clicking on the F icon on the side of the material name data block. If not assigned to any fake user, the prefix of the linked material would have been L0, that is, linked and zero fake users inside the blend file (for example, Plane is simply assigned to the object and has no fake user).

    The name of the material is grayed to show that it is a linked material. On the side of the name, a new icon has appeared (a little arrow), and the number of users has been updated to 2 (the fake user and the object we assigned the linked material to).

From now on, every modification we make to the material in the library will be reflected in the linked material the moment we load the file.

Not only whole materials but also single node groups can be linked. In this case, instead of the Material subdirectory to link from, choose the NodeTree subdirectory and then select one or more node groups you want to link.

The data block name of a linked node group is grayed as well. You can modify the exposed values and colors, and you can also enter Edit Mode, but that's all. You can't modify the connection or the nodes inside the linked node group. To do this, you have to click on the little arrow icon to the side of the grayed name to make it local and no longer linked from the library file. This would mean that from now on, you have a new independent node group, and that editing the node group in the library won't have any effect on it any more.

A very useful add-on to help in node management is the Node Wrangler add-on. It allows for effects such as quick material visualization, node switching, UV layer assignment, frame assignments, node arrangements, and so on. To find out more about this add-on, go to http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Nodes/Node_Wrangler.

To enable it, just call the Blender User Preferences panel (press Ctrl + Alt + U) and click on the Node tab under the Categories item. Enable the Node Wrangler (aka Node Efficiency Tools) add-on by clicking on the checkbox to the right. Then click on the Save User Settings button to the bottom-left corner of the panel.