Age | Commit message (Collapse) | Author |
|
Since writing asset catalogs to disk also means loading any on-disk
changes, it's a good idea to store an undo step.
|
|
Both material and world assets should be ready to use as non-experimental
feature. They were not enabled by default yet because the work from the
previous commit was needed first.
Objects should follow soon.
Maniphest Task: https://developer.blender.org/T91752
|
|
Updates UI code so that we can enable the asset UI for specific data-block
types by default, i.e. irrespective of the "Extended Asset Browser"
experimental feature.
"Mark as Asset" and "Clear Asset" are always visible in the Outliner context
menu now, but are grayed out if not applicable and show a disabled hint in the
tooltip.
A known side-effect of this: The "Mark as Asset" and "Clear Asset" operators
are enabled for action data-blocks now, even though only pose actions created
through the Pose Libraries add-on are supported. If this is something worth
addressing is being discussed still.
Differential Revision: https://developer.blender.org/D12955
Reviewed by: Sybren Stüvel
|
|
If the current file is saved within an asset library, showing that asset
library in the Asset Browser will also display the assets from this current
file now. In fact, it's the latest state of the open file, including all
unsaved modifications.
These assets will show a little Blender icon in the preview image, which is our
usual icon for current file data.
Note that this means an important design change: The "Current File" asset
library isn't the only place to edit assets from anymore. From now on assets
from the current file can also be edited in the context of the full asset
library. See T90193 for more info.
Technical info:
Besides just including the assets from the current `Main`, this requires
partial clearing and reading of file-lists, so that asset operations (e.g.
removing an asset data-block) doesn't require a full reload of the asset
library.
Maniphest Task: https://developer.blender.org/T90193
|
|
If the Extended Asset Browser experimental feature was disabled, the asset
catalog operators wouldn't work. This wasn't intentional, catalogs aren't
considered experimental.
|
|
No longer save asset catalogs on blendfile save. Instead:
- extend the confirmation prompt for unsaved changes to show unsaved
catalogs.
- In the confirmation prompt, make catalog saving explicit & optional,
just like we do it for external images. {F10881736}
- In the Asset Browser catalog tree, show an operator icon to save the
catalogs to disk. It's grayed out if there are no changes to save, or
if the .blend wasn't saved yet (required to know where to save the
catalog definitions to). {F10881743}
Much of the work was done by @Severin and reviewed by me, then we
swapped roles.
Reviewed By: Severin
Differential Revision: https://developer.blender.org/D12796
|
|
When using `asset_mark` function from a Python script and afterwards
updating the preview image, a crash might happen. The preview image is
generated by the `asset_mark` function. This may happen on a background
thread, introducing potential synchronization issues.
This patch fixes this by separating the preview generation
`ID.asset_generate_preview` from the mark as asset `ID.asset_mark`.
Note: this separation of "mark as asset" and "generate preview" also
applies to the `ED_asset_mark_id()` C function; if it is desired to have
previews rendered after marking as asset, a call to
`ED_asset_generate_preview()` is now also required.
Reviewed By: sybren
Maniphest Tasks: T91197
Differential Revision: https://developer.blender.org/D12922
|
|
Feedback was that the two column menu felt odd, and that the "Custom" and
"Built-in" headings for each column were more confusing than helpful. So
changing this to a single column menu with separator lines instead of headings.
|
|
Remove `BLI_assert_unreachable()` in a spot that is actually easily
reachable. To reach, follow these steps:
- Configure three asset libraries (say A, B, and C) in preferences
- Set the asset browser to library C and save the file
- Remove asset library C from the preferences
- Reopen the file.
|
|
|
|
This confirmation popup was added when deletion was a destructive action that
would be written to disk immediately, with no way to undo. Now we only write
such changes to disk on .blend file save, plus there's undo/redo support for
catalog edits now. In such cases confirmation popups should be avoided.
|
|
Mark the `ASSET_OT_catalog_undo_push` operator as internal, as it's not
meant for artists to use directly.
|
|
Send notifiers to redraw the catalog tree after undo/redo.
|
|
Ensure that catalog operations create an undo snapshot, and show
undo/redo operators in the asset browser.
A hidden operator `ASSET_OT_catalog_undo_push` is also added such that
add-ons can also set undo snapshots if they need.
|
|
Recursively delete asset catalogs with `AssetCatalogService:prune_...`
functions. This deletes the catalog and all of its children.
The old `delete_catalog` function has been renamed to
`delete_catalog_by_id()`, and is now a lower-level function (no deletion
of children, no rebuilding of the tree). The `prune_catalogs_by_path()`
and `prune_catalogs_by_id()` do delete children and do rebuild the
catalog tree.
Manifest task: T91634
|
|
The pointer was referenced before being checked.
|
|
The `CatalogPath` name was an alias for `std::string`, so that it could
be easily switched over to something else. This happened in the previous
commit (switched to `AssetCatalogPath`), so the alias is no longer
necessary.
This commit removes the `CatalogPath` alias.
No functional changes.
|
|
So far we have used `std::string` for asset catalog paths. Some
operations are better described on a dedicated class for this, though.
This commits switches catalog paths from using `std::string` to a
dedicated `blender::bke::AssetCatalogPath` class.
The `using CatalogPath = AssetCatalogPath` alias is still there, and
will be removed in a following cleanup commit.
New `AssetCatalogPath` code reviewed by @severin in D12710.
|
|
This makes asset view templates, e.g. as used by the Pose Library add-on
use recursive asset loading, see
Also works around an issue that made assets not show up at all anymore
since fc7beac8d6f4. I'm creating a separate report for that regression,
but in the Asset Browser and Viewer it shouldn't be apparent currently.
|
|
Was using `NAME_MAX` which is defined in `limits.h`, which again may be
implicitly included by the compiler. Intend was to use the Blender
define `MAX_NAME`.
|
|
The Asset Browser now displays a tree with asset catalogs in the left
sidebar.
This replaces the asset categories. It uses the new UI tree-view API
(https://wiki.blender.org/wiki/Source/Interface/Views#Tree-View).
Buttons are displayed for adding and removing of catalogs. Parent items
can be collapsed, but the collapsed/uncollapsed state is not stored in
files yet.
Note that edits to catalogs (e.g. new or removed catalogs) are only
written to the asset library's catalog definition files when saving a
.blend.
In the "Current File" asset library, we try to show asset catalogs from
a parent asset library, or if that fails, from the directory the file is
stored in. See adaf4f56e1ed.
There are plenty of TODOs and smaller glitches to be fixed still. Plus a
UI polishing pass should be done.
Important missing UI features:
* Dragging assets into catalogs (WIP, close to being ready).
* Renaming catalogs
* Proper handling of catalogs in the "Current File" asset library
(currently not working well).
The "Current File" asset library is especially limited still. Since this
is the only place where you can assign assets to a catalog, this makes
the catalogs very cumbersome in general. To assign an asset to a
catalog, one has to manually copy the Catalog ID (a random hash like
number) to the asset metadata through a temporary UI in the Asset
Browser Sidebar. These limitations should be addressed over the next few
days, they are high priority.
Differential Revision: https://developer.blender.org/D12670
|
|
The Clear Asset operator (`ASSET_OT_clear`) now clears the Fake User.
This makes it symmetrical with the Mark Asset (`ASSET_OT_mark`)
operator, which sets Fake User to ensure assets are always saved to
disk.
Clear Asset now also has a `set_fake_user` boolean option, which allows
users to Clear Asset and set Fake User in one go.
The asset browser now shows these options in the context menu:
- Clear Asset: also clears Fake User. This makes it possible to actually
remove assets from the blend file without leaving the Asset Browser.
- Clear Asset (Set Fake User): keeps the Fake User bit set. This makes
it possible to "hide" the asset from the asset browser, without
loosing the actual data.
Internally, the `ED_asset_clear_id(id)` function now always clears the
Fake User bit. If it was intended that this bit was kept set, it's up to
the caller to explicitly call `id_fake_user_set(id)` afterwards.
Manifest Task: T90844
Reviewed By: Severin
Differential Revision: https://developer.blender.org/D12663
|
|
Until now, the asset catalogs would only show up after all assets from
the library were loaded. Now the catalogs are read first, which makes
them appear pretty much immediately. This makes the UI more responsive
and feel less heavy.
I added a dedicated file-list type for asset libraries now. While not
necessarily needed, I prefer that so asset library specific stuff can be
handled in there.
|
|
|
|
|
|
Idea for 3.0 is to disable all functionality that isn't well polished
and focus on those parts first. Starting with poses.
* Adds a new experimental option "Extended Asset Browser", replacing
"Asset Browser".
* Unlike the previous option, this isn't enabled by default anymore.
This didn't work well in practice and caused plenty of confusion.
* "Mark as Asset" and "Clear Asset" are hidden if the option is
disabled.
* Same for the category selection in the Asset Browser.
* Always show display the "Only Assets" option in the File Browser while
browing inside .blend files. That way you can hide data-blocks that
are not pose assets.
* The Asset Library setup UI in the Preferences is always visible now,
it's needed for pose library access.
Addresses T90181, T90180 and T90300.
Differential Revision: https://developer.blender.org/D12120
|
|
In the `FileList` struct, rename the `AssetLibraryReference
*asset_library` field to `asset_library_ref` -- it's a description of
which asset library is used, and not the asset library itself.
This is to make space for a future `AssetLibrary *asset_library` field,
which will point to an actual asset library struct/class.
No functional changes.
Reviewed by: Severin
Differential Revision: https://developer.blender.org/D12151
|
|
|
|
This naming change was agreed on during the asset workshop. See
https://code.blender.org/2021/06/asset-browser-workshop-outcomes/#terms-definitions.
|
|
|
|
Before this, all asset view templates showing the same asset library
would show the same assets, even if they should show different ID types.
That was a major limitation since the design did forsee that this
template can be put anywhere in the UI to display various sub-sets of
assets.
Initially I did the ID type filtering close to the asset-list reading,
because I wanted to optimize reading so that we would only actually read
asset information from disk of the ID type to be shown. But this will be
quite complex and I'm not sure if I'll get to work on this anytime soon.
So this commit moves the filtering to the template display level solving
this limitation.
Note: This also adds the code to filter by tags, together with the ID
type. But it's not actually used anywhere yet.
|
|
This iterator was introduced before `AssetHandle` existed, so it was
dealing with the file data directly. Now we want as little code as
possible to deal with the file data, all access should happen via the
`AssetHandle`.
|
|
Was mixing 4 and 2 space indent in a single file.
|
|
When using "Clear Asset" from the Asset Browser but with an asset
selected that is not stored in the current file, we can show a more
informative error message.
|
|
|
|
|
|
I'm trying to move away from general files with lots of things in them,
and instead have many small & focused files. I find that easier to
work with since everything has clear responsibilities, even if there is
some minor overhead in managing all these files.
I also try to differentiate more clearly between public and internal
files. So source files and internal headers are in a `intern/`
sub-directory, public functions are in a number of headers one level
higher.
For convenience and to make this compatible with our existing general
headers in `editors/include`, I made the `ED_asset.h` there include all
these public headers.
This is of course a bit of an experiment, let's see how it works in
practice.
Also corrected the name of `ED_asset_can_make_single_from_context()`.
|
|
This was an open TODO, I wanted to have code for translating asset
library references from and to enum values in a central place, and
access that in the same way from both the Asset Browser and the
Workspace RNA code.
* Adds own file for the related functions.
* Adds doxygen comments.
* Updates RNA callbacks to properly use these functions.
* Let these functions call each other, avoid duplicating logic.
|
|
Since recently it's possible to access assets from outside the
File/Asset Browser, via the asset view template. So we are slowly
moving away from file space specific code to dedicated asset system
code. I introduced `AssetLibraryReference` as a duplicate of
`FileSelectAssetLibraryUID`, with a plan to delete the latter in a
separate cleanup commit. That's exactly what this commit is.
This will cause Asset Browsers to open with the default "Current File"
Asset Library. We could avoid that, but it's a minor issue really.
|
|
|
|
For this to work, the utility function needs to be callable without
context, which is only needed for a File Browser specific hack anyway
(doesn't apply to this usage of it).
|
|
Keeps files minimal and focused. I much prefer that over having all
kinds of stuff in general files like `asset_edit.cc`.
|
|
While the asset-handle design is supposed to be temporary (see
35affaa971cf), I prefer keeping the fact that it's nothing but a file
entry pointer an implementation detail that is abstracted away. So this
introduces getters for the file data we typically access for
asset-handles.
|
|
Although currently only the asset list code uses the asset library
reference wrapper, it can stand on its own and may be used in more
places in the future. So I prefer to give it its own source & header
file.
Also removed unused includes, added proper namespaces as per our C++
style guidelines, and removed an unnecessary TODO comment.
|
|
|
|
|
|
This is an editor-level abstraction for the `BLO_library_temp_xxx()`
API for temporary loading of data-blocks from another Blend file. It
abstracts away the asset specific code, like asset file-path handling
and local asset data-block handling.
Main use-case for this is applying assets as presets that are based on
data-blocks, like poses. Such preset assets are an important part of the
asset system design, so such an abstraction will likely find more usage
in the future.
|
|
Implements a basic, WIP version of the asset list. This is needed to
give the asset view UI template asset reading and displaying
functionality.
See:
* Asset System: Data Storage, Reading & UI Access - https://developer.blender.org/T88184
Especially the asset list internals should change. It uses the
File/Asset Browser's `FileList` API, which isn't really meant for access
from outside the File Browser. But as explained in T88184, it does a lot
of the stuff we currently need, so we (Sybren Stüvel and I) decided to
go this route for now. Work on a file-list rewrite which integrates well
with the asset system started in the `asset-system-filelist` branch.
Further includes:
* Operator to reload the asset list.
* New `bpy.types.AssetHandle.get_full_library_path()` function, which
gets the full path of the asset via the asset-list.
* Changes to preview loading to prevent the preview loading job to run
eternally for asset views. File Browsers have this issue too, but
should be fixed separately.
|
|
With temporary I mean that this is not intended to be part of the
eventual asset system design. For that we are planning to have an
`AssetRepresentation` instead, see T87235. Once the `AssetList` is
implemented (see T88184), that would be the owner of the asset
representations.
However for the upcoming asset system, asset browser, asset view and
pose library commits we need some kind of asset handle to pass around.
That is what this commit introduces.
Idea is a handle to wrap the `FileDirEntry` representing the asset, and
an API to access its data (currently very small, will be extended in
further commits). So the fact that an asset is currently a file
internally is abstracted away. However: We have to expose it as file in
the Python API, because we can't return the asset-handle directly there,
for reasons explained in the code. So the active asset file is exposed
as `bpy.context.asset_file_handle`.
|
|
This per-workspace active asset library will be used by the asset views
later. Note that Asset Browsers have their own active asset library,
overriding the one from the workspace.
As part of this the `FileSelectAssetLibraryUID` type gets replaced by
`AssetLibraryReference` which is on the asset level now, not the
File/Asset Browser level. But some more work is needed to complete that,
which is better done in a separate commit.
This also moves the asset library from/to enum-value logic from RNA to
the editor asset level, which will later be used by the asset view.
|