节点组

../../../_images/interface_controls_nodes_groups_example.png

节点组示例。

Grouping nodes can simplify a node tree by hiding away complexity and reusing repetitive parts.

Conceptually, node groups allow you to treat a set of nodes as though it were just one node. They’re similar to functions in programming: they can be reused (even in different node trees) and can be customized by changing their “parameters.”

As an example, say you created a “Wood” material that you would like to have in different colors. One way of doing this would be to duplicate the entire material for every color, but if you did that, you’d have to go over all those copies again if you later wanted to change the density of the grain lines. Instead, it would be better to move the nodes that define the wood look into a node group. Each material can then reuse this node group and just supply it with a color. If you then later want to change the grain line density, you only have to do it once inside the node group, rather than for every material.

Node groups can be nested (that is, node groups can contain other node groups).

Note

所有节点系统都禁止递归节点组以防止无限递归。节点组永远不能包含自身。

界面

When a node group is created, new Group Input and Group Output nodes are generated to represent the data flow into and out of the group. Furthermore connections to input sockets coming from unselected nodes will become attached to new sockets on the Group Input node. Similarly, outgoing connections to input sockets of unselected nodes will become attached to the new Group Output node.

If you want to pass an additional parameter into the group, a socket must be added to the Group Input node. To do this, drag a connection from the hollow socket on the right side of the Group Input node to the desired input socket on the node requiring an input. The process is similar for the Group Output regarding data you want to be made available outside the group.

侧栏

参考

面板

Sidebar ‣ Group ‣ Inputs, Sidebar ‣ Group ‣ Outputs

../../../_images/interface_controls_nodes_groups_interface-panel.png

用于编辑节点组的界面。

The Sidebar lets you add, remove, reorder, and edit the sockets of the group’s input and output nodes.

名称

The name of the socket to display in the node’s interface.

提示

The message displayed when hovering over socket properties. Currently only supported for Geometry Node Editor.

默认

The value to use when nothing is connected to the socket.

最小值,最大值

The minimum and maximum value for the UI button shown in the node interface. Note, this is not a minimum or maximum for the data that can pass through the node. If a socket passes a higher value than the maximum, it will still pass into the node unchanged.

隐藏值

Hide the socket value even when the socket is not connected.

编辑节点组

参考

菜单

节点 ‣ 编辑组

标题栏

进入父级节点树

快捷键

Tab, Ctrl-Tab

With a node group selected, press Tab to move into it and see its content. Press Tab again (or Ctrl-Tab) to leave the group and go back to its parent, which could be the top-level node tree or another node group. You can refer to the breadcrumbs in the top left corner of the node editor to see where you are in the hierarchy.

../../../_images/render_cycles_optimizations_reducing-noise_glass-group.png

展开后的节点组示例。

制作节点组

参考

菜单

节点 ‣ 创建组

快捷键

Ctrl-G

To create a node group, select the nodes you want to include, then press Ctrl-G or click Group ‣ Make Group. A node group will have a green title bar. All selected nodes will now be contained within the node group. Default naming for the node group is “NodeGroup”, “NodeGroup.001” etc. There is a name field in the node group you can click into to change the name of the group. Change the name of the node group to something meaningful.

When appending node groups from one blend-file to another, Blender does not make a distinction between material node groups or composite node groups. So it is recommended to use some naming convention that will allow you to distinguish between the two types.

Tip

The “Add” menu of each node editor contains an “Output” category with node types such as “Material Output.” These node types should not be confused with the “Group Output” node found in node groups, and should not be used in node groups either (only in the top-level node tree).

拆散

参考

菜单

Node ‣ Ungroup

快捷键

Ctrl-Alt-G

Removes the group and places the individual nodes into your editor workspace. No internal connections are lost, and now you can link internal nodes to other nodes in your workspace.

分离 P

将所选节点与节点组分开。

  • 复制

    复制到父级节点树,并保持节点组完好。

    移动

    从组中删除,移动至父级节点树。

插入节点组

参考

菜单

Node ‣ Group Insert

Selecting a set of nodes, ending with the destination group node, and pressing Node ‣ Group Insert will move those nodes into that group. The moved nodes are collected into a group of their own to preserve their connection context, having their own group input and output nodes. The group’s existing input and output nodes are updated with new sockets, if any, from the new nodes. The node group must be edited to contain a single Group Input and a single Group Output node.

Reusing Node Groups

参考

菜单

Add ‣ Group

快捷键

Shift-A

Existing node groups can be placed again after they’re initially defined, be it in the same node tree or a different one. It’s also possible to import node groups from a different blend-file using File ‣ Link/Append.