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
2021-09-27File/Asset Browser: Don't deselect other items when draggingJulian Eisel
Basically this enables the select-tweaking behavior as per the guidelines: https://wiki.blender.org/wiki/Human_Interface_Guidelines/Selection#Select-tweaking. We use this in most other other editors that allow selecting and dragging multiple items. But besides the consistency improvement, this is important if we want to support dragging multiple assets (or files) in future. We want to support this at least for dragging multiple assets into an asset catalog for the upcoming asset catalog UI.
2021-09-24Assets: Read catalogs immediately when loading a libraryJulian Eisel
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.
2021-09-24FileBrowser: Reduce Overhead Browsing Libraries.Jeroen Bakker
When Browsing libraries the asset files were opened multiple times. once to determine the needed groups to query and once for each group to query the items in the group. For file browsing this makes sense but for asset browsing this can be reduced. This patch will load the asset files recursively and only opens them once. Another change is that only the assets are requested and not filtered out later in the process. This patch is needed to simplify the library indexing. Where we need access to the full library content. ## The numbers ## Benchmarked by adding scenes of the spring open movie to the default asset library. Refreshing the asset library would recursively load all the files there. | **8bc27c508a** | Processed 317 'directories/libraries' | 7.573986s | | **Patch** | Processed 42 'directories/libraries' | 0.821013s | {F10442811} Reviewed By: mont29, Severin Maniphest Tasks: T91406 Differential Revision: https://developer.blender.org/D12499
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-09-22Cleanup: spelling in commentsCampbell Barton
2021-09-20Asset Browser: Redraw sidebars on mode switchesJulian Eisel
There may be mode specific panels for some assets in the navigation or the asset metadata sidebar. For example the pose library will likely do this. So let the regions redraw on mode changes.
2021-09-16Assets: Recursive reading of asset librariesJulian Eisel
With this, asset libraries can be directory structures and all assets in sub-directories will show up in an Asset Browser. With complex directory structures and many .blend files inside, asset library reading will be quite slow for now. There's initial work being done to introduce indexing for this (T82979), other optimizations are being discussed as well. Addresses T91406. Differential Revision: https://developer.blender.org/D12139
2021-09-10Add missing bit to own previous commitJulian Eisel
Amendment to 7a5216497cc3. Removed this before committing, because I thought it wasn't needed. Of course it was...
2021-09-10Fix possible crash displaying asset preview from current fileJulian Eisel
For some reason the asset preview isn't created or loaded correctly in some instances. This could be addressed with D9974, but hard to tell since I only have a failing .blend file, no steps to recreate it from scratch. Would crash when opening an Asset Browser, selecting an object asset (that has an invalid preview stored) and opening the Asset Browser sidebar, so that the preview is visible there.
2021-09-01BPY-Docs: Add missing file context members documentationJulian Eisel
Context members of the file space would not be shown in the context API docs.
2021-09-01File Browser/BPY: Expose list of selected files in contextJulian Eisel
Since recently it's possible to query the active file (as object, not just the name), but it's quite useful for scripting to have access to all selected files. This introduces `bpy.context.selected_files`, returning a list of file objects representing files in the File Browser.
2021-08-26Cleanup: Use `ID_IS_LINKED` instead of direct `id.lib` pointer check.Bastien Montagne
2021-08-26Cleanup: sort struct blocksCampbell Barton
2021-08-25Cleanup: Fixed compile error in debug code.Jeroen Bakker
2021-08-19UI: Remove "Unfitted" Kerning Style OptionHarley Acheson
This patch removes the "Kerning Style" option for UI widget font drawing and uses only the current default of "Fitted", since the other option of "Unfitted" is just the result of truncation errors. see D12231 for much more information. Differential Revision: https://developer.blender.org/D12231 Reviewed by Campbell Barton
2021-08-12Cleanup: spelling in commentsCampbell Barton
2021-08-12Cleanup: use C++ style comments for disabled codeCampbell Barton
2021-08-11Enable Asset Browser by default for poses, rest stays experimentalJulian Eisel
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
2021-08-10File/Asset Browser: Select/Activate File on Right Click for Context MenuJulian Eisel
Right clicking would spawn the context menu under the cursor, but some operators would actually act on the active asset/file which wasn't the one clicked on. When multiple files are selected and one of them is right-clicked on, selection is not changed to allow operations on multiple files. E.g. deletion. This makes the File/Asset Browser match the Outliner (in behavior, not implementation). For the right-click selection keymap: * The context menu still only spawns on W. * Bonus: Right click now does something, it actually selects files! I could have done additional changes here to avoid this, but it seems like a good addition. This is also a better alternative to rB5edfde58fe60, which didn't work properly either. Using rename from the context menu would only work if the clicked on file was also active... Differential Revision: https://developer.blender.org/D12065 Reviewed by: Campbell Barton
2021-08-10Fix crash: mouse is over file space during startup.Jeroen Bakker
When blender starts and the mouse is over a file/asset browser it crashes. This is because blender wants to highlight a file, but the layout isn't initialized yet.
2021-08-09Cleanup: filelist, pass `FileListReadJob` to job functionsSybren A. Stüvel
Pass `FileListReadJob` to the `read_job_fn` callback, instead of exploding the struct into its individual fields, passing those as parameters, and marking a bunch of those as unused again. No functional changes.
2021-08-09Cleanup: document `FileListReadJob::tmp_filelist`Sybren A. Stüvel
Add a comment to document what `FileListReadJob::tmp_filelist` is for, and how it's freed. No functional changes.
2021-08-06Cleanup: rename `FileList::asset_library` → `asset_library_ref`Sybren A. Stüvel
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
2021-08-06Cleanup: use MEM_SAFE_FREE macroCampbell Barton
2021-08-05Cleanup: remove redundant parenthesisCampbell Barton
2021-08-03Fix T90341: Crash opening 2.4 file with File Browser editor openJulian Eisel
The file selection parameters (e.g. `context.space_data.params`) are expected to be unset in certain cases. Reading 2.4 files seems to be one of them. Hence, code using it should check it's set first. Also added an assert to a File Browser UI template printing a message when the parameters are unset, to help debugging the issue.
2021-08-02Asset Browser: Proper context menu for assetsJulian Eisel
Add a context menu dedicated to asset operations to the Asset Browser. There are two separate context menus to keep things separated well and avoid confusing if-else logic (similar to D12057 & D12059). Their polls make sure they are displayed for the right contexts only. Also (to be committed as followup cleanup): Remove now unused special handling for assets in file delete operator. Differential Revision: https://developer.blender.org/D12062
2021-08-02WindowManager: Support Dynamic tooltips when dragging.Jeroen Bakker
Originally the operator name was drawn next to the dragging content. After that there was an option to add custom, static text with the dragging content. This patch allows dynamic text to be drawn. The custom text was implemented as out parameter of the poll function what made the code unclear. This patch introduces a tooltip function that separates tooltip generation from the poll function. NOTE: the text should always be returned in its own memory block. This block will be freed after it is copied in the drag struct. Reviewed By: Severin Differential Revision: https://developer.blender.org/D12104
2021-07-30Assets: Disable File Browser only operators for asset browsingJulian Eisel
These operators shouldn't be available in the Asset Browser. https://developer.blender.org/T83556 Added a comment to each operator poll assignment to explicitly mention the intention. That should also remind devs to decide if the operator should apply for both file & asset browsing when copy & pasting operator definition code.
2021-07-30Fix incorrect poll function used for file path droppingJulian Eisel
The operator to drop file paths into the File Browser was just checking if there's an active window. This wasn't really an issue since the operator was only used as drop-operator for the File Browser. But the operator would show up in the operator search. Plus, for asset browsing, we'll also have to check the file browsing mode, so the more specific poll function will be needed.
2021-07-30Cleanup: Refactor logic of file deletion poll callbackJulian Eisel
* Early exit instead of complex if-else blocks. * Avoid iterating over entire file list. * Use `true`/`false` for boolean values. * Declare variables in smaller scopes.
2021-07-30Preferences: Move "Register File Association" to preferences levelJulian Eisel
The operator was register as a "file" operator, which are by convention used for File Browser operators only. Move it to the "preferences" operators, where it's displayed in the UI too.
2021-07-30Cleanup: Remove unused file description storageJulian Eisel
This isn't used at all in the current File and Asset Browser design.
2021-07-28Fix T75028: Improved Font Names in File ManagerHarley Acheson
When viewing font files in the File Manager, this patch uses the font's family and style names to show the same type of string shown to users in operating system lists. For example "Book Antiqua Regular" instead of "BKANT.ttf" see D12020 for details and examples. Differential Revision: https://developer.blender.org/D12020 Reviewed by Campbell Barton and Julian Eisel
2021-07-21Assets: Replace duplicated asset library reference type from DNAJulian Eisel
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.
2021-07-21Cleanup: replace BLI_assert(test || !"text") with BLI_assert_msg(test, text)Campbell Barton
2021-07-20Cleanup: Store asset-handle in drag dataJulian Eisel
Would previously pass a few properties that are available via the asset-handle now. This asset-handle is also required for some of the asset API, e.g. the temporary ID loading. This will probably be needed before too long.
2021-07-15Assets: Initial Asset List as part of the Asset System designJulian Eisel
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.
2021-07-15Assets: Expose active asset library in contextJulian Eisel
For the Asset Browser, this returns the active asset library of the Asset Browser, otherwise it returns the one active in the workspace. This gives simple access to the active asset library from UI code and Python scripts. For example the upcoming Pose Library add-on uses this, as well as the upcoming asset view template.
2021-07-15Assets: Add an active asset library per workspace, for the UI to useJulian Eisel
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.
2021-07-15Cleanup: replace BLI_assert(!"text") with BLI_assert_msg(0, "text")Campbell Barton
This shows the text as part of the assertion message.
2021-07-07Cleanup: Remove wrong File Browser commentJulian Eisel
Accidentally included this in rB01e1944cd455, it came from a merge conflict.
2021-07-07Cleanup: Correct comment in earlier commit (f4cb3ccd9c07)Julian Eisel
Comment was based on an older version of the patch.
2021-07-07Assets: Keep assets active after renaming, ensure they are scrolled into viewJulian Eisel
When renaming an ID somewhere in the UI after marking it as asset, it would often get lost in the Asset Browser (scrolled out of view). It would also get deactivated. This patch makes sure that if an asset is active whose ID gets renamed, it is kept active and visible. That is important for a fast, uninterrupted asset creation workflow, where users often rename assets while working in the asset browser. Old code stored the new file-name to identify a file after re-reading the file-list after the rename. For assets that doesn't work because there may be multiple assets with the same name. Here the simple solution of just storing the pointer to the renamed ID is chosen, rather than relying on the file-name in this case. (Should be fine with undo, since the ID * reference is short lived, it's not stored over possible undo steps. If it turns out to have issues, I rather switch to a rename_id_uuid, but keep that separate from the file->uid). Reviewed by: Sybren Stüvel Differential Revision: https://developer.blender.org/D11119
2021-07-07File Browser: Select files and directories after renamingJulian Eisel
(Note: This is an alternative version for D9994 by @Schiette. The commit message is based on his description.) Currently, when a new directory is created it is not selected. Similarly, when renaming an existing file or directory, it does not remain active/highlighted blue after renaming. This change makes sure the file or directory is always selected after renaming, even if the renaming failed or was cancelled. This has some usability advantages: - Open the newly created directory without having to select it (ENTER). - If you make a naming mistake, you can immediately fix that (F2) without having to click it again. - If you create a directory and forget to name it, you can fix that (F2) without having to select it. - This is consistent with many common File Browsers. Further, selecting the item even after renaming failed or was cancelled helps keeping the file in focus, so the user doesn't have to look for it (especially if the renaming just failed which the user may not notice). In other words, it avoids disorienting the user. Also see D11119 which requires this behavior. We could also always select the file/directory on mouse press. This would make some hacks unnecessary, but may have further implications. I think eventually that's what we should do though.
2021-07-07Cleanup: Move file deselection function to more appropriate fileJulian Eisel
`filesel.c` seems like the place that should contain file selection functions. Previously it was in `file_ops.c` because that was the only file that actually used it. But a followup commit needs it from a different file.
2021-07-07Cleanup: spelling in commentsCampbell Barton
2021-07-05Cleanup: Rename ambiguous "params" variable in File Browser notifier listenersJulian Eisel
File Browser code uses the term "params" for its file selection parameters a lot. Avoid confusion/ambiguity by calling the notifier listener parameters "listener_params".
2021-07-05Assets: Disable file renaming operator for Asset BrowsersJulian Eisel
This operator only works with renaming files, not assets.
2021-07-05Cleanup: spelling, punctuationCampbell Barton