Dev:2.5/Source/Data system/LibraryBrowser

提供: wiki
< Dev:2.5‎ | Source‎ | Data system
2018年6月29日 (金) 03:42時点におけるYamyam (トーク | 投稿記録)による版 (1版 をインポートしました)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先: 案内検索

Library Browser/Manager

Workflow

Single .blend file view

The single .blend file view was integrated in the file browser in Blender 2.49 and previous versions. It allowed to select one or several data blocks (DNA ID structs) to be linked or appended to the current scene. Options provided were:

  1. At cursor
  2. Active Layer
  3. Autosel

The single .blend file view would be shown from the append/link operator with the selected .blend file from the file browser.

First, the file browser would be invoked to select the .blend file and as soon as a .blend file is selected the new asset browser space with the single .blend file view would open.

A 'back' operator could invoke the file browser again to select another .blend file if the desired item isn't found.

(Note: this probably needs some newspace magic and needs to be tested well)

Current .blend file view

There were two ways in which the contents of the current .blend file were displayed.

One is the 'Databrowse' which was invoked when the list of items in a menu reached a certain limit. This likely can be replaced by the now present search box in the menu.

The second one is a bit hidden and was invoked with SHIFT+F4. The functionality provided was:

  1. Select data block
  2. Assign fake user to data block
  3. Replace data block (Materials and Images)

From a user perspective, the following functionality should be useful too:

  1. Rename data block

An often mentioned point is the wish to be able to delete data blocks. This contradicts how data blocks are currently handled in Blender where data is not deleted, just unlinked. A data block is 'deleted' by the fact that it is not written to the .blend file. An actual delete operation would mean that the data block needs to be first unliked from all users and then removed. This could be quite risky for a user who might not be aware of all the places a certain material is used. Possible solution that has been discussed in the past was to provide a kind of 'trash can' where unlinked objects with no users are moved to. We could then provide a way to empty this trash can.

I think that almost all of this functionality is probably better placed in the outliner.

Asset Browser view

The Asset browser view is used to manage appending and linking from several external .blend files. The main workflow is shown in the mockups below.

The main workflow would be the following:

  1. add one or several .blend files to the list of libraries by invoking the filebrowser from a button in the asset browser
  2. the contents of all the libraries are now shown and the user can select one or several datablocks from one or several libraries
  3. once selected, the data blocks can be linked or appended into the current scene

One cautionary note is that currently the Blender library system does not allow appending and linking from the same library. We need to take a look whether this can be fixed.

As for the organisation of the libraries a folder hierarchy that can be customized by the user has been thought of. I think it is necessary to be able to quickly show or hide the contents of a single library or all libraries in a user created 'folder'. The library folders just represent a logical hierarchy, and are not related in any way to physical directories on disk.

For better organisation Matt suggested to distinguish between project libraries and general libraries. This should be doable by allowing to import several asset manager blib files like the ones described below. Which files are imported could be saved with the .blend file and could in this way be specific for each project's .blend files.

Mockups

These are my original rough mockups:

Dev-assetbrowser-mockup 01.png


Dev-assetbrowser-mockup 02.png


Dev-assetbrowser-mockup 03.png


Dev-assetbrowser-mockup 04.png

William Reynish made nicer ones, merged the Groups into the Library and added a new folder buton as well as current directory to manage datablocks in the current .blend fil

Dev-Asset manager william.png

Design/Decisions

  • Asset browser integrated in outliner or own spacetype?
  • Operators should return ID Pointer or collection of ID Pointers for appending/linking?

Functionality TODO

  • Make Append/Link actual action buttons
  • Preview rendering and drawing (also for Meshes)
  • Currently blender doesn't support linking and appending from the same library

Implementation Notes

The list of directories, libraries and groups could be stored in a new file .Blibs.

An example .Blibs file could look like this: (relatively easy to parse)

[AutomaticDirs]
C:\Projects\Durian\Assets;subdirs=1
C:\Assets\Materials;subdirs=0

[Libraries]
C:\Durian\Props\stuff.blend

[Materials]
C:\Documents\Blends\Materials\ray.blend
C:\Documents\Blends\Materials\metals.blend

The steps for processing the libraries would be:

  1. scan all automatic dirs and add all .blend files to the list of libraries
  2. add the libraries in the [Libraries] section
  3. add the .blend files in the groups
  4. check the library list for duplicates in groups
  5. Open all the .blend files and read the datablock names and previews
  6. with his fill the list to show in the browser
  7. On append, Link, really open the .blend file and append/link