WIP: Basic support for registering asset shelf as a type in BPY #104991

Closed
Julian Eisel wants to merge 73 commits from JulianEisel:temp-asset-shelf-type-bpy into asset-shelf

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

73 Commits

Author SHA1 Message Date
Julian Eisel b3734c2dce Merge branch 'main' into temp-asset-shelf-type-bpy 2023-03-20 11:55:41 +01:00
Julian Eisel 488713e6f8 Merge branch 'asset-shelf' into temp-asset-shelf-type-bpy 2023-02-27 12:26:03 +01:00
Julian Eisel a0b5fda5af Fix build error 2023-02-27 12:25:40 +01:00
Julian Eisel d64078a28f Fix build error 2023-02-27 12:24:58 +01:00
Julian Eisel 706240da6f Merge branch 'asset-shelf' into temp-asset-shelf-type-bpy 2023-02-27 11:50:10 +01:00
Julian Eisel 16702ea274 Fix typo from merge conflict resolving 2023-02-27 11:49:52 +01:00
Julian Eisel 19dbb4bfdc Merge branch 'main' into asset-shelf 2023-02-27 11:45:01 +01:00
Julian Eisel 6985a95d93 Merge branch 'main' into temp-asset-shelf-type-bpy 2023-02-27 11:42:57 +01:00
Julian Eisel 1e31d65986 Cleanup: Minor comment formatting change 2023-02-22 14:27:16 +01:00
Julian Eisel 36326ab736 Merge branch 'temp-asset-shelf-type-bpy' into asset-shelf 2023-02-21 18:49:56 +01:00
Julian Eisel 2cbf647d9c Temporary design to support filtering assets by type
Python defined asset shelfs can now define an `asset_poll__()` function
to determine if an asset should be visible or not, based on type
information. This isn't great and can probably be a performance issue in
bigger libraries. A proper solution would be to provide a set of asset
traits to filter by, but this is a bit tricky to implement. This is a
temporary solution so the brush assets project isn't held up by this.
2023-02-21 18:47:11 +01:00
Julian Eisel 1ede8e033c Merge branch 'main' into temp-asset-shelf-type-bpy 2023-02-21 15:29:55 +01:00
Julian Eisel d6c4ca72dd Merge branch 'main' into temp-asset-shelf-type-bpy 2023-02-21 15:23:13 +01:00
Julian Eisel 3a3b444c8e Fix new essentials asset library not being covered in library path query 2023-02-21 14:50:19 +01:00
Bastien Montagne de27f63ac4 Brush: Add writing and reading ID preview for Brushes.
Mandatory change for the Brush Assets project, from quick test does not
seem to break anything (more) in existing 'old' brushes...

Re. #101908.

Pull Request #105016
2023-02-21 14:50:19 +01:00
Brecht Van Lommel e24ea1483c Fix Cycles MetalRT access of macOS 11 features when unavailable
After recent changes in 2d994de.

Pull Request #104976
2023-02-21 14:50:19 +01:00
Brecht Van Lommel bbf7dacbb0 Gitea: more updates for new scoped label syntax 2023-02-21 14:50:19 +01:00
Brecht Van Lommel 451458bad9 Gitea: update for new scoped label syntax 2023-02-21 14:50:19 +01:00
Falk David b6a2d0cebd Curves: Add cursor snapping support
This adds support for cursor snapping for the new curves object.

It implements a function `transverts_from_curves_positions_create` (to separate the logic from the `Curves` object type). That function is then C wrapped by `ED_curves_transverts_create` and finally used in `ED_transverts_create_from_obedit`.

Pull Request #104967
2023-02-21 14:50:19 +01:00
Falk David 2d8b1455bc Curves: Fix proportional editing not working
This adds proper support for proportional editing for the Curves object.

Co-authored-by: Hans Goudey <h.goudey@me.com>
Pull Request #104620
2023-02-21 14:50:19 +01:00
Sergey Sharybin 7fe04f68a0 Cleanup: Mark overriden virtual call as such
Fixes the `-Winconsistent-missing-override` warning.

In theory the `virtual` is redundant in such case, but this is how
it is done in may other areas of USD code.

