Page MenuHome

Support displaying catalogs in the Current File asset library
ClosedPublic

Authored by Julian Eisel (Severin) on Sep 28 2021, 5:41 PM.

Details

Summary

When the Asset Browser shows the "Current File" asset library, it also attempts
to load an asset catalog definition file from location of the current .blend
file. This happens as follows:

  • First, see if the file is inside of an asset library that is "mounted" in the Preferences. Load the catalogs from there if so.
  • Otherwise, if the file is saved, load the catalogs from the directory the file is saved in.
  • If the file is not saved, no catalogs will be loaded.

Creating catalogs from the "Current File" asset library still doesn't work, as
the asset catalog service doesn't construct an in-memory catalog definition
file in that case yet.

Changes find_suitable_cdf_path_for_writing() to use newly added asset library
helpers, behavior shouldn't be affected (tests pass here).

Diff Detail

Repository
rB Blender

Event Timeline

Julian Eisel (Severin) requested review of this revision.Sep 28 2021, 5:41 PM
Julian Eisel (Severin) created this revision.
Sybren A. Stüvel (sybren) requested changes to this revision.Sep 28 2021, 6:11 PM

There should be some unit tests for the new functions, and the documentation is a bit of a mess (some parts of the doc of one function seem to belong to the other, missing info). Otherwise it's fine.

source/blender/blenkernel/BKE_asset_library.h
36–39

Move documentation here, and document what the return value means

source/blender/blenkernel/intern/asset_library.cc
61–62

There is no bmain in this function; this part of the comment should go with the one below.

64–65

Document whether this returns a path with a trailing slash or not. BLI_split_dir_part produces a trailing slash on the returned directory.

This revision now requires changes to proceed.Sep 28 2021, 6:11 PM

There should be some unit tests for the new functions [...]

I was thinking about unit testing these functions, but there were a few things that I was unsure about. Esp. since the functions use U and Main. I want to look at this separately, so I created D12689: Add unit tests for asset library suitable root path function.

Julian Eisel (Severin) marked 3 inline comments as done.
  • Address points from review

Improved the function documentations. They are quite lengthy but hopefully
understandable and precise now. We could consider moving them to the Wiki.

This revision was not accepted when it landed; it landed in state Needs Review.Sep 29 2021, 1:20 PM
This revision was automatically updated to reflect the committed changes.