节点捆包

捆包 是一种容器,可将多个值组合到一个接口中。这使得通过单一链接传输多个值成为可能,类似于编程中的 结构体

捆包可减少节点组中暴露的输入和输出数量,并可包含混合数据类型,例如几何体、场、数值、物体,甚至嵌套的捆包。

../../../../_images/interface-nodes-bundle-example.png

一个立方体与柱体组合成捆包,随后又分离开来。

节点

以下节点用于处理捆包:

Bundle nodes allow adding or removing an arbitrary number of sockets, with flexible type support.

Bundles can be attached to geometry using get/set geometry bundle nodes. These can be used to pass bundled data between modifiers and objects.

Typed Bundles

A typed bundle is a bundle that contains a special Type item identifying its purpose. The type is stored as a string and allows node groups to recognize bundles without relying on their internal structure.

Using types makes bundles easier to exchange between node groups and different Geometry Nodes modifiers, since a node group can search for a specific type rather than assuming a particular bundle layout.

Bundles can also contain other bundles, allowing complex data to be organized hierarchically.

Creating Typed Bundles

The Add Typed Bundle operator creates a typed bundle by constructing a bundle containing the required Type item.

Important

The string item named Type is reserved for identifying typed bundles. It should not be used for any other purpose within a bundle.

Searching Typed Bundles

The Get Nested Bundle Paths node searches a bundle hierarchy for bundles with a matching type.

This allows node groups to locate typed bundles even when they are nested inside other bundles.

For example, a geometry may contain multiple bundles describing different components. A node group can search for all bundles of a particular type without requiring them to exist at a fixed location.

用法

捆包在许多工作流程中都很有用:

  • 简化界面 -- 将输入端整合至单个接口,提升清晰度。

  • 物理模拟 -- 将所有实体和约束打包给解算器。

  • 声明式系统 -- 存储复杂结构化数据以供后续评估。

  • 纹理集 -- 将 PBR 贴图(基础色、粗糙度、法线贴图)合并到一个接口中。

接口同步

捆包使用接口名称来匹配其输入和输出。如果两个捆包节点已连接但签名不匹配,Blender 可自动提供同步功能。

  • 节点首次连接时,同步会自动进行。

  • 现有接口不会自动更新,以避免数据覆盖。

  • 当检测到数据不匹配时,节点标题栏会显示一个 按钮(同步接口),允许手动执行同步操作。