Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-02-11File headers: SPDX License migrationCampbell Barton
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
2022-01-14Cleanup: spelling in comments, C++ style comments for disabled codeCampbell Barton
Also ensure space at end of comment.
2021-12-21Fix T93960: Asset Catalogs I/O fails with unicode file paths on WindowsSybren A. Stüvel
On Windows, encode file paths as UTF-16 before trying to open the file for reading/writing. This introduces a new class `blender::fstream`, which wraps `std::fstream` and provides this UTF-16 encoding. This class should also be used in other areas, like the Alembic importer/exporter. Manifest Task: T93960 Reviewed By: JacquesLucke Differential Revision: https://developer.blender.org/D13633
2021-12-21Assets: log message when catalog definitions cannot be loadedSybren A. Stüvel
Log a message (via `CLOG`) when asset catalog definitions cannot be loaded. Reviewed by @jacqueslucke in D13633
2021-11-09Asset Catalogs: add test for proper shortening of simple namesSybren A. Stüvel
Catalog simple names are supposed to fit into the DNA field `char AssetMetaData::catalog_simple_name[64]`, and thus should be shortened appropriately. This was already happening, but is now also covered by a test. No functional changes.
2021-10-25Asset Catalogs: be more accepting of backslashes as separatorsSybren A. Stüvel
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
2021-10-24Cleanup: spelling in commentsCampbell Barton
2021-10-22Asset Catalogs: support reloading without losing local changesSybren A. Stüvel
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
2021-10-22Cleanup: spelling in comments, use C style commentsCampbell Barton
2021-10-21Asset Catalogs: add test for backslashed catalog pathsSybren A. Stüvel
No functional changes necessary, test already succeeds.
2021-10-21Asset Catalogs: refresh simple name when renaming catalogSybren A. Stüvel
When renaming an asset catalog, also update its simple name. Catalogs will most likely be created from within Blender, so via the catalog tree in the asset browser. Here catalogs are always named "Catalog" until the user renames them, which was reflected in all simple names being "Catalog".
2021-10-21Asset Catalogs: treat first-loaded catalog as main catalogSybren A. Stüvel
When there are multiple catalogs with the same path (so different UUIDs all mapped to the same catalog path), treat the first-loaded one as the main catalog for that path, and the rest as aliases. This ensures that the UUID of a catalog (as chosen in the tree UI and thus interacted with by users) is stable, regardless of whether by some coincidence later another catalog with the same UUID is created.
2021-10-21Cleanup: rename & restructure `AssetCatalogPathCmp`Sybren A. Stüvel
Rename `AssetCatalogPathCmp` to `AssetCatalogLessThan`: - it compares more than paths (so no more `Path` in the name), and - performs a less-than operation (so no more `Cmp` in the name). Also restructure its code to make an extra upcoming comparison easier to add. No functional changes.
2021-10-19Asset Browser: Improved workflow for asset catalog savingSybren A. Stüvel
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
2021-10-12Cleanup: asset catalogs, rename store_undo_snapshot to undo_pushSybren A. Stüvel
Rename `bke::AssetCatalogService::store_undo_snapshot` to `undo_push`. This makes the function named the same way as the global Blender "undo push" function. No functional changes.
2021-10-12Asset Catalogs: undo stack for catalog editsSybren A. Stüvel
Add an undo stack for catalog edits. This only implements the backend, no operators or UI yet. A bunch of `this->xxx` has been replaced by `catalog_collection_->xxx`. Things are getting a bit long, and the class is turning into a god object; refactoring the class is tracked in T92114. Reviewed By: Severin Maniphest Tasks: T92047 Differential Revision: https://developer.blender.org/D12825
2021-10-12Asset Catalogs: recursive deletion of catalogs & childrenSybren A. Stüvel
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
2021-10-12Tests: simplify asset catalog tree testing codeSybren A. Stüvel
Simplify the testing code that verifies the asset catalog tree. It now prints clearer error messages when things go wrong, and it gets simpler data to test (instead of having to explicitly pass the parent count, it just counts the number of separators in the expected path). No functional changes to Blender.
2021-10-08Asset Catalogs: Fix unit test on WindowsSybren A. Stüvel
Force native slashes before comparing paths; on Windows mixing separators caused a unit test to fail. No functional changes.
2021-10-07Asset Catalogs: change rules for saving catalog definition filesSybren A. Stüvel
Change the rules for determining where to save a new catalog definition file (CDF). Old situation (T91681): if a `blender_assets.cats.txt` file already exists in the same directory as the blend file, write to that. If not, see if the blend file is contained in an asset library, and write to its top-level CDF. The new situation swaps the rules: first see if the blend file is contained in an asset library, and if so write to its top-level CDF. If not, write a CDF next to the blend file. As before, any pre-existing CDF is not just bluntly overwritten, but merged with the in-memory catalogs.
2021-10-07Cleanup: asset catalog tests, move teardown functionSybren A. Stüvel
Move `AssetCatalogTest::TearDown` close to the corresponding `SetUp` function, so that it's easier to find. No functional changes.
2021-10-01Cleanup: Asset Catalog Test, fix clang-tidy warningsSybren A. Stüvel
No functional changes.
2021-10-01Asset Catalogs: add catalog filter for the asset browserSybren A. Stüvel
Given an "active catalog" (i.e. the one selected in the UI), construct an `AssetCatalogFilter` instance. This filter can determine whether an asset should be shown or not. It returns `true` when The asset's catalog ID is: - the active catalog, - an alias of the active catalog (so different UUID that maps to the same path), - a sub-catalog of the active catalog. Not yet hooked up to the UI.
2021-10-01Asset Catalogs: test that missing catalogs are created onceSybren A. Stüvel
Add asset catalogs test, to ensure missing catalogs are only created once, and not for every originally defined catalog. No functional changes to Blender (the code was already doing the right thing).
2021-09-30Asset Catalogs: create missing parent catalogsSybren A. Stüvel
For every known catalog, ensure its parent catalog also exists. This ensures that assets can be assigned to parent catalogs, even when they didn't exist in the Catalog Definition File yet.
2021-09-30Cleanup: remove `CatalogPath` aliasSybren A. Stüvel
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.
2021-09-30Asset Catalog: introduce `AssetCatalogPath` classSybren A. Stüvel
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.
2021-09-29Cleanup: use C comments for plain textCampbell Barton
2021-09-29Cleanup: spelling in commentsCampbell Barton
2021-09-28Cleanup: asset catalog service, remove obsolete `write_to_disk` functionSybren A. Stüvel
Remove `AssetCatalogService::write_to_disk()` function. It has been superseded by `write_to_disk_on_blendfile_save()`; the handful of test functions that called the old function have been adjusted to use the new one. No functional changes to Blender itself.
2021-09-28Asset Catalog Service: add function to change catalog pathSybren A. Stüvel
Add `AssetCatalogService::update_catalog_path()` to change the catalog path of the given catalog, and also change the path of all the catalogs contained within the given catalog. Rebuilds the tree structure for the UI, but does not save the new catalog definitions to disk. No user-facing changes, just backend preparation for UI work.
2021-09-27Asset Catalogs: write catalogs to disk when saving the blend fileSybren A. Stüvel
The Asset Catalog Definition File is now saved whenever the blend file is saved. The location of the CDF depends on where the blend file is saved, and whether previously a CDF was already loaded, according to the following rules. The first matching rule wins: 1. Already loaded a CDF from disk? -> Always write to that file. 2. The directory containing the blend file has a `blender_assets.cats.txt` file? -> Merge with & write to that file. 3. The directory containing the blend file is part of an asset library, as per the user's preferences? -> Merge with & write to `${ASSET_LIBRARY_ROOT}/blender_assets.cats.txt` 4. Create a new file `blender_assets.cats.txt` next to the blend file.
2021-09-27Assets: Additions/fixes to the catalog system in preparation for the UIJulian Eisel
* Fixes missing update of the catalog tree when adding catalogs. * Adds iterators for the catalogs, needed for UI code. * Store catalog ID in the catalog tree items, needed for UI code. * Other smaller API additions for the UI. * Improve comments and smaller cleanups. New functions are covered with unit tests. Differential Revision: https://developer.blender.org/D12618 Reviewed by: Sybren Stüvel
2021-09-24Asset Catalogs: write catalogs sorted by path & UUIDSybren A. Stüvel
When writing asset catalog definition files, order the catalogs by (path, UUID). This ensures that every write produces the same file, playing nice with versioning / synchronisation systems.
2021-09-24Asset Catalogs: fix trailing slash test caseSybren A. Stüvel
The "path with trailing slash" test catalog was using the same path as another catalog, which meant it was ignored after doing the path cleanup. It's now different in the test file in SVN, so it'll actually show up in the test.
2021-09-24Cleanup: asset catalogs, fix clang-tidy warningSybren A. Stüvel
Remove unnecessary call to `std::string::c_str()`. No functional changes.
2021-09-23Assets: add Asset Catalog systemSybren A. Stüvel
Catalogs work like directories on disk (without hard-/symlinks), in that an asset is only contained in one catalog. See T90066 for design considerations. #### Known Limitations Only a single catalog definition file (CDF), is supported, at `${ASSET_LIBRARY_ROOT}/blender_assets.cats.txt`. In the future this is to be expanded to support arbitrary CDFs (like one per blend file, one per subdirectory, etc.). The current implementation is based on the asset browser, which in practice means that the asset browser owns the `AssetCatalogService` instance for the selected asset library. In the future these instances will be accessible via a less UI-bound asset system. The UI is still very rudimentary, only showing the catalog ID for the currently selected asset. Most notably, the loaded catalogs are not shown yet. The UI is being implemented and will be merged soon. #### Catalog Identifiers Catalogs are internally identified by UUID. In older designs this was a human-readable name, which has the problem that it has to be kept in sync with its semantics (so when renaming a catalog from X to Y, the UUID can be kept the same). Since UUIDs don't communicate any human-readable information, the mapping from catalog UUID to its path (stored in the Catalog Definition File, CDF) is critical for understanding which asset is stored in which human-readable catalog. To make this less critical, and to allow manual data reconstruction after a CDF is lost/corrupted, each catalog also has a "simple name" that's stored along with the UUID. This is also stored on each asset, next to the catalog UUID. #### Writing to Disk Before saving asset catalogs to disk, the to-be-overwritten file gets inspected. Any new catalogs that are found thre are loaded to memory before writing the catalogs back to disk: - Changed catalog path: in-memory data wins - Catalogs deleted on disk: they are recreated based on in-memory data - Catalogs deleted in memory: deleted on disk as well - New catalogs on disk: are loaded and thus survive the overwriting #### Tree Design This implements the initial tree structure to load catalogs into. See T90608, and the basic design in T90066. Reviewed By: Severin Maniphest Tasks: T91552 Differential Revision: https://developer.blender.org/D12589
2021-08-02Revert "Asset Catalogs: loading a catalog definition file"Sybren A. Stüvel
This reverts commit 1f0d6f763573b22772dcdb61320a12e1c11949e0 and the cleanup 06cb48e1b284e6438ce14f1ea543143fcc74ca59. Committed too early on Monday morning, still has issues that should be resolved first.
2021-08-02Asset Catalogs: loading a catalog definition fileSybren A. Stüvel
Initial, limited implementation of loading a single asset catalog definition file. These files are structured as follows: CATALOG_ID virtual/path/of/catalog SUBCATALOG_ID virtual/path/of/catalog/child SOMETHING_ELSE some/unrelated/hierarchy These virtual paths will be used to show the catalog in a tree structure; the tree structure itself is not part of this commit. Each asset will have one catalog ID that determines where in that tree the asset shows up. Currently only a single catalog definition file can be read; merging data from multiple such files, and writing them out again after changes are made, is for future commits. This commit only contains the code to load a single file, and unittests to check that this actually works. No UI, no user-facing functionality yet.