Doc:2.6/Manual/Data System

提供: wiki
移動先: 案内検索

Data System

Each .blend file contains a database. This database contains all scenes, objects, meshes, textures, etc. that are in the file. A file can contain multiple scenes and each scene can contain multiple objects. Objects can contain multiple materials which can contain many textures. It is also possible to create links between different objects.

The Blender data system makes it easy to quickly create and reuse data of all sorts. Blender data is stored in various types of datablocks which each represent a different data element, such as materials, meshes, and images. Each datablock is stored independently of any other datablock, but each datablock can use other datablock types, ie. mesh data references material data which can reference texture data which can reference image data. Datablocks are not exclusively designated to any other data.

Links and Users

Datablocks are connected to other data via links. If Data A References Data B, Then Data A is said be be a user of Data B. Data controls for materials look like this:

The Material Data Controls

The rectangle at the top (green) is the list of indices of materials. A mesh may refer to multiple materials, each with its own index. The +/- (red) buttons will add or remove material indices from the current mesh data. The switches (blue) specify the material type.

The field highlighted yellow is the main data control; similar ones can be found in other data panels. The far left button shows an icon representing a material datablock, and pressing it will open the list of materials. Pressing an item in this list will change the current link to point to the chosen data. The text field shows the name of the datablock, and allows it to be changed. The number to the right of that is the user count; it will appear if a datablock has more than one user. Pressing it will create a duplicate piece of data that has only 1 user. The F button will toggle a fake user for that datablock. Pressing the X will unlink data from the user, while the + will create a new datablock.

Deleting Data

Datablocks within Blender are stored even if they have no users, but they will not be saved in the file when you perform a save operation, so will not be recoverable after you save and close your file. This is how data is deleted, except for image datablocks, which must have no users for 2 save and reopen operations. A way to keep user-less data in the file, even after save operations, is to give this data a fake user before unlinking it. This will create a virtual user that doesn't really exist in the scene, and the data will not be dropped upon save.

Mode: All Modes, Any Window

Hotkey: ⇧ ShiftF4 - Data Select Browser

To access the database, press ⇧ ShiftF4 and the window will change to a Data Select Browser window, which lists the Objects in your .blend file. To go up a level, click the breadcrumbs (..) and then you will see the overall structure of a file: Action, Armature, Brush, Camera, Curve, Group, and so on (including Objects).

LMB Template-LMB.png selecting any datablock type, Mesh, for example, will give you a listing of the meshes used in the file, along with how many users there are for each one. For example, if you had a car mesh, and used that car mesh for six cars in a parking lot scene, the Mesh listing would show the Car and then the number 6.

Mode: Data Select Browser

Hotkey: F - Fake User

RMB Template-RMB.png selecting certain kinds of datablocks (Materials, Images, Textures…) and pressing F will assign a “fake user” to those datablocks. With a fake user in place, Blender will keep those datablocks in the file, even if they have no “real user”. Datablocks without a user, real or fake, are not saved in the .blend file. Pressing F again toggles the fake user assignment. Performing this action is the same as clicking the F button next to material/image/… names.

Outliner and OOPS Schematic

You can easily inspect the contents of your file by using the Outliner window. This window displays the Blender data system (fully documented here). This window offers two views of the database. The Outliner view allows you to do simple operations on the objects. These operations include selecting, renaming, deleting and linking. The OOPS Schematic (Object-Oriented Programming System) view allows you to easily see how datablocks are linked. You can filter the view by using buttons found in the header.

Users (Sharing)

Many datablocks can be shared among other datablocks - re-use is encouraged. For example, suppose you have a material for one object, named “Glossy”. You can select a second object, for example, one that does not have a material yet. Instead of clicking ADD NEW for the material, click the little up-down arrow next to the ADD NEW, which brings up a list of existing materials. Select “Glossy”. Now, these two objects share the same material. You will notice a “2” next to the name of the material, indicating that there are two users (the two objects) for this material. Other common examples include:

  • Sharing textures among materials.
  • Sharing meshes between objects (“clones”).
  • Sharing Ipo curves between objects, for example to make all the lights dim together.


Fake User

Remember that Blender does not save datablocks that are not linked to anything in the current file. If you're building a ".blend" file to serve as a library of things that you intend to link-to from other files, you'll need to make sure that they don't accidentally get deleted from the current (the library) file. Do this by giving the datablocks a "fake user," by hitting the F button next to the name of the datablock. This prevents the user count from ever becoming zero: therefore, the datablock will not be deleted. (Blender does not keep track of how many other files link to this one.)

Copying and Linking Objects Between Scenes

Sometimes you may want to link or copy objects between scenes. This is possible by first selecting objects you want to link or copy and then using the Make Links and Make Single User items found in Object menu in the 3D viewport header. Use Make Links to make links between scenes. To make a plain copy, you first make a link and then use Make Single User to make a stand-alone copy of the object in your current scene. Further information on working with scenes can be found here.

Appending or Linking Across Files

The content of one .blend file is easily accessed and put into your current file by using the File → Append function (accessed at any time by ⇧ ShiftF1). To find out more about how to copy or link objects across .blend files, click here.

Proxy Objects

Proxy objects allow you to make (parts of) linked data local. For example, this allows an animator to make a local “copy” of the handler bones of a character, without having the actual rig duplicated. This is especially useful for character animation setups, where you want the entire character to be loaded from an external library, but still permit the animator to work with poses and actions. Another example: you can have a modeler working on the shape (mesh) of a car and another painter working on the materials for that car. The painter cannot alter the shape of the car, but can start working with color schemes for the car. Updates made to the shape of the car are applied automatically to the painter’s proxy.

Pack and Unpack Data

Blender has the ability to encapsulate (incorporate) various kinds of data within the .blend file that is normally saved outside of the .blend file. For example, an image texture that is an external .jpg file can be put “inside” the .blend file via File → External Data → Pack into .blend file. When the .blend file is saved, a copy of that .jpg file is put inside the .blend file. The .blend file can then be copied or emailed anywhere, and the image texture moves with it.

You know that an image texture is packed because you will see a little “Christmas present gift box” displayed in the header.

Unpack Data

When you have received a packed file, you can File → External Data → Unpack into Files.... You will be presented with the option to create the original directory structure or put the file in the // (directory where the .blend file is). Use “original locations” if you will be modifying the textures and re-packing and exchanging .blend files, so that when you send it back and the originator unpacks, his copies of the textures will be updated.