Age | Commit message (Collapse) | Author |
|
Asset indexing was disabled as ID property indexing wasn't supported.
Now that ID property support is added we can enable asset indexing.
Check {T91406} for more information about asset indexing.
|
|
Object/collection asset workflow would need the bounding box for snapping.
The bounding box is stored using ID properties in the scene. Currently ID properties
aren't stored in the asset index, what would break object snapping. For this reason
Asset Indexing is turned off in mater. This patch will introduce the indexing of ID
properties what will allow the indexing to be turned on again.
## Data Mapping ##
For data mapping we store the internal structure of IDProperty to the indexer (including meta-data) to be able to deserialize it back.
```
[
{
"name": ..,
"value": ..,
"type": ..,
/* `subtype` and `length` are only available for IDP_ARRAYs. */
"subtype": ..,
},
]
```
| **DNA** | **Serialize type** | **Note** |
| IDProperty.name | StringValue| |
| IDProperty.type | StringValue| "IDP_STRING", "IDP_INT", "IDP_FLOAT", "IDP_ARRAY", "IDP_GROUP", "IDP_DOUBLE"|
| IDProperty.subtype | StringValue| "IDP_INT", "IDP_FLOAT", "IDP_GROUP", "IDP_DOUBLE" |
| IDProperty.value | StringValue | When type is IDP_STRING |
| IDProperty.value | IntValue | When type is IDP_INT |
| IDProperty.value | DoubleValue | When type is IDP_FLOAT/IDP_DOUBLE |
| IDProperty.value | ArrayValue | When type is IDP_GROUP. Recursively uses the same structure as described in this section. |
| IDProperty.value | ArrayValue | When type is IDP_ARRAY. Each element holds a single element as described in this section. |
NOTE: IDP_ID and IDP_IDARRAY aren't supported. The entry will not be added.
Example
```
[
{
"name": "MyIntValue,
"type": "IDP_INT",
"value": 6,
},
{
"name": "myComplexArray",
"type": "IDP_ARRAY",
"subtype": "IDP_GROUP",
"value": [
[
{
"name": ..
....
}
]
]
}
]
```
## Considered alternatives ##
- Add conversion functions inside `asset_indexer`; makes generic code part of a specific solution.
- Add conversion functions inside `BLI_serialize`; would add data transformation responsibilities inside a unit that is currently only responsible for formatting.
- Use direct mapping between IDP properties and Values; leads to missing information and edge cases (empty primitive arrays) that could not be de-serialized.
Reviewed By: Severin, mont29, HooglyBoogly
Maniphest Tasks: T92306
Differential Revision: https://developer.blender.org/D12990
|
|
Also ensure space at end of comment.
|
|
|
|
|
|
|
|
ObjectValue was to confusing as it is the term from JSON.
|
|
Includes use of memcpy to avoid warnings about deprecated members.
|
|
Using the `MEM_*` API from C++ code was a bit annoying:
* When converting C to C++ code, one often has to add a type cast on
returned `void *`. That leads to having the same type name three times
in the same line. This patch reduces the amount to two and removes the
`sizeof(...)` from the line.
* The existing alternative of using `OBJECT_GUARDED_NEW` looks a out
of place compared to other allocation methods. Sometimes
`MEM_CXX_CLASS_ALLOC_FUNCS` can be used when structs are defined
in C++ code. It doesn't look great but it's definitely better. The downside
is that it makes the name of the allocation less useful. That's because
the same name is used for all allocations of a type, independend of
where it is allocated.
This patch introduces three new functions: `MEM_new`, `MEM_cnew` and
`MEM_delete`. These cover the majority of use cases (array allocation is
not covered).
The `OBJECT_GUARDED_*` macros are removed because they are not
needed anymore.
Differential Revision: https://developer.blender.org/D13502
|
|
Also add groups in some files.
|
|
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).
|
|
Adds some basic high-level explanations for editor/UI level asset APIs.
Also moves one such comment from the source file to the header file,
so it's in the same file as other API comments.
|
|
Ref T92709
|
|
|
|
Asset indexing should be disabled, but this was overlooked in the
asset list (used for the pose library in the 3D View).
|
|
Use fixed-length string to convert `char[2]` to `std::string`. Otherwise
`strlen()` is called, which is problematic as the `char[2]` is not
zero-terminated.
|
|
|
|
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.
|
|
|
|
This was an oversight when I added catalog drag & drop support. I forgot
to add this for dragging catalogs into the top level by dragging into to
the "All" item as well. This made the drag & drop support rather broken
because it wouldn't work for a basic case.
|
|
|
|
Asset install bundle poll didn't check the space it was running in and
assumed that it was always running in file browser.
|
|
Asset library indexing would store indexes of asset files to speed up
asset library browsing.
* Indexes are read when they are up to date
** Index should exist
** Index last modify data should be later than the file it indexes
** Index version should match
* The index of a file containing no assets can be load without opening
the index file. The size of the file should be below a 32 bytes.
* Indexes are stored on a persistent cache folder.
* Unused index files are automatically removed.
The structure of the index files contains all data needed for browsing assets:
```
{
"version": <file version number>,
"entries": [{
"name": "<asset name>",
"catalog_id": "<catalog_id>",
"catalog_name": "<catalog_name>",
"description": "<description>",
"author": "<author>",
"tags": ["<tag>"]
}]
}
```
Reviewed By: sybren, Severin
Maniphest Tasks: T91406
Differential Revision: https://developer.blender.org/D12693
|
|
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
|
|
|
|
The Blender icon must not be used to refer to anything that is not
Blender itself. Using the Blender icon on its own to refer to .blend
files or the currently open file is a no-go, which was brought up by
Ton.
This does the following changes to the icon file:
* Add new "Current File" icon
* Change the .blend file icon to contain a file icon with the Blender
logo, but not merely the Blender logo.
* Change the backup .blend file icon accordingly.
The new "Current File" icon is used in the Asset Browser, but
could/should be used in the Outliner as well. That needs more design
discussion though.
|
|
|
|
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
|
|
A reference makes clear that NULL is not an expected value. So it's the
prefered way of passing a `const` input parameter (at least if it may
not be cheap to copy).
|
|
Also move system includes first, like we have it elsewhere in Blender.
|
|
When using "Mark as Asset" the second time on an object (after having
done a "Mark as Asset" and then a "Clear Asset"), the old preview would
be re-used, even if the object was changed meanwhile. This is a bit of a
papercut, so always force previews to be re-rendered on "Mark as Asset".
|
|
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.
|
|
Uses the additions to the UI tree-view API from the previous commit to
enable drag & drop of asset catalogs. The catalogs will be moved in the
tree including children.
A remaining issue is that a catalog with children will always be
collapsed when dropping. I need to find a way to fix that in the
tree-view API.
There are a few improvements I can think of for the tree-item drag &
drop support, but time for these is too short. These can be done as
normal cleanups at some point.
|
|
The two blocking issues for object assets are addressed, see T92111 and T90198.
So now, objects can be marked as assets and be used in the Asset Browser.
|
|
The drag and drop feature of objects in 3D View has been modified to include:
- Snap the object being dragged.
- Visual feedback through a box and the placement tool grid.
Maniphest Tasks: T90198
Differential Revision: https://developer.blender.org/D12912
|
|
|
|
Asset Catalog Paths should only contain forward slashes as separators, but
now the UI is more resilient to people using blackslashes instead.
Manifest Task: T90553
|
|
Adds a filter popup to the header that allows specifiying which data-block
types to show. The menu automatically reflects all supported ID types, so it
shows a checkbox for materials, worlds and actions currently by default, and
all ID types with the "Extended Asset Browser" experimental feature enabled.
|
|
Send out notifications on catalog edits. This way all asset browsers will
refresh when catalogs are edited.
|
|
Keep track of unsaved asset catalog changes, in a more granular way than
just one boolean per asset library. Individual catalogs can now be
marked with a flag `has_unsaved_changes`. This is taken into account
when reloading data from the catalog definition file (CDF):
- New catalog in CDF: gets loaded
- Already-known catalog in CDF:
- local unsaved changes: on-disk catalog is ignored
- otherwise: on-disk catalog replaces in-memory one
- Already-known catalog that does not exist in CDF:
- local unsaved changes: catalog is kept around
- otherwise: catalog is deleted.
Because this saving-is-also-loading behaviour, the "has unsaved changes"
flags are all stored in the undo buffer; undoing after saving will not
change the CDF, but at least it'll undo the loading from disk, and it'll
re-mark any changes as "not saved".
Reviewed By: Severin
Differential Revision: https://developer.blender.org/D12967
|
|
Since writing asset catalogs to disk also means loading any on-disk
changes, it's a good idea to store an undo step.
|