Age | Commit message (Collapse) | Author |
|
Use a shorter/simpler license convention, stops the header taking so
much space.
Follow the SPDX license specification: https://spdx.org/licenses
- C/C++/objc/objc++
- Python
- Shell Scripts
- CMake, GNUmakefile
While most of the source tree has been included
- `./extern/` was left out.
- `./intern/cycles` & `./intern/atomic` are also excluded because they
use different header conventions.
doc/license/SPDX-license-identifiers.txt has been added to list SPDX all
used identifiers.
See P2788 for the script that automated these edits.
Reviewed By: brecht, mont29, sergey
Ref D14069
|
|
The strings in the `get_description` functions for operators need
translation, they are not found by the translation system automatically,
and there is no translation applied afterwards either (as far as I could
tell). Some used `N_` before, but most did nothing.
Differential Revision: https://developer.blender.org/D14011
|
|
Includes use of memcpy to avoid warnings about deprecated members.
|
|
Use "filepath" which is the current convention for naming full paths.
- Main use "name" which isn't obviously a file path.
- BlendFileData & FileGlobal used "filename" which is often
used for the name component of a path (without the directory).
|
|
|
|
|
|
The `ASSET_OT_bundle_install` operator only works when the blend file is
self-contained. It reports any external dependencies. Before this patch:
- every dependency was mentioned, even when it repeated the same
filename over and over again, and
- multiple dependencies were all mentioned in the error popup,
potentially filling the screen.
This is now resolved by:
- only reporting each external file once, and
- referring to the console when there are multiple external dependencies.
Reviewed by: severin, dfelinto
Differential Revision: https://developer.blender.org/D13413
|
|
This includes adjustment of rBc12d8a72cef5 to the new path traversal code
introduced in rBe5e8db73df86.
|
|
Add flag to `BKE_bpath_traverse_id()` and friends to skip weak
references (see below). This makes a distinction between "this blend
file depends on that file" and "this blend file references that file,
but doesn't directly use its data". This distinction is for the Asset
Bundle install operator, which refuses to copy the blend file when it's
not self-contained.
Weak references are those that are not directly used by the blend file,
but are still present to allow path rewriting. For example, when an
Asset is loaded its originating blend file is saved in
`ID::library_weak_reference`; this reference is purely for deduplication
purposes, and not for actually loading any data.
Reviewed by: mont29, brecht
Differential Revision: https://developer.blender.org/D13412
|
|
|
|
The main goal of this refactor is to make BPath module use `IDTypeInfo`,
and move each ID-specific part of the `foreach_path` looper into their
own IDTypeInfo struct, using a new `foreach_path` callback.
Additionally, following improvements/cleanups are included:
* Attempt to get better, more consistent namings.
** In particular, move from `path_visitor` to more standard `foreach_path`.
* Update and extend documentation.
** API doc was moved to header, according to recent discussions on this
topic.
* Remove `BKE_bpath_relocate_visitor` from API, this is specific
callback that belongs in `lib_id.c` user code.
NOTE: This commit is expected to be 100% non-behavioral-change. This
implies that several potential further changes were only noted as
comments (like using a more generic solution for
`lib_id_library_local_paths`, addressing inconsistencies like path of
packed libraries always being skipped, regardless of the
`BKE_BPATH_FOREACH_PATH_SKIP_PACKED` `eBPathForeachFlag` flag value,
etc.).
NOTE: basic unittests were added to master already in
rBdcc500e5a265093bc9cc.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D13381
|
|
This is the same fix as in rBde35a90f9f56d3ff3ac80c13bf1ae296853ba877
but for the blender-v3.0-release branch.
|
|
|
|
Asset install bundle poll didn't check the space it was running in and
assumed that it was always running in file browser.
|
|
In rBdcdbaf89bd11, I introduced a new operator
(`file.asset_library_refresh()`) to handle Asset Browser refreshing more
separate from File Browser refreshing. However, there already was
`asset.asset_list_refresh()`, which at this point only works for asset
view templates, but was intended to cover the Asset Browser case in
future too. This would happen once the Asset Browser uses the asset list
design of the asset view template.
So rather than having two operators for refreshing asset library data,
have one that just handles both cases, until they converge into one.
This avoids changes to the Python API in future (deprecating/changing
operators).
Differential Revision: https://developer.blender.org/D13239
|
|
In rBdcdbaf89bd11, I introduced a new operator
(`file.asset_library_refresh()`) to handle Asset Browser refreshing more
separate from File Browser refreshing. However, there already was
`asset.asset_list_refresh()`, which at this point only works for asset
view templates, but was intended to cover the Asset Browser case in
future too. This would happen once the Asset Browser uses the asset list
design of the asset view template.
So rather than having two operators for refreshing asset library data,
have one that just handles both cases, until they converge into one.
This avoids changes to the Python API in future (deprecating/changing
operators).
Differential Revision: https://developer.blender.org/D13239
|
|
|
|
Fix clang-tidy warnings introduced by a recent commit on the release
branch.
No functional changes.
|
|
|
|
Add an operator "Copy to Asset Library" for installing asset bundles
into already-existing asset libraries.
The operator is shown when:
- the "Current File" library is selected,
- the blend file name matches `*_bundle.blend`, and
- the file is not already located in an asset library.
The user can select a target asset library, then gets a "Save As"
dialogue box to select where in that library the file should be saved.
This allows for renaming, saving in a subdirectory, etc.
The Asset Catalogs from the asset bundle are merged into the target
asset library.
The operator will refuse to run when external files are referenced. This
is not done in its poll function, as it's quite an extensive operator
(it loops over all ID datablocks).
Reviewed by: Severin
Differential Revision: https://developer.blender.org/D13312
|
|
Also move system includes first, like we have it elsewhere in Blender.
|
|
Adding a catalog should also activate it, like we do it for adding other
data in Blender. The tree-view code will make sure the newly added item
will not have collapsed parents.
|
|
|
|
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 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
|
|
|
|
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.
|
|
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
|
|
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.
|
|
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()`.
|