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-11-09Asset System: New core type to represent assets (`AssetRepresenation`)Julian Eisel
Introduces a new `AssetRepresentation` type, as a runtime only container to hold asset information. It is supposed to become _the_ main way to represent and refer to assets in the asset system, see T87235. It can store things like the asset name, asset traits, preview and other asset metadata. Technical documentation: https://wiki.blender.org/wiki/Source/Architecture/Asset_System/Back_End#Asset_Representation. By introducing a proper asset representation type, we do an important step away from the previous, non-optimal representation of assets as files in the file browser backend, and towards the asset system as backend. It should replace the temporary & hacky `AssetHandle` design in the near future. Note that the loading of asset data still happens through the file browser backend, check the linked to Wiki page for more information on that. As a side-effect, asset metadata isn't stored in file browser file entries when browsing with link/append anymore. Don't think this was ever used, but scripts may have accessed this. Can be brought back if there's a need for it.
2022-10-04Cleanup: formatCampbell Barton
2022-10-04Cleanup: replace UNUSED macro with commented args in C++ codeHans Goudey
This is the conventional way of dealing with unused arguments in C++, since it works on all compilers. Regex find and replace: `UNUSED\((\w+)\)` -> `/*$1*/`
2022-07-19UI: Port view item features to base class, merge view item button typesJulian Eisel
No user visible changes expected. Merges the tree row and grid tile button types, which were mostly doing the same things. The idea is that there is a button type for highlighting, as well as supporting general view item features (e.g. renaming, drag/drop, etc.). So instead there is a view item button type now. Also ports view item features like renaming, custom context menus, drag controllers and drop controllers to `ui::AbstractViewItem` (the new base class for all view items). This should be quite an improvement because: - Merges code that was duplicated over view items. - Mentioned features (renaming, drag & drop, ...) are much easier to implement in new view types now. Most of it comes "for free". - Further features will immediately become availalbe to all views (e.g. selection). - Simplifies APIs, there don't have to be functions for individual view item types anymore. - View item classes are split and thus less overwhelming visually. - View item buttons now share all code (drawing, handling, etc.) - We're soon running out of available button types, this commit merges two into one. I was hoping I could do this in multiple smaller commits, but things were quite intertwined so that would've taken quite some effort.
2022-06-15Assets: Don't show duplicated catalog name when dragging assetsKevin Curry
While dragging assets over a catalog, we would show both the name and the full catalog path in the drag tooltip. For catalogs at the root level (catalogs without parents) the name and the full path are the same, so it would just display the name twice. This is more confusing than helpful. Now skip displaying the full path in that case. Reviewed by: Julian Eisel Addresses T92855 Differential Revision: https://developer.blender.org/D15190
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-17Allocator: simplify using guarded allocator in C++ codeJacques Lucke
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
2021-12-09Cleanup: Various cleanups to the tree-view APIJulian Eisel
* Correct URL for documentation (was changed recently). * Add comments. * Reevaluate and update which functions are public, protected or private. * Reorder functions and classes to be more logical and readable. * Add helper class for the public item API so individual functions it uses can be made protected/private (the helper class is a friend). Also allows splitting API implementation from the C-API. * Move internal layout builder helper class to the source file, out of the header. * More consistent naming. * Add alias for item-container, so it's more clear how it can be used. * Use const. * Remove unnecessary forward declaration.
2021-12-08Cleanup: move public doc-strings into headers for 'editors'Campbell Barton
Ref T92709
2021-12-02Asset Browser: Don't expand top-level catalogs by defaultJulian Eisel
The "All" item will be expanded of course, and the tree will also be expanded so that the active item is visible. But feedback was that in some setups, opening all the top-level catalogs is a bit too much. So collapse them for a more compact default layout. Part of T93582.
2021-12-02Asset Browser: Remove home icon for "All" itemJulian Eisel
Originally this wasn't really meant to stay there permanently, but helped giving things a nicer alignment. Others seemed to like it at first so it stayed, but after more feedback we decided to remove it again. The alingment is better now with the previous commit. Part of T93582.
2021-12-02Asset Browser: Nest all catalogs under the "All" itemJulian Eisel
This makes the relation to the catalogs and the behavior more clear. Part of T93582.
2021-12-02Fix: Add tooltip translation marker to disabled hintsHans Goudey
This was overlooked, as it seems there's no way for these strings to be translated currently. Generally it's not that clear whether `N_` or `TIP_` should be used in this case, but `TIP_` seems more consistent. To avoid the cost of the translation lookup when the UI text isn't necessary, we could allow the disabled hint argument to be optional. Differential Revision: https://developer.blender.org/D13141
2021-11-30Cleanup: spelling in comments & stringsCampbell Barton
2021-11-26Cleanup: Silence clang-tidy warning.Jeroen Bakker
2021-11-25Merge remote-tracking branch 'origin/blender-v3.0-release'Sybren A. Stüvel
2021-11-25Fix T93274: Assigning asset catalog doesn't mark file as modifiedSybren A. Stüvel
Assigning a catalog to an asset via drag-and-drop in the asset browser now creates an undo step. Not only does this allow undoing the action, it also tags the blend file as modified. Reviewed by: Severin Differential Revision: https://developer.blender.org/D13370
2021-11-24Merge branch 'blender-v3.0-release'Julian Eisel
2021-11-24Asset Browser: Activate a catalog when draggingJulian Eisel
Without this it's easy to loose track of which catalog you are dragging. Things feel generally quite jumpy/disconnected, activating the catalog makes things feel far less like that. I consider this an important usability fix, therefore I'm adding it to the release branch.
2021-11-24Asset Browser: Fix catalog being renamed when dropping into parentJulian Eisel
When dropping catalogs it is ensured that the name of the moved catalog is unique within the new parent catalog. When dropping a catalog into the parent, the catalog would not actually move to a different location, but it would still be renamed. The unique name logic simply isn't smart enough to ignore the catalog that is about to be moved. Address this by disallowing dragging a catalog into its own parent. It's already there.
2021-11-24Asset Browser: Support dragging catalogs into top levelJulian Eisel
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.
2021-11-20Refactor: Port spreadsheet data set to UI tree viewHans Goudey
This patch removes a bunch of specific code for drawing the spreadsheet data set region, which was an overly specific solution for a generic UI. Nowadays, the UI tree view API used for asset browser catalogs is a much better way to implement this behavior. To make this possible, the tree view API is extended in a few ways. Collapsibility can now be turned off, and whether an item should be active is moved to a separate virtual function. The only visual change is that the items are now drawn in a box, just like the asset catalog. Differential Revision: https://developer.blender.org/D13198
2021-11-16Asset Browser: Forbid dragging catalogs into themselvesJulian Eisel
While there is nothing technically that would cause issues when moving a catalog into itself (it just changes the path of the catalog, and the missing parent catalogs will be created), it seems broken to the user. So disable this in the drag & drop code for asset catalogs.
2021-11-02Fix more UI message/i18n issues.Bastien Montagne
2021-10-27Asset Browser: Support dragging catalogs to move them in the hierarchyJulian Eisel
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.
2021-10-27UI: Add padding to the left of tree-rows labels without iconJulian Eisel
The label was placed right at the left border of the row highlight, which looked weird. So add some padding to tree-row labels without icon or collapse chevron, which makes it look more polished. As additional benefit, it alignes the labels better with icons of other rows on the same tree level. And the padding makes it more clear that a child is indeed a child, not just a sibling without icon.
2021-10-26Asset Browser: Show disabled-hint when dragging external assets over catalogJulian Eisel
There's now a message displayed in red next to the cursor explaining that only assets from the current file can be moved between catalogs. The previous commit prepared this.
2021-10-26UI: Support disabled-hint for dropping in the tree-view APIJulian Eisel
A tree-view item's drop controller can now return a message for the user explaining why dropping isn't possible with the dropped data. This is then displayed in red text next to the cursor. This isn't actually used yet, the follow up commit will do that.
2021-10-25UI: Refactor dropping support for the tree-view APIJulian Eisel
Introduces a dropping-controller API for the tree-view items, `AbstractTreeViewItemDropController`. This reduces responsibilities of the main tree-view item classes, which are already getting quite big. As I expect even more functionality to be needed for it (e.g. drag support), it's better to start introducing such controller types already.
2021-10-22Asset Browser: fix issue rebuilding the visible asset filterSybren A. Stüvel
2021-10-22Asset Browser: Show "orphaned" assets in "Unassigned" catalogSybren A. Stüvel
Show assets that have an unknown catalog ID assigned in the "Unassigned" catalog. Another catalog named "Orphans" was considered as well, but that would clash with the usual handling of Blender (discarding orphan data on save) and thus that idea was discarded. Manifest Task: T91949
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-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-12Asset Catalogs: expose undo/redo operators to UISybren A. Stüvel
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.
2021-10-08Asset Browser: Context menu for catalogsJulian Eisel
The context menu is a standard way to expose operations of the clicked item to the user. They expect it to be there, and we can make use of it as a place to put more advanced operations in. The menu contains: * New Catalog * Delete Catalog * Rename Also removes the 'x' icon to delete a catalog from the right side of a row. This was just placed there temporarily until the context menu is there. It's too easy to accidentally delete catalogs with this.
2021-10-07Asset Browser: Move Asset Library selector to navigation barJulian Eisel
The menu to select the active Asset Library is now in the left bar (so called "Source List", although I'd prefer "Navigation-Bar"). This has some benefits: * All Asset Library navigation is in the left sidebar now, giving nice grouping and a top-to-bottom & left-to-right flow of the layout. The header is focused on view set-up now. * Catalogs are stored inside the asset library. Makes sense to have them right under that. * Less content in the header allows for less wide Asset Browsers without extensive scrolling. * This location gives more space to add options or operators for Asset Libraries. Main downside I see is that the side-bar needs to be opened to change libraries, which takes quite some space. In practice there shouldn't be need to do this often though.
2021-10-07Asset Browser: Rework layout & behavior of catalog tree-viewJulian Eisel
This reworks how tree rows are constructed in the layout and how they behave in return. * To open or collapse a row, the triangle/chevron icon has to be clicked now. The previous behavior of allowing to do it on the entire row, but only if the item was active already, was just too unusual and felt weird. * Reduce margin between chevron icon and the row label. * Indent child items without chevron some more, otherwise they feel like a row on the same level as their parent, just without chevron. * Fix renaming button taking entire row width. Respect indentation now. * Fix double-clicking to rename toggling collapsed state on each click. Some hacks/special-handling was needed so tree-rows always highlight while the mouse is hovering them, even if the mouse is actually hovering another button inside the row.
2021-10-06Asset Browser: Show catalog add & delete icons on mouse hover (only)Julian Eisel
Now the icons to add or delete catalogs are only shown when mouse hovering a catalog item in the tree. This is convenient for quick creation of catalogs, and doesn't require activating a catalog to edit it first. Determining if a tree item is hovered isn't trivial actually. The UI tree-view code has to find the matching tree-row button in the previous layout to do so, since the new layout isn't calculated yet.
2021-10-06Asset Browser: Always show icon to add catalog next to "All" itemJulian Eisel
Feedback was that it's unclear sometimes how to add a new item and that some people expect a button to add a new item next to the "All" item.
2021-10-06Assets: Support Renaming Catalogs in the UIJulian Eisel
Catalogs can now be renamed by double clicking them in the Asset Browser. This is mostly done through the tree-view API, the asset specific code is very little. There is some polish left to be done here, e.g. the double click currently also collapses/uncollapses and activates the clicked item. And the rename button takes the full width of the row. But addressing these is better done as part of some other behavioral changes that are planned anyway.
2021-10-05Fix T91940: Asset Browser catalogs continuously redrawJulian Eisel
Issue was that the `on_activate()` callback of tree-items were continuously called, because the active-state was queried before we fully reconstructed the tree and its state from the previous redraw. Such issues could happen in more places, so I've refactored the API a bit to reflect the requirements for state queries, and include some sanity checks. The actual fix for the issue is to delay the state change until the tree is fully reconstructed, by letting the tree-items pass a callback to check if they should be active.
2021-10-05Cleanup: Better way to pass activate callbacks to Tree-View itemsJulian Eisel
The `ui::BasicTreeViewItem` took a function-like object to execute on item activation via the constructor. This was mainly intended to be used with lambdas. However, it's confusing to just have this lambda there, with no indication of what it's for (activation). Instead, assign the function-like object via an explicit `on_activate()` function.
2021-10-04Assets: Show all assets indirectly nested inside the active catalogJulian Eisel
The asset catalog design was always that the active catalog would also display all assets of its child catalogs (or grand-childs, etc.). This is one of the main characteristics that differentiates catalogs from usual directories. Sybren prepared this on the asset catalog backend side with 56ce51d1f75a. This integrates it into the Asset Browser backend and the UI.
2021-10-04UI Tree-View API: Enforce active item to be un-collapsedJulian Eisel
Makes sure that the active item of a tree never has collapsed parent items, which can be confusing if it happens. E.g. for the asset catalogs UI, the active catalog decides which assets are visible. Having it hidden while being the main factor deciding which assets are visible is quite confusing. I think it makes sense to have this at the UI Tree-View level, rather than doing it manually in the asset catalog code for example. Seems like something you'd commonly want. We can make it optional in the API if needed. Renamed the `set_active()` function to make clear that it is more than a mere setter.
2021-10-04Assets: Support dragging assets on "Unassigned" catalogJulian Eisel
Dragging assets onto the "Unassigned" catalog tree item will effectively move the assets out of any catalog. Technically this means unsetting the Catalog-ID stored in the asset metadata, or more precisely setting the UUID to be all zeros.
2021-10-04Cleanup: Use static function for asset catalog tree-view helperJulian Eisel
2021-10-04Cleanup: Separate interface & implementation for asset catalog tree-viewJulian Eisel
Should make the code a bit more organized and help getting an overview of the interfaces more quickly.
2021-10-04Asset Browser: Support dragging assets into catalogsJulian Eisel
With this it is possible to select any number of assets in the Asset Browser and drag them into catalogs. The assets will be moved to that catalog then. However, this will only work in the "Current File" asset library, since that is the only library that allows changing assets, which is what's done here. While dragging assets over the tree row, a tooltip is shown explaining what's going to happen. In preparation to this, the new UI tree-view API was already extended with custom drop support, see 4ee2d9df428d. ---- Changes here to the `wmDrag` code were needed to support dragging multiple assets. Some of it is considered temporary because a) a proper #AssetHandle design should replace some ugly parts of this patch and b) the multi-item support in `wmDrag` isn't that great yet. The entire API will have to be written anyway (see D4071). Maniphest Tasks: T91573 Differential Revision: https://developer.blender.org/D12713 Reviewed by: Sybren Stüvel
2021-09-29Asset Browser: Initial Asset Catalog UIJulian Eisel
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