数据块

任何 Blender 项目的基本单元都是数据块。数据块的例子包括:网格(meshes)、物体(objects)、材质(materials)、纹理(textures)、节点树(node-trees)、场景(scenes)、文本(texts)、笔刷(brushes),甚至是工作区(Workspaces)。

../_images/files_data-blocks_outliner-blender-file-view.png

Blender 文件的大纲视图。

一个数据块是不同类型数据的一种通用抽象,具有一组共同的基本特征、属性和行为。

通用特性:

  • 各种数据块是组成 .blend 文件的主要内容。

  • 可以互相关联,以便于重复利用和实例化。(父/子、物体/物体数据,材质/图像,以及修改器和约束等方式)

  • 对于同一个 .blend 文件中的给定的数据块类型,其名字是唯一的。

  • 允许添加、删除、修改和复制。

  • 数据块能在文件之间相互关联(仅限部分数据块)。

  • 可以有自己的动画数据。

  • 他们可以有自定义属性

用户通常会与更高级别的数据类型(物体、网格等)进行交互。在执行更复杂的项目时,管理数据块变得更加重要,尤其是在相互关联 blend 文件时。主要的编辑器是大纲

并非 Blender 中的每个数据都是数据块,例如骨骼、序列片段或顶点组就不是数据块,它们分别从属于骨架、场景和网格类型。

数据块类型

../_images/files_data-blocks_id-types.png

数据块类型及其图标。

这里有一张表格,列出了 .blend 文件中存储的数据类型,仅供参考。

关联

库关联,支持关联到其他 .blend 文件中。

打包

文件打包,支持将文件内容打包到 blend 文件中( 适用于大多数没有文件引用的数据块)。

类型

关联

打包

描述

动作(Action)

存储动画函数曲线。用作数据块动画数据和非线性动画编辑器。

骨架(Armature)

用于网格变形的骨架。作为骨架物体的数据,并由骨架修改器使用。

笔刷

在雕刻和绘制模式中用作笔刷资产。

摄像机

用于相机物体的数据。

缓存文件(Cache File)

用于网格缓存修改器。

曲线(Curve)

用作曲线、字体和曲面物体的数据。

字体(Font)

引用的字体文件。用于文本物体的曲线数据块。

蜡笔(Grease Pencil)

2D/3D sketch data used by Grease Pencil objects. Used as overlay helper info, by the 3D Viewport, Image, Sequencer & Movie Clip editors.

集合(Collection)

对场景中的物体进行分组和组织。用于物体实例化和库关联。

图像(Image)

图像文件。用于着色节点和纹理。

形态(Shape Keys)

Geometry shape storage, which can be animated. Used by mesh, curve, and lattice objects.

灯光

用作灯光物体的数据。

关联库(Library)

外部 blend 文件的引用。可从大纲视图的 Blender 文件 视图访问。

线条样式(Line Style)

用于 FreeStyle 渲染引擎。

晶格

基于栅格的晶格变形。用作晶格物体的数据,并由晶格修改器使用。

遮罩(Mask)

二维动画遮罩曲线。用于合成节点和序列片段。

材质(Material)

Set shading and texturing render properties. Used by objects, meshes & curves.

融球(Metaball)

An isosurface in 3D space. Used as data of metaball objects.

网格(Mesh)

由顶点/边/面构成的几何体,用作网格物体的数据。

影片剪辑(Movie Clip)

对图像序列或视频文件的引用。在 影片剪辑 编辑器中使用。

节点树(Node Tree)

可复用的节点组。在节点编辑器中使用。

物体(Object)

场景中具有位置、缩放和旋转功能的实体。由场景和集合使用。

绘制曲线(Paint Curve)

存储绘制或雕刻笔画。从绘制工具访问。

调色板(Palette)

存储颜色预设。可从绘图工具中访问。

粒子(Particle)

粒子设置。用于粒子系统。

光照探头

帮助在 EEVEE 中实现复杂的实时照明。

场景(Scene)

Primary store of all data displayed and animated. Used as top-level storage for objects & animation.

声音(Sounds)

引用至声音文件。用作扬声器物体的数据。

扬声器

3D 场景的音源。作为扬声器的物体数据。

文本(Text)

文本数据,用于 Python 脚本和 OSL 着色器。

纹理(Texture)