Pull Request #104977
2023-02-21 14:50:19 +01:00
Antonio Vazquez 37a2e81747 Fix #104979: GPencil Dot-hash only affects first frame with Time mod
The active frame must be recovered using `BKE_gpencil_frame_retime_get`
2023-02-21 14:50:19 +01:00
Christoph Lendenfeld ffebf8685f Fix: Channel clamping when markers are used
Previously when markers were used, the newly introduced clamping code (#104516) would stop the last channel from being shown.

This patch fixes that by modifying the `v2d->tot.ymin` calculation.

This is a bit counterintuitive since the `v2d->tot` height is calculated in `action_draw.c`. But the advantage of doing it there is that it also works for the channels region.

Pull Request #104892
2023-02-21 14:50:19 +01:00
Jesse Yurkovich 57705d9f98 Tests: Address imbuf_save failures on ARM64 builds
This does 2 things to address the ARM64 failures:
- Increases the threshold to be inline with what Cycles uses
- Disables the 2 problematic WebP variations (#105006 will track)
2023-02-21 14:50:19 +01:00
Chris Blackbourn e21911a0c3 Cleanup: format 2023-02-21 14:50:19 +01:00
Jesse Yurkovich 615958c449 Tests: Add tests for image format saving and loading
This adds saving and loading tests for our supported image formats.

**Saving - bf_imbuf_save.py**
There are 2 template images which are loaded anew for each file save
attempt.  One is an 8-bit RGBA image and the other 32-bit. This is
required as many formats use a variety of factors to determine which of
`ibuf->rect` or `ibuf->rectfloat` to use for processing.  The templates
are constructed to have alpha transparency as well as values > 1 (or
clamped to 1 for the case of the 8-bit template).

Test flow:
 - Load in an appropriate template image
 - Save it to the desired format with the desired set of options
 - Compare against the reference image

Notes:
 - 98 references are used totaling ~3.6MB
 - 10-12 second test runtime
 - Templates can be reconstructed with the create-templates.blend file

**Loading - bf_imbuf_load.py**
Test flow:
 - Load in each of the reference images
 - Save them back out as .exr
 - Save additional metadata to a secondary file (alpha mode, colorspace etc)
 - Compare the saved out .exr with another set of reference .exrs
 - Compare the saved out file metadata with set of reference metadata

Notes:
 - 98 exr references are used totaling ~10MB
 - 10-12 second test runtime as well

A HTML report is not implemented. The diff output organization is very
similar to the other tests so it should be somewhat easy to do in the
future if we want.

The standard set of environment variables are implemented for both:
BLENDER_TEST_UPDATE, BLENDER_VERBOSE, and BLENDER_TEST_COLOR

Pull Request #104442
2023-02-21 14:50:19 +01:00
Joseph Eagar 8f2a9bc116 Sculpt: Implement mesh filter cancel
Added new function sculpt_mesh_filter_cancel in sculpt_filter_mesh.cc
for cancelling mesh filters. It currently is unused pending a
revamped modal map for mesh filter (see pull req 104718).
2023-02-21 14:50:19 +01:00
Joseph Eagar b3a5c8df62 BMesh: fix invalid existence check in BM_mesh_bm_to_me
Remember that the null customdata layer index is -1,
not 0.
2023-02-21 14:50:19 +01:00
Chris Blackbourn 5de924a656 Fix test
Pull Request #104934
2023-02-21 14:50:19 +01:00
Chris Blackbourn eefaa1f8fa BLI_math: fix parameter aliasing in mul_m3_series and mul_m4_series
No functional changes.
2023-02-21 14:50:19 +01:00
Leon Schittek 8ff42046ab Fix #82936: Make Geometry Nodes modifier icon blue in outliner
In the outliner, the icons for modifiers are tinted blue. This didn't
work for the geometry nodes modifier icon.

Defining the icon with the macro `DEF_ICON_MODIFIER` also
defines the appropriate theme color so it's now tinted blue
when drawn in the outliner like the other modifier icons.

Pull Request #104957
2023-02-21 14:50:19 +01:00
Hans Goudey ac17d02993 Nodes: Allow adding multiple search items per type in add menu
Add a per node type callback for creating node add search operations,
similar to the way link drag search is implemented (11be151d58).

Currently the searchable strings have to be separate items in the list.
In a separate step, we can look into adding invisible searchable text
to search items if that's still necessary.

Resolves #102118

Pull Request #104794
2023-02-21 14:50:19 +01:00
Julian Eisel dcb1147eef Basic support for registering asset shelf as a type in BPY
For example, the pose library add-on can now register an asset shelf
like this:

```
class VIEW3D_AST_pose_library(bpy.types.AssetShelf):
    bl_space_type = "VIEW_3D"

    @classmethod
    def poll(cls, context: Context) -> bool:
        return PoseLibraryPanel.poll(context)
```

Filtering by ID type is not supported yet.

This replaces the hack of registering a header type and the asset shelf
template to draw into that.
2023-02-20 20:48:59 +01:00
Julian Eisel 38833c26e4 Cleanup: Minor correction in comment 2023-02-20 17:11:22 +01:00
Julian Eisel 11b871728b Merge branch 'main' into asset-shelf 2023-02-20 17:10:22 +01:00
Julian Eisel 8b9db43ca0 Merge branch 'main' into asset-shelf
buildbot/vexp-code-patch-coordinator Build done. Details
2023-02-16 17:47:28 +01:00
Julian Eisel baf45e1ac8 Show asset name in tooltip, add a small gap before catalog tabs 2023-02-03 15:50:22 +01:00
Julian Eisel 002158c26f Fix asset shelf footer region resizing using wrong coordinates 2023-02-03 15:50:08 +01:00
Julian Eisel 2110b71f1c Allow operators to override asset applying on click through the keymap 2023-02-03 15:41:48 +01:00
Julian Eisel 4b4cf6da9a Merge branch 'master' into asset-shelf 2023-02-02 17:02:10 +01:00
Julian Eisel 56582fbf82 Get filtering by asset catalog to work 2023-02-01 16:26:30 +01:00
Julian Eisel d5c60f912f Tabs to activate a catalog
The tabs should be fully working themselves, however we don't filter
the asset shelf contents based on the active catalog (well, catalog
path) yet.

Includes the changes from D17164.
2023-02-01 12:49:55 +01:00
Julian Eisel 3700b74476 Merge branch 'temp-uibut-non-trivial-construction' into asset-shelf 2023-02-01 11:25:36 +01:00
Julian Eisel c4176781d3 Fix assert failures because of unexpected RNA index default 2023-01-31 17:37:36 +01:00
Julian Eisel 3a34c91448 Cleanup: Remove unnecessary macro & unnecessary cast 2023-01-31 17:32:05 +01:00
Julian Eisel b4edc40fb8 UI: Make uiBut safe for non-trivial construction
Essentially, I wanted to use a non-trivially-constructible C++ type
(`std::function`) inside `uiBut`. But this would mean we can't use
`MEM_cnew()` like allocation anymore.

Rather than writing worse code, allow non-trivial construction for
`uiBut`. Member-initializing all members is annoying since there are so
many, but rather safe than sorry. As we use more C++ types (e.g. convert
callbacks to use `std::function`), this should become less since they
initialize properly on default construction.

Also use proper C++ inheritance for `uiBut` subtypes, the old way to
allocate based on size isn't working anymore.

Differential Revision: https://developer.blender.org/D17164
2023-01-31 17:26:29 +01:00
Julian Eisel db77a9c55e Merge branch 'master' into asset-shelf 2023-01-31 11:24:51 +01:00
Julian Eisel 4fa69fbda8 Popup to select which catalogs are displayed in the asset shelf footer
The selected catalogs are currently listed as simple labels in the
footer, just for testing.
2023-01-19 11:50:45 +01:00
Julian Eisel 47c9c31138 Merge branch 'master' into asset-shelf 2023-01-18 18:32:25 +01:00
Julian Eisel b3ee7ad2cc Extend asset shelf region with a region for the catalogs & options
The new region is empty, except of a dummy button.
2023-01-17 16:24:03 +01:00
Julian Eisel 8ddf492e7c Basic asset shelf prototype
Adds the necessary bits to be able to show an asset shelf template via
the pose library add-on.
2023-01-17 15:18:17 +01:00
Julian Eisel 0e3f5c6673 Merge branch 'master' into asset-shelf 2023-01-17 13:08:57 +01:00
Julian Eisel 9b00338ed4 Merge branch 'master' into asset-shelf 2023-01-16 17:22:56 +01:00
Julian Eisel d6df32a6f8 Add basic (empty) asset shelf region 2022-12-07 20:00:27 +01:00
Julian Eisel 3cd93ace24 Simple progress reporting for all library
Progress bar display the file reading (and other operations) is actually
broken in master for a while, so this won't actually be reported. Still
calculate it for once it's fixed.
2022-12-07 18:29:38 +01:00
Julian Eisel e8575bfd4a General cleanup (comments, remove outdated TODO marks, naming) 2022-12-07 18:20:05 +01:00
Julian Eisel 747a9ea263 Make catalogs from "All" library read-only
Loading the asset library will create a read-only catalog service. The
read-only nature is not dealt with much in the asset catalog code, the
using code (e.g. the UI) is responsible for respecting it.
2022-12-06 17:02:05 +01:00
Julian Eisel af0c1d72a2 Merge branch 'master' into temp-asset-library-all 2022-12-06 11:57:01 +01:00
Julian Eisel 11abc1be39 Use "All" library for node search menu building
Code was manually building the search menu items from all asset
libraries, this is simpler now.
2022-12-02 20:29:12 +01:00
Julian Eisel ecc25bc62e Use "All" library for node add menu building
Code was manually building the add menu from all asset libraries, this
should be simpler now.
2022-12-02 20:23:54 +01:00
Julian Eisel a07a2e2369 Avoid redundant loading of catalogs and "All" library processing 2022-12-02 19:37:43 +01:00
Julian Eisel af5d225653 Load catalogs for "All" asset library
Merges the catalog definitions from all asset libraries in to the
storage of the "All" one, builds the catalog tree and refreshes data as
needed. This doesn't allow writing changes back to the catalog
definition files, so the UI probably shouldn't allow edits.
2022-12-02 19:20:37 +01:00
Julian Eisel 1dc8305213 Merge branch 'master' into temp-asset-library-all 2022-12-02 19:18:18 +01:00
Julian Eisel fb2303fb73 Avoid ugly nested library storage
We actually don't have to do this, since we can just iterate over all
loaded libraries after calling the loading for the "All" asset library.
2022-12-02 16:58:47 +01:00
Julian Eisel 5186c9c9c6 Merge remote-tracking branch 'origin/master' into temp-asset-library-all 2022-12-02 16:20:28 +01:00
Julian Eisel 126136baab Fix missing asset previews and broken drag & drop in "All" library
Together with the changes made in master, all this does is making sure
the assets are loaded and removed using the correct asset library nested
within the "All" library. Now full paths for the assets can be built
correctly from the asset identifier, which fixes preview loading and
drag & drop.
2022-11-30 20:19:30 +01:00
Julian Eisel 3f1e4f6f56 Merge branch 'master' into temp-asset-library-all 2022-11-30 20:02:29 +01:00
Julian Eisel 03bd437170 Merge branch 'master' into temp-asset-library-all 2022-11-30 19:49:29 +01:00
Julian Eisel 2c2515d465 Merge branch 'master' into temp-asset-library-all 2022-11-29 11:14:41 +01:00
Julian Eisel d51212c4f0 Integrate "All" library better with the asset system
Now it actually loads data from all asset libraries when this is
selected. The asset representations still need to be loaded by the file
browser backend, this won't change for now.

This adds the concept of nested asset libraries, which I'd prefer to
keep as implementation detail and not expose in the API. But for now
it's needed (for the asset representation loading by the file browser
backend).
2022-11-28 19:37:00 +01:00
Julian Eisel 86b9b1df22 Merge branch 'master' into temp-asset-library-all 2022-11-28 15:44:59 +01:00
Julian Eisel ca8fa2f7d6 Merge branch 'master' into temp-asset-library-all 2022-11-24 16:25:39 +01:00
Julian Eisel 33bcc4f430 Initial "All" asset library loading support
An "All" asset library can be selected in the Asset Browser and asset
view templates now, and that will load all assets from all asset
libraries. Preview loading, drag & drop and asset catalogs don't work
yet.
2022-11-22 17:59:29 +01:00