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-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-16Remove G.relbase_validCampbell Barton
In almost all cases there is no difference between `G.relbase_valid` and checking `G.main->filepath` isn't an empty string. In many places a non-empty string is already being used instead of `G.relbase_valid`. The only situation where this was needed was when saving from `wm_file_write` where they temporarily became out of sync. This has been replaced by adding a new member to `BlendFileWriteParams` to account for saving an unsaved file for the first time. Reviewed By: brecht Ref D13564
2021-12-14Cleanup: consistent naming for the blender file nameCampbell Barton
2021-12-09Fix T93691: Crash when loading custom thumbnail in custom libraryJulian Eisel
This was an issue with the mixed list of external assets and assets from the current file. When closing the File Browser to select the custom preview image, the assets from the current file would be cleared for reread, to make sure we display up-to-date file data. That is because the workspace of the temporary File Browser was deleted, causing a change in the file data (main data-base). The reread would happen in a background thread, meaning it might not finish before the custom preview operator runs and queries the active asset. So the preview operator would get the wrong active asset from context. Two fixes were needed: * Make sure current file data is reread before the operator runs, by doing this partial rereading on the main thread. * Ensure the asset list (in fact file list) order stays consistent over rereads. If multiple assets with the same name were shown, the operator might also have gotten the wrong asset, also leading to a crash. Additionally the file operation handler should probably poll before executing, to fail gracefully at least (not crash).
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-07Fix memory leak when loading large asset librariesJulian Eisel
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-30Merge remote-tracking branch 'origin/blender-v3.0-release'Sybren A. Stüvel
2021-11-30Fix T93508: Shift+F1 to switch to asset browser randomly crashesJulian Eisel
2021-11-30Fix T92577: Cannot open shortcut folders on WindowsJulian Eisel
`file.select()` wasn't handling redirects as it should when it also opens directories. This was only uncovered by a change in the keymap. Reviewed By: Bastien Montagne, Harley Acheson Differential Revision: https://developer.blender.org/D13388
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'Dalai Felinto
Merge conflict: Makes sure master is still alpha, while 3.0 is rc.
2021-11-25Fix T90082: Autoscrolling after renaming in the File Browser brokenPhilipp Oeser
Caused by 6b0869039a40 Above commit introduced selection after renaming. This includes calling `file_select_deselect_all` [which resorts and refilters]. So now, to have the correct file for scrolling, get it again after sorting by calling `file_params_find_renamed` again. Differential Revision: https://developer.blender.org/D13368
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-24UI: Blend File Icons Thumbnail ViewHarley Acheson
Changes icon used to indicate blend file when overlaid over larger document icon when in thumbnail view. Only seen when file does not have a preview. Followup to {rB611e4ffaab43} For more details and examples see D13342 Differential Revision: https://developer.blender.org/D13342 Reviewed by Julian Eisel
2021-11-24UI: Blend File Icons Thumbnail ViewHarley Acheson
Changes icon used to indicate blend file when overlaid over larger document icon when in thumbnail view. Only seen when file does not have a preview. Followup to {rB611e4ffaab43} For more details and examples see D13342 Differential Revision: https://developer.blender.org/D13342 Reviewed by Julian Eisel
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-24AssetBrowser: Disable asset indexing.Jeroen Bakker
Asset Indexing is disabled for now as it requires {D12990} to support object snapping.
2021-11-24T91406: Asset Library IndexingJeroen Bakker
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
2021-11-24Cleanup: unused variableGermano Cavalcante
2021-11-24Fix (unreported): Local preview icons not loadingGermano Cavalcante
Bug introduced in {rB9d7422b817d1}. The solution is not an init thread for preview tasks that won't complete.
2021-11-23Asset: Merge asset library/list refresh operatorsJulian Eisel
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
2021-11-23Asset: Merge asset library/list refresh operatorsJulian Eisel
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
2021-11-23Merge branch 'blender-v3.0-release'Bastien Montagne
2021-11-23Icons: Replace .blend file icons, add "Current File" iconJulian Eisel
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.
2021-11-23Merge remote-tracking branch 'origin/blender-v3.0-release'Sybren A. Stüvel
2021-11-23Asset Browser: add operator for installing asset bundlesSybren A. Stüvel
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
2021-11-20Cleanup: unset 'FILE_ENTRY_PREVIEW_LOADING' at the endGermano Cavalcante
Although this function only runs on the main thread, it seems safer to clear the flag only after setting the result.
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-19Merge remote-tracking branch 'origin/blender-v3.0-release'Sybren A. Stüvel
2021-11-19Asset Browser: don't display linked-in asset datablocksSybren A. Stüvel
Datablocks marked as asset, linked from another file, were shown in the "Current File" asset library. This is now resolved.
2021-11-18Merge remote-tracking branch 'origin/blender-v3.0-release'Sybren A. Stüvel
2021-11-18Asset tags: include partial tag matchesSybren A. Stüvel
When filtering the asset browser, also include results that have partial tag matches. So searching for "xite" will include results tagged with "excited". This brings the tag filtering in line with other search boxes in Blender. Later we might want to provide users with more options for prefix-only ("excite" would match "excited", but "xited" would not) or only exact matches.
2021-11-18Merge branch 'blender-v3.0-release'Julian Eisel
2021-11-18Fix asset preview not showing up for current file data-blocksJulian Eisel
For data-blocks from the current file, the image-buffer for dragging wasn't set at all. This wasn't intentional, dragging things in the Asset Browser should just always show the preview.
2021-11-16File Browser: Improve usage of threads in the creation of thumbnailsGermano Cavalcante
Due to asynchronous process, the preview for a given image may be generated several times. This regenerates many thumbs unnecessarily. The solution is to add the `FILE_ENTRY_PREVIEW_LOADING` flag for file entries that are still in the thread queue. So this flag is checked not to redraw the thumb when it is still being created on a different thread. Differential Revision: https://developer.blender.org/D11150
2021-11-16Merge remote-tracking branch 'origin/blender-v3.0-release'Sybren A. Stüvel
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-12Merge remote-tracking branch 'origin/blender-v3.0-release'Sybren A. Stüvel
2021-11-12Fix crash in asset browser when switching from file browserSybren A. Stüvel
When the file browser is in asset browser mode, it sets the callback `filelist->prepare_filter_fn` to an asset browser specific function. This function will segfault if there is no current asset library. Switching back from asset browser to file browser would not reset that callback to `NULL`, causing it to be called and crash Blender. This is now fixed.
2021-11-02Merge branch 'blender-v3.0-release'Bastien Montagne