2D/3D 纹理。用于笔刷和修改器。

窗口管理器(Window Manager)

Blender 所有用户界面的总管理器。包括工作区、通知系统、操作符和键位映射。

世界环境

定义全局渲染环境的设置项。

工作区(Workspace)

界面布局。用于每个有各自工作区的窗口。

生命周期

每个数据块都有其使用计数(引用计数),当有多个数据块时,您可以在界面中其名称右侧看到数据块的当前用户数。Blender 遵循一般规则,即未使用的数据最终被删除。

由于在工作时添加和删除大量数据是很常见的,因此这样做的好处是不必手动管理每个数据块。这通过在写入 blend 文件时跳过零用户数据块来实现。

保护

由于零用户的数据块不会被保存,但有时你可能想要强制保留这些数据,而无需关心其使用者。

如果要构建一个 blend 文件作为要关联到其他文件和从其他文件关联的资产库,则需要确保它们不会意外地从库文件中删除。

要保护数据块,请使用其名称旁边带有盾牌图标的按钮。然后,Blender 将永远不会静默删除数据块,但如果需要,您仍然可以手动删除它。

命名 & 重命名

Data-blocks names are unique within their namespace. A data-block namespace is defined by its type, and the blendfile it is stored in.

This means that there can be for example an Object and a Mesh named the same, but there cannot be two local objects named the same in a blendfile. However, it is possible to have one local and several linked Objects sharing the same name.

Data-block names have a fixed length of 63 bytes, i.e. 63 basic ASCII characters, or less when using diacritics or non-latin glyphs (the UTF8 encoding will then typically use more than a byte per character).

When Blender has to name a new data-block, or rename an existing one, it will check for name collisions. If a data-block with the same name already exists, the (re)named data-block will get a numeric extension added as a post-fix to its 'root name', like e.g. .001. The first available index is used (up to the 999 value, after that the postfix index values are simply incremented until no collision happen anymore).

In case adding the numeric suffix would make the data-block name too long, the root name part will be shortened as needed.

Blender will never rename another data-block when doing automatic naming. So e.g. when adding a new Cube object and there are already Cube and Cube.001 local objects, the new one will be named Cube.002.

Local data-blocks can be renamed by the user in several places in the UI (like the ID selection widget, or the Outliner view). When renamed from the UI, the behavior in case of name collision is as follow:

  • If the original root name is different than in the new requested name, the renamed data-block gets the first available numerical suffix.

    • E.g. assuming that there are three objects named Sphere, Cube and Cube.001, renaming Sphere to Cube will rename the data-block to Cube.002.

  • If the original root name is the same as in the new requested name, the renamed data-block gets the requested name, and the conflicting of data-block is renamed accordingly.

    • E.g. assuming that there are three objects named Sphere, Cube and Cube.001, renaming Cube.001 to Cube will rename the data-block to Cube, and the other data-block to Cube.001.

共享

数据块可以在其他数据块之间共享。

常见共享数据情形如下:

  • 材质之间共享贴图。

  • 物体(实例)间共享网格数据。

  • 物体间共享动画动作,比如让所有的灯光同时变暗。

数据块可以在文件之间共享,见关联库

生成单用户

在多个用户之间共享数据块时,可以通过单击其名称右侧的用户计数按钮为指定的用户生成数据块的副本。这会复制该数据块并将新创建的副本分配给这个用法。

Note

物体具有一组更高级的操作,可以成为单用户,请参阅其文档

删除数据块

生命周期中所述,当数据块不再使用时,通常会将其删除。它们也可以被手动 取消关联删除

取消关联数据块意味着其用户将不再使用它。这可以通过单击数据块名称旁边的 “X” 图标来实现。如果您取消与所有用户的关联数据块,则最终将被 Blender 删除,如上所述(除非它是受保护的)。

删除数据块将直接从 .blend 文件中删除它,自动将其与所有用户断开连接。这可以通过在其名称旁边的 “X” 图标上点击 Shift-LMB 来实现。

Warning

删除某些数据块可能会导致某些用户被删除,如果没有这些数据块这些用户将无效。常见的例子比如删除物体数据(如网格、曲线、摄像机……)也将删除使用它的所有物体。

这两种操作也可以在上下文菜单中使用 RMB - 单击 大纲视图 中的数据块。