UI: Asset Shelf (Experimental Feature) #104831

Closed
Julian Eisel wants to merge 399 commits from asset-shelf into main

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

This introduces asset shelves as a new standard UI element for accessing assets. Based on the current context (like the active mode and/or tool), they can provide assets for specific workflows/tasks. As such they are more limited in functionality than the asset browser, but a lot more efficient for certain tasks.

The asset shelf is developed as part of the brush assets project (#101895: Brush Asset Project), but is also meant to serve as the next version of the pose library UI.

Support for asset shelves can quite easily be added to different editor types, this PR does so for the 3D view. If an editor type supports asset shelves, add-ons can chose to register an asset shelf type for an editor with just a few lines of Python.

It should be possible to entirely remove UILayout.asset_view_template() once this is in use.

Some changes are to be expected still.

Task: #102879
Brush asset workflow blog post: https://code.blender.org/2022/12/brush-assets-workflow/
Initial technical documentation: https://developer.blender.org/docs/asset_system/user_interface/asset_shelf/

How to test

There are 3 easy ways to test the asset shelf - the experimental Asset Shelf option needs to be enabled:

Pose Library

  • Requires asset-shelf add-ons branch to be checked out, make update does this.
  • Open the Ellie Pose Library asset bundle (if you don't have a library set up with poses): https://www.blender.org/download/demo-files/#assets
  • Ensure you're in a 3D View in Pose Mode

Python Template

Brush Assets (Extended Asset Browser)

  • Requires the Extended Asset Browser experimental option to be enabled.
  • Enter sculpt mode in a 3D View.
  • Mark some brushes as assets.

Note that the work is still ongoing, but this should be ready to be merged into main soon, at least as experimental feature. See #107498 for the remaining pre-merge TODOs.

Tasks:

Updates to Pose Library Add-on: #104546: WIP: Update Pose Library add-on to use the asset shelf

This introduces asset shelves as a new standard UI element for accessing assets. Based on the current context (like the active mode and/or tool), they can provide assets for specific workflows/tasks. As such they are more limited in functionality than the asset browser, but a lot more efficient for certain tasks. <img src="https://projects.blender.org/attachments/65225972-e58b-4667-a31d-b98375d7270f"> The asset shelf is developed as part of the brush assets project ([#101895: Brush Asset Project](https://projects.blender.org/blender/blender/issues/101895)), but is also meant to serve as the next version of the pose library UI. Support for asset shelves can quite easily be added to different editor types, this PR does so for the 3D view. If an editor type supports asset shelves, add-ons can chose to register an asset shelf type for an editor with just a few lines of Python. It should be possible to entirely remove `UILayout.asset_view_template()` once this is in use. Some changes are to be expected still. Task: #102879 Brush asset workflow blog post: https://code.blender.org/2022/12/brush-assets-workflow/ Initial technical documentation: https://developer.blender.org/docs/asset_system/user_interface/asset_shelf/ ## How to test There are 3 easy ways to test the asset shelf - **the experimental *Asset Shelf* option needs to be enabled**: **Pose Library** - Requires `asset-shelf` add-ons branch to be checked out, `make update` does this. - Open the *Ellie Pose Library* asset bundle (if you don't have a library set up with poses): https://www.blender.org/download/demo-files/#assets - Ensure you're in a 3D View in Pose Mode **Python Template** - Open the *Cube Diorama* asset bundle (if you don't have a library set up with objects/materials): https://www.blender.org/download/demo-files/#assets - In the Text Editor, run the template under *Templates* > *Python* > *Ui Asset Shelf* **Brush Assets (*Extended Asset Browser*)** - Requires the *Extended Asset Browser* experimental option to be enabled. - Enter sculpt mode in a 3D View. - Mark some brushes as assets. ---- Note that the work is still ongoing, but this should be ready to be merged into main soon, at least as experimental feature. See #107498 for the remaining pre-merge TODOs. Tasks: - [#102879: Asset Shelf (for brush assets, pose libraries, etc.)](https://projects.blender.org/blender/blender/issues/102879) - [#107498: Get pose library asset shelf ready for merge into main, experimental feature](https://projects.blender.org/blender/blender/issues/107498) - [#107881: Asset shelf UI Polish](https://projects.blender.org/blender/blender/issues/107881) - [✅ ~~#107784: Name filtering for Asset Shelf assets~~](https://projects.blender.org/blender/blender/issues/107784) - [#107785: Shortcut to toggle the asset shelf region](https://projects.blender.org/blender/blender/issues/107785) Updates to Pose Library Add-on: [#104546: WIP: Update Pose Library add-on to use the asset shelf](https://projects.blender.org/blender/blender-addons/pulls/104546)
Julian Eisel added 38 commits 2023-02-16 17:50:31 +01:00
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.
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).
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.
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.
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.
Code was manually building the add menu from all asset libraries, this
should be simpler now.
Code was manually building the search menu items from all asset
libraries, this is simpler now.
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.
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.
Adds the necessary bits to be able to show an asset shelf template via
the pose library add-on.
The new region is empty, except of a dummy button.
The selected catalogs are currently listed as simple labels in the
footer, just for testing.
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
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.
Merge branch 'main' into asset-shelf
Some checks failed
buildbot/vexp-code-patch-coordinator Build done.
8b9db43ca0
Author
Member

@blender-bot build

@blender-bot build
Julian Eisel added 2 commits 2023-02-20 17:11:51 +01:00
Julian Eisel added this to the Brush Assets & Asset Shelf project 2023-02-20 20:58:58 +01:00
Julian Eisel added 19 commits 2023-02-21 15:22:48 +01:00
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
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
No functional changes.
Pull Request #104934
Remember that the null customdata layer index is -1,
not 0.
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).
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
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)
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
The active frame must be recovered using `BKE_gpencil_frame_retime_get`
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
This adds proper support for proportional editing for the Curves object.

Co-authored-by: Hans Goudey <h.goudey@me.com>
Pull Request #104620
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
After recent changes in 2d994de.

Pull Request #104976
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
Julian Eisel added 5 commits 2023-02-21 18:50:30 +01:00
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.
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.
Julian Eisel added 1 commit 2023-02-22 14:28:19 +01:00
Julian Eisel added 3 commits 2023-02-27 17:02:04 +01:00
Julian Eisel added 1 commit 2023-02-27 17:12:41 +01:00
Julian Eisel added 1 commit 2023-02-28 12:04:09 +01:00
Makes code more focused, improving local readability.
Julian Eisel added 1 commit 2023-02-28 12:20:40 +01:00
Julian Eisel added 1 commit 2023-03-02 17:30:20 +01:00
Julian Eisel added 1 commit 2023-03-03 16:44:49 +01:00
Julian Eisel added 1 commit 2023-03-06 11:45:39 +01:00
Julian Eisel added 1 commit 2023-03-07 11:11:08 +01:00
Julian Eisel added 1 commit 2023-03-07 11:31:29 +01:00
Julian Eisel added 1 commit 2023-03-08 16:56:34 +01:00
Julian Eisel added 1 commit 2023-03-09 16:14:01 +01:00
Bastien Montagne added 1 commit 2023-03-10 18:11:34 +01:00
Julian Eisel added 1 commit 2023-03-16 16:10:55 +01:00
Bastien Montagne added 1 commit 2023-03-16 21:04:34 +01:00
Julian Eisel added 2 commits 2023-03-20 11:54:17 +01:00
Bastien Montagne added 1 commit 2023-03-21 12:51:07 +01:00
Bastien Montagne added 1 commit 2023-03-21 17:17:26 +01:00
Bastien Montagne added 1 commit 2023-03-21 17:17:37 +01:00
Bastien Montagne added 1 commit 2023-03-21 18:50:34 +01:00
Julian Eisel added 1 commit 2023-03-22 11:15:00 +01:00
Bastien Montagne added 1 commit 2023-03-23 11:54:49 +01:00
Julian Eisel added 1 commit 2023-03-27 12:19:35 +02:00
Bastien Montagne added 33 commits 2023-03-29 11:32:11 +02:00
I thought the tests passed, what did I doo??..
Cleanup: struct member order
Some checks failed
buildbot/vexp-code-patch-coordinator Build done.
819933cc2e
Attempt to fix linker error on GCC
All checks were successful
buildbot/vexp-code-patch-coordinator Build done.
3e844fb2dc
Includes unit tests.
- Use (arguably) more readable return type instead of return arguments.
- Update function API comment.
- Use more clear (because more direct) return values
Basic unit tests for the new path resolving and exploding function
Some checks failed
buildbot/vexp-code-patch-coordinator Build done.
9a56b28771
Merge branch 'main' into temp-asset-weak-reference
Some checks failed
buildbot/vexp-code-patch-coordinator Build done.
974ebe4864
Merge branch 'main' into temp-asset-weak-reference
Some checks failed
buildbot/vexp-code-patch-coordinator Build done.
ce2ef6b9cc
Fix test failure on macOS because of short string optimization of moved result
Some checks failed
buildbot/vexp-code-patch-coordinator Build done.
4710dc0337
Since we pass around a struct with a string, and multiple string-references
into this string, we have to make sure the memory address of the string buffer
never changes. It would seem that move semantics give this behavior, but it
wouldn't work for short strings. When moving a string, short string
optimization would still require the string to be copied, not moved, causing a
change in the memory address. GCC and Clang use different definitions of "short
string", causing differences in behavior.

Wrap the string in a unique pointer, so the string itself is never moved or
copied.
Attempt to fix normilizing ID name part of paths.
Some checks failed
buildbot/vexp-code-patch-coordinator Build done.
e27067d7ac
Further fixes to path handling.
Some checks failed
buildbot/vexp-code-patch-coordinator Build done.
ba73275532
debug prints are intended for now.
More fixes.
All checks were successful
buildbot/vexp-code-patch-coordinator Build done.
3dc872af0e
Cleanup.
All checks were successful
buildbot/vexp-code-patch-coordinator Build done.
e8bd93685b
Julian Eisel added 1 commit 2023-03-30 12:47:52 +02:00
Julian Eisel added 1 commit 2023-03-30 15:51:49 +02:00
Bastien Montagne added 1 commit 2023-03-30 18:42:15 +02:00
Bastien Montagne added 1 commit 2023-04-01 20:20:55 +02:00
Bastien Montagne added 1 commit 2023-04-03 16:03:52 +02:00
Julian Eisel added 2 commits 2023-04-05 16:16:39 +02:00
Julian Eisel added 1 commit 2023-04-06 12:11:14 +02:00
Julian Eisel added 1 commit 2023-04-07 11:39:20 +02:00
Julian Eisel added 2 commits 2023-04-07 11:58:50 +02:00
Julian Eisel added 1 commit 2023-04-07 13:09:35 +02:00
Bastien Montagne added 1 commit 2023-04-07 14:34:45 +02:00
Bastien Montagne added 1 commit 2023-04-07 16:03:34 +02:00
Julian Eisel added 2 commits 2023-04-11 18:33:02 +02:00
Bastien Montagne added 1 commit 2023-04-12 15:18:26 +02:00
Bastien Montagne added 1 commit 2023-04-12 16:25:59 +02:00
Julian Eisel added 2 commits 2023-04-12 17:28:41 +02:00
Julian Eisel added 1 commit 2023-04-13 15:58:06 +02:00
Julian Eisel added 1 commit 2023-04-14 12:02:18 +02:00
Julian Eisel added 1 commit 2023-04-14 12:51:11 +02:00
Bastien Montagne added 1 commit 2023-04-18 11:18:10 +02:00
Bastien Montagne added 1 commit 2023-04-20 11:39:49 +02:00
Bastien Montagne added 1 commit 2023-04-21 11:02:51 +02:00
Julian Eisel added 1 commit 2023-05-01 12:28:56 +02:00
Julian Eisel added 2 commits 2023-05-02 15:10:57 +02:00
Julian Eisel added 2 commits 2023-05-05 16:34:35 +02:00
Julian Eisel added 2 commits 2023-05-10 19:02:29 +02:00
Julian Eisel added 1 commit 2023-05-12 15:24:00 +02:00
Julian Eisel added 2 commits 2023-05-15 20:01:53 +02:00
Julian Eisel added 2 commits 2023-05-17 11:38:10 +02:00
Julian Eisel added 2 commits 2023-05-17 18:40:06 +02:00
Julian Eisel added 63 commits 2023-05-17 23:27:30 +02:00
This is the main change needed to properly implement the asset shelf
main region. Loading, displaying, catalog based and type based filtering
work, custom drag & activation operators don't yet. There is no
paginated scrolling or so yet, but scrolling is vertical now (to be
evaulated).
Was only needed for the old asset shelf main region implementation, and
caused some issues (e.g. too small buttons in status bar).
A bit more space efficient this way, and looks better IMO.
Looks visually more appealing IMHO.
This just makes the UI feel more "stable" since things don't move around
as much anymore.
Set the default size later as part of regular area/region setup, when
DPI is available. Also use `uiStyle` paddings.
This means the view always scrolls by a full row, so that asset previews
are never partially in view.

The paginated scrolling is implemented as a standard View2D feature.
This doesn't work well with zooming yet, and it's tricky to get that to
work right.
We want to support different preview sizes, but the regular region
zooming makes things overly complicated (because of the pagination
and region size snapping mostly). Plus region zooming would usually zoom
text as well. So the preview size is better managed separately.
An offset was applied for transparent regions, so the hotspot is closer
to where the user expects (closer to the visual content). But this only
makes sense if the background is actually transparent or close to at
least.
Merge branch 'asset-shelf' into temp-asset-shelf-grid-view
Some checks failed
buildbot/vexp-code-patch-coordinator Build done.
0a1c2059a0
Feedback is that this looks a bit odd, so rather keep it disabled.
Enables the triangle showing this popup was spawned from a button, uses
more padding (consistent with other popovers) and simplifies code.
View items now always display mouse hover highlight, regardless of the
embossing (might want to give more precise control for this though).

- Made the active state of items visible, so had to add a way to disable
  that.
- Had to make the view item mouse hover highlight work in popups.
Merge branch 'asset-shelf' into temp-asset-shelf-grid-view
All checks were successful
buildbot/vexp-code-patch-coordinator Build done.
93f65d70c3
Part of #107881.
Avoid redundancy. Part of #107881.
Merge branch 'asset-shelf' into temp-asset-shelf-grid-view
All checks were successful
buildbot/vexp-code-patch-coordinator Build done.
a48aaa4c96
AFAIK this doesn't work in master either. Issue is that the operator
relies on context that is only available in the asset shelf region (or
with the mouse over the asset-view template). So the correct region has
to be restored for redo to make this work.
Fix possible crash on file read
All checks were successful
buildbot/vexp-code-patch-coordinator Build done.
1fd5097d03
Julian Eisel added 1 commit 2023-05-18 00:26:49 +02:00
Make overriding asset drag for pose blending work
Some checks failed
buildbot/vexp-code-patch-coordinator Build done.
67db4448de
Adds a `bl_option` to asset shelf type definitions to disable the
default asset dragging (`NO_ASSET_DRAG`), so the drag event can be
overridden by custom keymap items.
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR104831) when ready.
Julian Eisel added 1 commit 2023-05-18 01:48:04 +02:00
In the Python asset shelf type definition, a `draw_context_menu()`
function can be defined now.
Julian Eisel added 2 commits 2023-05-19 14:39:21 +02:00
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR104831) when ready.
Julian Eisel added 1 commit 2023-05-19 15:41:19 +02:00
Julian Eisel added 2 commits 2023-05-19 16:54:04 +02:00
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR104831) when ready.
Julian Eisel added 1 commit 2023-05-22 15:54:34 +02:00
It's now possible to have multiple asset shelf types registered for
different contexts (e.g. sculpt mode vs. texture paint mode vs. pose
mode) and the settings are kept separate. For this a proper concept of
an active asset shelf is introduced. Basically only one asset shelf can
be active at a time, but we keep multiple shelves in storage, so we can
switch between them while all settings are preserved.
Julian Eisel added 2 commits 2023-05-22 17:03:34 +02:00
Only shows up when both the "Asset Shelf" and the "Extended Asset
Browser" experimental features are enabled.
Julian Eisel added 1 commit 2023-05-22 17:04:17 +02:00
Merge branch 'main' into asset-shelf
Some checks failed
buildbot/vexp-code-patch-coordinator Build done.
c12ac8bef6
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR104831) when ready.
Julian Eisel added 1 commit 2023-05-24 22:19:38 +02:00
- No Ctrl+F shortcut to activate search yet.
- No filtering by tags yet.
Julian Eisel added 1 commit 2023-05-31 13:08:46 +02:00
Julian Eisel added 1 commit 2023-05-31 17:06:21 +02:00
Julian Eisel added 1 commit 2023-06-05 15:40:08 +02:00
Julian Eisel added 2 commits 2023-06-05 16:29:02 +02:00
Julian Eisel added 1 commit 2023-06-06 11:22:49 +02:00
Julian Eisel added 2 commits 2023-06-06 12:19:17 +02:00
Julian Eisel added 1 commit 2023-06-06 12:59:44 +02:00
Julian Eisel added 1 commit 2023-06-06 13:15:38 +02:00
Julian Eisel added 2 commits 2023-06-06 16:22:18 +02:00
Was only needed for own test files saved in earlier versions.
Julian Eisel added 1 commit 2023-06-06 16:32:51 +02:00
Julian Eisel changed title from WIP: Asset Shelf to UI: Asset Shelf (Experimental Feature) 2023-06-06 19:18:23 +02:00
Julian Eisel added 1 commit 2023-06-06 19:18:53 +02:00
Merge branch 'main' into asset-shelf
All checks were successful
buildbot/vexp-code-patch-coordinator Build done.
cf2809b645
Author
Member

@blender-bot build

@blender-bot build
Julian Eisel requested review from Campbell Barton 2023-06-06 19:22:52 +02:00
Julian Eisel requested review from Brecht Van Lommel 2023-06-06 19:23:16 +02:00
Julian Eisel requested review from Bastien Montagne 2023-06-06 19:24:46 +02:00
Hans Goudey reviewed 2023-06-06 19:31:59 +02:00
@ -0,0 +193,4 @@
void AssetViewItem::build_context_menu(bContext &C, uiLayout &column) const
{
const AssetView &asset_view = dynamic_cast<AssetView &>(get_view());
Member

If the dynamic_cast isn't meant to fail in some cases, it's probably better to use static_cast to avoid bloating the code with dynamic casting.

Also, class methods should generally be accessed with this->

If the dynamic_cast isn't meant to fail in some cases, it's probably better to use `static_cast` to avoid bloating the code with dynamic casting. Also, class methods should generally be accessed with `this->`
Author
Member

Not a fan of using static_cast for down casting. It removes type safety for virtually (pun intended) no benefit. Sure it's unlikely to cause issues here, but if it does it's good to get an exception thrown. There's a language feature designed for this, so I rather use it.

https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rh-dynamic_cast
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c147-use-dynamic_cast-to-a-reference-type-when-failure-to-find-the-required-class-is-considered-an-error

Not a fan of using `static_cast` for down casting. It removes type safety for virtually (pun intended) no benefit. Sure it's unlikely to cause issues here, but if it does it's good to get an exception thrown. There's a language feature designed for this, so I rather use it. https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rh-dynamic_cast https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c147-use-dynamic_cast-to-a-reference-type-when-failure-to-find-the-required-class-is-considered-an-error
Member

Hard to argue with the code guidelines I guess.. Still though, I'd find it clearer to use static_cast, since dynamic_cast gives the impression that the author thinks the cast might fail. But using a reference for the variable negates that impression, making the whole thing confusing. Not a big deal though

Hard to argue with the code guidelines I guess.. Still though, I'd find it clearer to use `static_cast`, since `dynamic_cast` gives the impression that the author thinks the cast might fail. But using a reference for the variable negates that impression, making the whole thing confusing. Not a big deal though
JulianEisel marked this conversation as resolved
@ -0,0 +28,4 @@
#include "asset_shelf.hh"
using namespace blender;
using namespace blender::ed::asset;
Member

These using statements shouldn't be necessary, looks like the whole file is in that namespace.

These `using` statements shouldn't be necessary, looks like the whole file is in that namespace.
JulianEisel marked this conversation as resolved
Bastien Montagne added 1 commit 2023-06-08 15:22:33 +02:00
Julian Eisel added 1 commit 2023-06-08 17:17:20 +02:00
Julian Eisel added 1 commit 2023-06-08 17:41:26 +02:00
Julian Eisel added 2 commits 2023-06-08 18:40:03 +02:00
Julian Eisel added 2 commits 2023-06-08 19:05:30 +02:00
Correct default initial widths of toolbars

Pull Request: #108292
No user visible changes expected.

This is needed in #104831 but makes sense to expose publicly in the
asset system APIs either way. So committing this to the main branch
already.
Julian Eisel added 2 commits 2023-06-09 16:33:38 +02:00
Julian Eisel added 1 commit 2023-06-09 17:23:48 +02:00
Julian Eisel added 1 commit 2023-06-12 11:32:25 +02:00
Julian Eisel added 1 commit 2023-06-12 12:19:18 +02:00
Previously this allowed looking up a view to filter in in any region of
the current area, so Ctrl+F from the asset shelf footer would be
possible. However in own experiments this didn't really add much, so
rather keeping it simple now.
Julian Eisel added 2 commits 2023-06-12 12:26:23 +02:00
Julian Eisel added 2 commits 2023-06-12 12:54:47 +02:00
Julian Eisel added 1 commit 2023-06-12 13:01:11 +02:00
Julian Eisel added 1 commit 2023-06-13 17:42:01 +02:00
Julian Eisel added 1 commit 2023-06-13 17:50:26 +02:00
This is handled in a separate PR now.
Julian Eisel added 1 commit 2023-06-13 18:04:13 +02:00
Julian Eisel added 3 commits 2023-06-13 18:19:21 +02:00

I left some notes on the UI in #107881, and on the asset shelf types design in #102879.

The asset shelf implementation itself looks generally ok from a cursory look, but I have not reviewed in the detail.

The purpose of some of the changes to other UI code are unclear to me, and as mentioned before would be good to have as separate PRs so we can understand better what each one does.

I left some notes on the UI in #107881, and on the asset shelf types design in #102879. The asset shelf implementation itself looks generally ok from a cursory look, but I have not reviewed in the detail. The purpose of some of the changes to other UI code are unclear to me, and as mentioned before would be good to have as separate PRs so we can understand better what each one does.
Julian Eisel added 1 commit 2023-06-15 16:13:50 +02:00
Julian Eisel added a new dependency 2023-06-15 18:14:13 +02:00
Julian Eisel added 4 commits 2023-06-15 18:43:39 +02:00
No user visible changes expected.

Rather than relying on a C-style function pointer with void pointer
arguments, allow storing a `std::function` object, which can hold
arbitrary data in a type safe way. This can be conveniently used with
lambdas, e.g. from #104831:
```
UI_but_func_set(but, [&shelf_settings](bContext &C) {
  shelf::settings_set_all_catalog_active(shelf_settings);
  shelf::send_redraw_notifier(C);
});
```

This is not used yet, but will be with #104831 merged. Replacing the
existing C-style callback with this can be done separately.
Rather assert that these are initialized as expected.
Julian Eisel added 7 commits 2023-06-16 11:28:33 +02:00
No functional changes

In preparation to tackle the following 2 Todos
*  TODO: view scale should factor into this someday too...
* TODO: optimize this to not have to calc stuff out of view too?

I did the following cleanup
* extracted drawing code for `BEZT_IPO_BEZ` into a separate function
* extracted code that calculates the resolution between 2 points into a separate function
* cleaned up comments
* renamed variables to have a more telling name
* moved variables closer to where they are used
* added `const` where possible

Pull Request: #108748
Julian Eisel added 1 commit 2023-06-16 14:15:23 +02:00
Author
Member

The purpose of some of the changes to other UI code are unclear to me, and as mentioned before would be good to have as separate PRs so we can understand better what each one does.

Just as a heads up: I've already merged a bunch of smaller general changes into main, created some patches and some more will follow. A bit of a slow process but I'm on it. (Patch went from 77 changed files to 58 already.)

> The purpose of some of the changes to other UI code are unclear to me, and as mentioned before would be good to have as separate PRs so we can understand better what each one does. Just as a heads up: I've already merged a bunch of smaller general changes into `main`, created some patches and some more will follow. A bit of a slow process but I'm on it. (Patch went from 77 changed files to 58 already.)
Julian Eisel added 1 commit 2023-06-19 18:36:42 +02:00
Julian Eisel added 1 commit 2023-06-20 11:33:04 +02:00
Julian Eisel added 1 commit 2023-06-20 11:40:25 +02:00
These RNA files are now compiled in C++, some adjustments were
necessary.
Julian Eisel added 1 commit 2023-06-20 17:37:41 +02:00
Julian Eisel added 1 commit 2023-06-22 15:09:06 +02:00
Julian Eisel added 1 commit 2023-06-26 18:00:36 +02:00
Julian Eisel added 1 commit 2023-07-03 15:16:36 +02:00
Julian Eisel added 1 commit 2023-07-03 15:52:52 +02:00
Julian Eisel added 1 commit 2023-07-03 15:58:54 +02:00
Julian Eisel added 2 commits 2023-07-05 17:03:28 +02:00
Update to changes in main branch
Some checks failed
buildbot/vexp-code-patch-coordinator Build done.
2640c0acad
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR104831) when ready.
Julian Eisel added 1 commit 2023-07-05 17:52:50 +02:00
Julian Eisel added 1 commit 2023-07-05 18:04:48 +02:00
Julian Eisel added 1 commit 2023-07-06 12:20:31 +02:00
Julian Eisel added 1 commit 2023-07-06 12:47:50 +02:00
Julian Eisel added 2 commits 2023-07-06 15:00:58 +02:00
Julian Eisel added 1 commit 2023-07-06 15:10:20 +02:00
Julian Eisel added 1 commit 2023-07-06 17:13:59 +02:00
Julian Eisel added 1 commit 2023-07-06 18:27:54 +02:00
Going a bit back and forth here, but in latest tests we've decided to
try this again.
Julian Eisel added 2 commits 2023-07-07 12:10:20 +02:00
Julian Eisel added 1 commit 2023-07-07 12:14:26 +02:00
Uncollapse root level catalogs in the catalog selector
Some checks failed
buildbot/vexp-code-patch-coordinator Build done.
1a809193d5
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR104831) when ready.
Julian Eisel added 1 commit 2023-07-10 12:57:23 +02:00
Julian Eisel added 2 commits 2023-07-11 15:50:49 +02:00
Julian Eisel added 1 commit 2023-07-12 15:06:43 +02:00
Julian Eisel added 1 commit 2023-07-12 15:11:24 +02:00
Julian Eisel added 1 commit 2023-07-12 17:22:52 +02:00
Julian Eisel added 1 commit 2023-07-12 18:23:13 +02:00
Julian Eisel added 1 commit 2023-07-13 14:11:23 +02:00
Julian Eisel added 2 commits 2023-07-13 15:04:56 +02:00
No user visible changes expected.

Previously the calculations to skip building the layout for invisible
items used the scrolling offsets quite a bit. These require floating
point math and are managed in other code. So better to minimize use of
this to make code locally more clear & reliable.
Julian Eisel added 1 commit 2023-07-17 11:37:12 +02:00
Julian Eisel added 2 commits 2023-07-17 19:38:15 +02:00
Julian Eisel added 1 commit 2023-07-17 20:10:38 +02:00
In-between state for catalog checkbox when it contains enabled child
All checks were successful
buildbot/vexp-code-patch-coordinator Build done.
166af87035
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR104831) when ready.
Julian Eisel added 1 commit 2023-07-17 20:19:28 +02:00
Brecht Van Lommel requested changes 2023-07-18 18:17:49 +02:00
Brecht Van Lommel left a comment
Owner

I read through all the code, don't really have a lot to say about the implementation specifics. Mainly wondering if we really need the hooks and dedicated region type for settings.

I read through all the code, don't really have a lot to say about the implementation specifics. Mainly wondering if we really need the hooks and dedicated region type for settings.
@ -8248,0 +8264,4 @@
return bool(context.object and context.object.mode == 'SCULPT')
@classmethod
def asset_poll__(cls, asset):

What is the meaning of this double underscore at the end? I know single underscore at the start indicates a private method, but this I have not seen anywhere else in Blender.

What is the meaning of this double underscore at the end? I know single underscore at the start indicates a private method, but this I have not seen anywhere else in Blender.

Checking the name elsewhere this is temporary, so perhaps call it asset_poll_temp_api - however in this case it seems like it should be resolved before considering the PR final.

Checking the name elsewhere this is temporary, so perhaps call it `asset_poll_temp_api` - however in this case it seems like it should be resolved before considering the PR final.
Author
Member

While this was initially meant as temporary design, I think it's fine to keep this callback in the API. It adds more flexibility in deciding which assets should be shown in the shelf, so you don't have to rely purely on traits.
Plus it's unclear if we can get the necessary Python API syntax to work before the release (the bl_asset_traits = {{"Object", "Mesh"}, {"Material"}} kind of syntax), so I prefer not relying on that. Should we get it to work, the API can still be changed before the release.

Changed the code now so this is a regular (non-temporary) API callback.

While this was initially meant as temporary design, I think it's fine to keep this callback in the API. It adds more flexibility in deciding which assets should be shown in the shelf, so you don't have to rely purely on traits. Plus it's unclear if we can get the necessary Python API syntax to work before the release (the `bl_asset_traits = {{"Object", "Mesh"}, {"Material"}}` kind of syntax), so I prefer not relying on that. Should we get it to work, the API can still be changed before the release. Changed the code now so this is a regular (non-temporary) API callback.
@ -0,0 +439,4 @@
{
static const char *context_dir[] = {
"asset_shelf",
"asset_library_ref",

Don't abbreviate things in the public API like this, ref -> reference.

Don't abbreviate things in the public API like this, ref -> reference.
Author
Member

We already use "asset_library_ref" in a number of other places in the API. Noted in #102877 as potential 4.0 change.

We already use `"asset_library_ref"` in a number of other places in the API. Noted in #102877 as potential 4.0 change.

Ok, I would not break API compatibility over something minor like this.

Ok, I would not break API compatibility over something minor like this.
JulianEisel marked this conversation as resolved
@ -2220,0 +2286,4 @@
/* regions: asset shelf settings */
art = MEM_cnew<ARegionType>("spacetype view3d asset shelf settings region");
art->regionid = RGN_TYPE_ASSET_SHELF_SETTINGS;

It's unclear to me why this exists instead of using RGN_TYPE_TEMPORARY, or really just a regular popover like we have for e.g. shading and overlay settings in the 3D viewport.

Is it because you want list scrolling to be persistent or something like that?

It's a bit of a strange precedent to have a region specifically for a popover.

It's unclear to me why this exists instead of using `RGN_TYPE_TEMPORARY`, or really just a regular popover like we have for e.g. shading and overlay settings in the 3D viewport. Is it because you want list scrolling to be persistent or something like that? It's a bit of a strange precedent to have a region specifically for a popover.
Author
Member

This isn't for the popover, it's for the part of the shelf with the tabs, catalog selector, search button etc. This needs a different kind of root layout, and needs to be independently scrollable. That's why it's a separate region.

This isn't for the popover, it's for the part of the shelf with the tabs, catalog selector, search button etc. This needs a different kind of root layout, and needs to be independently scrollable. That's why it's a separate region.

Can you call it asset shelf header then? Since we don't normally call the things in this region "settings" in Blender.

Can you call it asset shelf header then? Since we don't normally call the things in this region "settings" in Blender.
Author
Member

I used to call it footer when it was still at the bottom, but thought it makes sense to make it position independent. But fair enough if we can avoid confusion this way.

I used to call it footer when it was still at the bottom, but thought it makes sense to make it position independent. But fair enough if we can avoid confusion this way.
JulianEisel marked this conversation as resolved
@ -361,6 +361,8 @@ typedef struct View3D {
/** Path to the viewer node that is currently previewed. This is retrieved from the workspace. */
ViewerPath viewer_path;
struct AssetShelfHook *asset_shelf_hook;

Why does this exist rather than storing everything in ARegion.regiondata? If it's in the regiondata it doesn't need to get added to every space type, and is more self contained and generic.

I'm also not sure how to interpret the term "hook" in this context.

Why does this exist rather than storing everything in `ARegion.regiondata`? If it's in the regiondata it doesn't need to get added to every space type, and is more self contained and generic. I'm also not sure how to interpret the term "hook" in this context.

Also find the term hook awkward, hooks are often used in the context of callbacks, it might make sense if the data stored in hooks was a way to hook into data used elsewhere. Where as this looks like a collection. So it could be AssetShelfCollection or AssetShelfStore... or similar (personally prefer "Store" as it's not confused with Object Collections).

Also find the term hook awkward, hooks are often used in the context of callbacks, it might make sense if the data stored in hooks was a way to hook into data used elsewhere. Where as this looks like a collection. So it could be `AssetShelfCollection` or `AssetShelfStore`... or similar (personally prefer "Store" as it's not confused with Object Collections).
Author
Member

Am fine with another name. Just kept it consistent with WorkSpaceHook (not that this is a great name either).

Using regiondata for storage didn't cross my mind, especially since there are two asset shelf regions. But we can still let the main asset shelf region keep the storage. Might simplify things a bit. I will look into it.

Just to note since this isn't obvious: One main reason there's a dedicated AssetShelfHook struct is so that can be reused easily in different editors, e.g. to support asset shelves in the Node Editor, Image Editor (e.g. for brushes), etc.

Am fine with another name. Just kept it consistent with `WorkSpaceHook` (not that this is a great name either). Using regiondata for storage didn't cross my mind, especially since there are two asset shelf regions. But we can still let the main asset shelf region keep the storage. Might simplify things a bit. I will look into it. Just to note since this isn't obvious: One main reason there's a dedicated `AssetShelfHook` struct is so that can be reused easily in different editors, e.g. to support asset shelves in the Node Editor, Image Editor (e.g. for brushes), etc.
JulianEisel marked this conversation as resolved
@ -496,2 +496,4 @@
#define ND_SPACE_FILE_PREVIEW (21 << 16)
#define ND_SPACE_SPREADSHEET (22 << 16)
/* Not a space itself, but a part of another space. */
#define ND_SPACE_ASSET_SHELF (23 << 16)

Then call it ND_REGION_ASSET_SHELF instead, if it's not a space?

Then call it `ND_REGION_ASSET_SHELF` instead, if it's not a space?
Author
Member

No strong opinion, see above regarding the asset shelf not being a single region. Maybe ND_REGIONS_ASSET_SHELF (plural).

No strong opinion, see above regarding the asset shelf not being a single region. Maybe `ND_REGIONS_ASSET_SHELF` (plural).

That sounds fine.

That sounds fine.
JulianEisel marked this conversation as resolved
@ -908,0 +900,4 @@
/* The region size may be set dynamically through #ARegionType.layout(). So if the region is
* only hidden because it's too small, still run the layout in case that leads to a different
* region size. */
const bool hidden_because_too_small = (region->flag & RGN_FLAG_TOO_SMALL) &&

Why remove RGN_FLAG_DYNAMIC_SIZE? Is there a region without this flag that has a dynamic size anyway?

Why remove `RGN_FLAG_DYNAMIC_SIZE`? Is there a region without this flag that has a dynamic size anyway?
Author
Member

The meaning of RGN_FLAG_DYNAMIC_SIZE changed a bit. I think it should be renamed to RGN_FLAG_SIZE_LAYOUT_BASED, since it indicates that the size is entirely determined by the layout. The asset shelf region does use a self-controlled size (so it's dynamically sized in a sense), but it's not exactly determined by the layout. It can't use the RGN_FLAG_DYNAMIC_SIZE, which disables region resizing for example.

I think for the logic here it makes sense to not consider the flag. If the region is too small but it has a layout function, execute that so it can change the size. It must still be tagged for redraw anyway.

The meaning of `RGN_FLAG_DYNAMIC_SIZE` changed a bit. I think it should be renamed to `RGN_FLAG_SIZE_LAYOUT_BASED`, since it indicates that the size is entirely determined by the layout. The asset shelf region does use a self-controlled size (so it's dynamically sized in a sense), but it's not exactly determined by the layout. It can't use the `RGN_FLAG_DYNAMIC_SIZE`, which disables region resizing for example. I think for the logic here it makes sense to not consider the flag. If the region is too small but it has a layout function, execute that so it can change the size. It must still be tagged for redraw anyway.

Ok, that's reasonable.

Ok, that's reasonable.
Author
Member

Made some changes in main, so this wasn't needed anymore: 4319c211dc.

Made some changes in `main`, so this wasn't needed anymore: 4319c211dc.
brecht marked this conversation as resolved
Campbell Barton added 35 commits 2023-07-20 05:06:35 +02:00
Removing unnecessary whitespace added with 1b1349cee4
Previously the normal strength linearly interpolated and extrapolated
the normal in world space. Instead do it in tangent space, in a way
that ensure the normal remains above the surface and valid.

Pull Request: #109763
In order to better suit the upcoming changes of shader node previews, this
patch replaces the old implementation of the storage of the compositor
previews. It also prevents memory loss for future modification.

BKE_node_preview_clear_tree was removed as it is no longer needed and
will not be used by the new shader node previews.

Pull Request: #110064
This utility uses Python's clang module to validate comments intended
to match the struct member names. `cmake_static_check_clang.py` has
been written to support adding other checkers in the future.
The LOD selection for reflection probes wasn't correct and would
select a noisier texture than required. This change will improve
the LOD selection making less noise in the rendered image.

Pull Request: #110234
Add casts back into the macro (removed in [0]), removing the need for
them to be manually included, use `decltype(..)` for C++.

[0]: 129f78eee7
When playing and then pausing the animation the spreadsheet would show stale data,
not only during playback but also afterwards.

Pull Request: #110224
This is a fairly verbose part of nodes RNA, which defines the base
NodeSocket and NodeSocketInterface types as well as all the subtypes
required for showing correct properties based on socket type.

The RNA for this part of nodes is quite self-contained, so moving it
to a separate files works well and reduces the overall size of
rna_nodetree.cc considerably (~1700 LoC). This does not include any
functional changes.

Moving this to a separate file will make it easier to improve the node
group interface (#109135).

Pull Request: #110220
Implementation of the smoothing operator for grease pencil strokes.
Works on `CurvesGeometry` position and other attributes, such as radius.

Based on the gaussian blur like algorithm in `BKE_gpencil_stroke_smooth_point` by Henrik Dick.

Pull Request: #109635
When scenes only have a world probe the world probe had several
artifacts.

- The first sample didn't update the world.
- When switching between viewports the world didn't get updates
- When rendering it ignored the resolution that was set by the user

The reason was that the ubo was only updated when the probes where
synced. This PR adds an exception to also update when there is only
the world probe.

Pull Request: #110238
The file `ED_curves.h` no longer exists and is now `ED_curves.hh`.
Use `math::max` instead of `std::max`.
Caused by fd3e44492e.

Images were drawn filling the entire window, now use available size/
offset inside the window and pass these as `rctf` to
`draw_display_buffer`.

Should be good for 3.6/3.3 LTS

Pull Request: #110206
Pull Request: #110163
Pull Request: #110221
It is possible to organize shape keys into a tree through the
reference key setting. Mesh editing and sculpting a reference
key is supposed to update all its children, but this was only
done for one level of dependencies.

This changes the code to retrieve the complete set of dependent
keys and update them all.
Fix the layout of Python API documents of bpy.types.Object.
This symmetrizes selection and vertex positions like any other operator.

Pull Request #105421
Since the operator affects shape keys rather than current mesh
coordinates, this only symmetrizes the selection.

Pull Request #105421
"Flip" option in mirror modifier is only effective for when "Bisect" is
enabled, thus grey out the flip option when it's ineffective to avoid
confusion on the user interface.

Pull Request: #110191
The Realtime GPU compositor crashes when muting output or viewer nodes.

This happens because output nodes are scheduled regardless of their
muted statued, however, the initial reference count takes the muted
status into account, resulting in a use after free error, hence the
crash.

To fix this, we simply do not schedule muted output nodes.
Shader write must be correctly specified where required for
shaders which perform direct image and buffer writing operations.

Authored by Apple: Michael Parkin-White

Pull Request: #110219
Enum popups don't set an active button so accelerator keys didn't work.
Always use accelerator keys in popups because these are typically
launched from non-menus (the redo popup for e.g.) where it doesn't
make sense to pass the event to the parent.
Campbell Barton added 1 commit 2023-07-20 05:07:36 +02:00
Campbell Barton added 1 commit 2023-07-20 13:37:21 +02:00
Campbell Barton requested changes 2023-07-20 13:59:02 +02:00
@ -0,0 +209,4 @@
{
const AssetView &asset_view = dynamic_cast<const AssetView &>(get_view());
const AssetShelfType &shelf_type = *asset_view.shelf_.type;
shelf_type.draw_context_menu(&C, &shelf_type, &asset_, &column);

This is crashing on a simple test (default sculpt brush made into an asset).

  • Default blend file (w/ experimental asset features enabled).
  • Enter sculpt mode.
  • Make default sculpt brush into an asset (from the properties toolbar).
  • RMB in the asset shelf.
  • Crash.
This is crashing on a simple test (default sculpt brush made into an asset). - Default blend file (w/ experimental asset features enabled). - Enter sculpt mode. - Make default sculpt brush into an asset (from the properties toolbar). - RMB in the asset shelf. - Crash.
JulianEisel marked this conversation as resolved
@ -0,0 +40,4 @@
next = prev = nullptr;
active_catalog_path = BLI_strdup(other.active_catalog_path);

This can be null (noted in doc-string), crashes when duplicating an empty 3D view.

This can be null (noted in doc-string), crashes when duplicating an empty 3D view.
JulianEisel marked this conversation as resolved
@ -5007,3 +5008,3 @@
#define PREVIEW_TILE_PAD (0.15f * UI_UNIT_X)
int UI_preview_tile_size_x()
int UI_preview_tile_size_x(const int unscaled_size)

If this is the size in pixels, it could be called size_px (not that fussed though).

If this is the size in pixels, it could be called `size_px` (not that fussed though).
JulianEisel marked this conversation as resolved
@ -1759,1 +1794,4 @@
}
if (flag & ED_KEYMAP_ASSET_SHELF) {
/* standard keymap for asset shelf regions */
wmKeyMap *keymap = WM_keymap_ensure(wm->defaultconf, "Asset Shelf", 0, 0);

There is currently a warning that this is an empty key-map, could this have at least one item added? (otherwise hard-code disable the warning): see source/blender/windowmanager/intern/wm_keymap.c:457 WM_keymap_poll: empty keymap 'Asset Shelf'.

There is currently a warning that this is an empty key-map, could this have at least one item added? (otherwise hard-code disable the warning): see `source/blender/windowmanager/intern/wm_keymap.c:457 WM_keymap_poll: empty keymap 'Asset Shelf'`.
JulianEisel marked this conversation as resolved
@ -339,0 +356,4 @@
static void view3d_init(wmWindowManager * /*wm*/, ScrArea *area)
{
BLI_assert(area->spacetype == SPACE_VIEW3D);
View3D *v3d = static_cast<View3D *>(area->spacedata.first);

This caused a crash however it exposed an existing issue: committed fix 486086d349

This caused a crash however it exposed an existing issue: committed fix 486086d349aa0c471ba56e3ae703b697d4749e7f
JulianEisel marked this conversation as resolved
@ -1081,0 +1205,4 @@
}
SpaceType *space_type = BKE_spacetype_from_id(dummy_shelf_type.space_type);
if (!space_type) {

Shouldn't this report an error?
EDIT or be impossible (that block could use BLI_assert_unreachable()).

Shouldn't this report an error? *EDIT* or be impossible (that block could use `BLI_assert_unreachable()`).
JulianEisel marked this conversation as resolved
Julian Eisel added 2 commits 2023-07-25 16:48:11 +02:00
Julian Eisel added 1 commit 2023-07-27 12:44:37 +02:00
Julian Eisel added 4 commits 2023-07-27 15:04:18 +02:00
Julian Eisel added 1 commit 2023-07-27 15:19:14 +02:00
Julian Eisel added 1 commit 2023-07-27 18:15:44 +02:00
Quite nice how this isolates/encapsulates things even more.
Author
Member

Still planning to rename AssetShelfHook to AssetShelfStore, but it's moved to the region data now.

Still planning to rename `AssetShelfHook` to `AssetShelfStore`, but it's moved to the region data now.
Julian Eisel added 1 commit 2023-07-27 18:20:54 +02:00
Julian Eisel added 3 commits 2023-07-28 12:37:15 +02:00
Julian Eisel added 3 commits 2023-07-28 14:50:00 +02:00
Julian Eisel added 1 commit 2023-07-28 14:55:14 +02:00
Julian Eisel added 1 commit 2023-07-28 15:19:57 +02:00
New name makes sense since this is now region data instead of space
data.
Julian Eisel added 1 commit 2023-07-28 15:27:41 +02:00
Author
Member

Did a number of changes, including:

  • Did some refactors/cleanups in main which help improving the patch
  • Merged some further changes into main directly.
  • Renamed AssetShelfHook to RegionAssetShelf. We wanted a better name and this is now region-data, so that name made sense (consistent with RegionView3D).
Did a number of changes, including: - Did some refactors/cleanups in `main` which help improving the patch - Merged some further changes into `main` directly. - Renamed `AssetShelfHook` to `RegionAssetShelf`. We wanted a better name and this is now region-data, so that name made sense (consistent with `RegionView3D`).
Julian Eisel requested review from Campbell Barton 2023-07-28 15:41:25 +02:00
Julian Eisel requested review from Brecht Van Lommel 2023-07-28 15:41:33 +02:00
Julian Eisel added 1 commit 2023-07-28 16:46:58 +02:00
Julian Eisel added 1 commit 2023-07-28 17:36:56 +02:00
Author
Member

Quick test to add asset shelf support to the node editor: #110589

Quick test to add asset shelf support to the node editor: #110589 <video src="https://projects.blender.org/attachments/ed1e53dc-b26d-439c-866b-af7effbfd514" controls>
Julian Eisel added 2 commits 2023-08-01 13:01:40 +02:00
While this was initially meant as temporary design, I think it's fine to
keep this. It adds more flexibility in removing unwanted assets from the
listing. Plus it's unclear if we can get the necessary Python API syntax
to work before the release, so I prefer not relying on that. Should we
get it to work, the API can still be changed before the release.
Julian Eisel added 1 commit 2023-08-01 13:04:37 +02:00
Brecht Van Lommel approved these changes 2023-08-01 19:05:13 +02:00
Brecht Van Lommel left a comment
Owner

Looks fine overall to me now, certainly on the level of an experimental feature with the data design in good shape.

Looks fine overall to me now, certainly on the level of an experimental feature with the data design in good shape.
Julian Eisel added 1 commit 2023-08-02 15:36:38 +02:00
Merge branch 'main' into asset-shelf
All checks were successful
buildbot/vexp-code-patch-coordinator Build done.
4093e3c6db
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR104831) when ready.
Bastien Montagne refused to review 2023-08-02 16:41:15 +02:00
Julian Eisel added 2 commits 2023-08-02 20:51:05 +02:00
Julian Eisel added 1 commit 2023-08-02 21:10:24 +02:00
Campbell Barton added 1 commit 2023-08-03 03:02:16 +02:00
Campbell Barton approved these changes 2023-08-03 03:36:39 +02:00
Campbell Barton left a comment
Owner

Accepting with some requests.
Also some suggestions which I don't consider blocking.


Note: committed inclusion of "Asset Shelf" in the region-toggle pie menu (9572bfe883).

Accepting with some requests. Also some suggestions which I don't consider blocking. --- Note: committed inclusion of "Asset Shelf" in the region-toggle pie menu (9572bfe8838340804cc8943b62edc95005028e8e).
@ -0,0 +1,36 @@
# SPDX-License-Identifier: GPL-2.0-or-later

Use updated copyright convention SPDX-FileCopyrightText.

# SPDX-FileCopyrightText: 2023 Blender Foundation
#
# SPDX-License-Identifier: GPL-2.0-or-later
Use updated copyright convention `SPDX-FileCopyrightText`. ``` # SPDX-FileCopyrightText: 2023 Blender Foundation # # SPDX-License-Identifier: GPL-2.0-or-later ```
JulianEisel marked this conversation as resolved
@ -1275,2 +1276,4 @@
layout.prop(view, "show_region_ui")
layout.prop(view, "show_region_tool_header")
if prefs.experimental.use_asset_shelf:
layout.prop(view, "show_regions_asset_shelf")

Suggestion: it would be nice if this was greyed out when the asset menu isn't shown, when first testing this patch I found it confusing that toggling the region did nothing until entering sculpt mode.

Suggestion: it would be nice if this was greyed out when the asset menu isn't shown, when first testing this patch I found it confusing that toggling the region did nothing until entering sculpt mode.
Author
Member

Submitted as separate PR now since I'd like to get some feedback without delaying the initial asset shelf merge: #110756.

Submitted as separate PR now since I'd like to get some feedback without delaying the initial asset shelf merge: #110756.
@ -416,0 +422,4 @@
typedef enum AssetShelfTypeFlag {
/** Do not trigger asset dragging on drag events. Drag events can be overridden with custom
* keymap items then. */
ASSET_SHELF_TYPE_NO_ASSET_DRAG = (1 << 0),

Suggestion: calling ASSET_SHELF_TYPE_* prefix reads like a type which are typically unique values, not flags. ASSET_SHELF_TYPE_FLAG_NO_ASSET_DRAG - some extra clarity at the expense of verbosity.

Suggestion: calling `ASSET_SHELF_TYPE_*` prefix reads like a type which are typically unique values, not flags. `ASSET_SHELF_TYPE_FLAG_NO_ASSET_DRAG` - some extra clarity at the expense of verbosity.
JulianEisel marked this conversation as resolved
@ -52,6 +52,10 @@
#include "BLO_read_write.h"
/* TODO(Julian): For asset shelf region reading/writing. Region read/write should be done via a

picky use TODO(@username) format.

*picky* use `TODO(@username)` format.
JulianEisel marked this conversation as resolved
@ -0,0 +1,697 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */

Use updated copyright format

/* SPDX-FileCopyrightText: 2023 Blender Foundation
 *
 * SPDX-License-Identifier: GPL-2.0-or-later */
Use updated copyright format ``` /* SPDX-FileCopyrightText: 2023 Blender Foundation * * SPDX-License-Identifier: GPL-2.0-or-later */ ```
JulianEisel marked this conversation as resolved
@ -0,0 +99,4 @@
static void activate_shelf(RegionAssetShelf &shelf_regiondata, AssetShelf &shelf)
{
shelf_regiondata.active_shelf = &shelf;
BLI_remlink_safe(&shelf_regiondata.shelves, &shelf);

Suggestion: I find it reads baddy when it's the existence of data in a list is undefined.
In this case the caller can ensure it's in the list in the case it's just been created.

Suggestion: I find it reads baddy when it's the existence of data in a list is undefined. In this case the caller can ensure it's in the list in the case it's just been created.
JulianEisel marked this conversation as resolved
@ -427,0 +430,4 @@
* they will be upscaled to the button size. Should probably be done by the widget code. */
const int is_preview_flag = (BKE_icon_is_preview(preview_icon_id) ||
BKE_icon_is_image(preview_icon_id)) ?
UI_BUT_ICON_PREVIEW :

-Wextra warns: grid_view.cc:432:68: warning: enumerated and non-enumerated type in conditional expression. int(UI_BUT_ICON_PREVIEW).

`-Wextra` warns: `grid_view.cc:432:68: warning: enumerated and non-enumerated type in conditional expression`. `int(UI_BUT_ICON_PREVIEW)`.
JulianEisel marked this conversation as resolved
@ -859,6 +859,22 @@ static void rna_Space_show_region_hud_update(bContext *C, PointerRNA *ptr)
rna_Space_bool_from_region_flag_update_by_type(C, ptr, RGN_TYPE_HUD, RGN_FLAG_HIDDEN_BY_USER);
}
/* Asset Shelf Regions */

This should probably be called show_region_asset_shelf ? (regions -> region). Even though internally disabling the asset shelf also disables the asset-shelf header, this is more of a detail. The HEADER & TOOL_HEADER have the same logic without naming the property "regions".

This should probably be called `show_region_asset_shelf` ? (`regions` -> `region`). Even though internally disabling the asset shelf also disables the asset-shelf header, this is more of a detail. The HEADER & TOOL_HEADER have the same logic without naming the property "regions".
JulianEisel marked this conversation as resolved
Member

Tested it a bit. I'm getting crashes when disabling asset names and when changing the size slider.

Smaller nitpicks (Not necessaryily related to this PR):

  • Toggling the asset shelf has a brief delay and the arrow icons for a closed region glitching (Would be nice if the asset shelf has a sliding animation like the tool/sidebars)
  • It's very awkward when the header and tool settings are at the bottom with the asset shelf
  • Files saved with an old version of this patch will still use an older version of the asset shelf.
  • The region toggle pie menu rearranges awkwardly when the header is at the bottom. I'd say the "Header" options should always be at the top, even if it's bottom aligned in the editor.
Tested it a bit. I'm getting crashes when disabling asset names and when changing the size slider. Smaller nitpicks (Not necessaryily related to this PR): - Toggling the asset shelf has a brief delay and the arrow icons for a closed region glitching (Would be nice if the asset shelf has a sliding animation like the tool/sidebars) - It's very awkward when the header and tool settings are at the bottom with the asset shelf - Files saved with an old version of this patch will still use an older version of the asset shelf. - The region toggle pie menu rearranges awkwardly when the header is at the bottom. I'd say the "Header" options should always be at the top, even if it's bottom aligned in the editor.
Julian Eisel added a new dependency 2023-08-03 11:35:24 +02:00
Author
Member

Thanks for the feedback @JulienKaspar!

Tested it a bit. I'm getting crashes when disabling asset names and when changing the size slider.

Which commit are you on? Sounds like a crash that I fixed earlier.

Smaller nitpicks (Not necessaryily related to this PR):

  • Toggling the asset shelf has a brief delay and the arrow icons for a closed region glitching (Would be nice if the asset shelf has a sliding animation like the tool/sidebars)

Hmm, I don't really see that delay here. Something we can look at. And I'm also not sure why there's no sliding animation, from the code I think it should do it already.

  • It's very awkward when the header and tool settings are at the bottom with the asset shelf

For the header I find it fine, but indeed with the tool settings at the bottom it's awkward indeed. Do people have both at the bottom even? (Took me a moment to find the Flip to Bottom for it. You have to click close to a button or on one, then go into the Header [?!] submenu, ...)

  • Files saved with an old version of this patch will still use an older version of the asset shelf.

Yeah I used to have a workaround for that in code, but not too nice to merge that into main (trivial to bring back though). If you recreate the 3D View from scratch, that is create an entirely new area that never contained a 3D view before, it should be fine :)


BTW I also did some brief performance tests, to make sure the asset shelf doesn't slow down animation playback especially. Seems all fine, couldn't spot any issues.

Thanks for the feedback @JulienKaspar! > Tested it a bit. I'm getting crashes when disabling asset names and when changing the size slider. Which commit are you on? Sounds like a crash that I fixed earlier. > Smaller nitpicks (Not necessaryily related to this PR): > - Toggling the asset shelf has a brief delay and the arrow icons for a closed region glitching (Would be nice if the asset shelf has a sliding animation like the tool/sidebars) Hmm, I don't really see that delay here. Something we can look at. And I'm also not sure why there's no sliding animation, from the code I think it should do it already. > - It's very awkward when the header and tool settings are at the bottom with the asset shelf For the header I find it fine, but indeed with the tool settings at the bottom it's awkward indeed. Do people have both at the bottom even? (Took me a moment to find the _Flip to Bottom_ for it. You have to click close to a button or on one, then go into the _Header_ [?!] submenu, ...) > - Files saved with an old version of this patch will still use an older version of the asset shelf. Yeah I used to have a workaround for that in code, but not too nice to merge that into `main` (trivial to bring back though). If you recreate the 3D View from scratch, that is create an entirely new area that never contained a 3D view before, it should be fine :) --- BTW I also did some brief performance tests, to make sure the asset shelf doesn't slow down animation playback especially. Seems all fine, couldn't spot any issues.
Author
Member
  • Toggling the asset shelf has a brief delay and the arrow icons for a closed region glitching (Would be nice if the asset shelf has a sliding animation like the tool/sidebars)

Hmm, I don't really see that delay here. Something we can look at. And I'm also not sure why there's no sliding animation, from the code I think it should do it already.

Ah I think it's because of the aggressive region size snapping the asset shelf does. The animation changes the size, but because of the snapping you don't really see the intermediate states. That would also make it seem laggy (although it doesn't feel like that to me, interestingly..). I guess the region snapping should be skipped during the animation.

> > - Toggling the asset shelf has a brief delay and the arrow icons for a closed region glitching (Would be nice if the asset shelf has a sliding animation like the tool/sidebars) > > Hmm, I don't really see that delay here. Something we can look at. And I'm also not sure why there's no sliding animation, from the code I think it should do it already. Ah I think it's because of the aggressive region size snapping the asset shelf does. The animation changes the size, but because of the snapping you don't really see the intermediate states. That would also make it seem laggy (although it doesn't feel like that to me, interestingly..). I guess the region snapping should be skipped during the animation.
Julian Eisel added 1 commit 2023-08-03 12:33:46 +02:00
Campbell Barton added 1 commit 2023-08-03 12:38:46 +02:00
Member

Which commit are you on? Sounds like a crash that I fixed earlier.

Latest commit. I built it on my machine.

Do people have both at the bottom even?

There's a preference for it. Even some at the Studio are using it to set all headers to the bottom:
Interface -> Editors -> "Header Position"

But they also tend to not use the tool settings, so maybe it's ok.

> Which commit are you on? Sounds like a crash that I fixed earlier. Latest commit. I built it on my machine. > Do people have both at the bottom even? There's a preference for it. Even some at the Studio are using it to set all headers to the bottom: Interface -> Editors -> "Header Position" But they also tend to not use the tool settings, so maybe it's ok.

I guess when the header is at the bottom, the asset shelf should be at the top?

I guess when the header is at the bottom, the asset shelf should be at the top?
Julian Eisel added 1 commit 2023-08-03 15:00:27 +02:00
Julian Eisel added 1 commit 2023-08-03 16:18:47 +02:00
Julian Eisel added 1 commit 2023-08-03 16:19:50 +02:00
Remove changes to be committed separately
All checks were successful
buildbot/vexp-code-patch-coordinator Build done.
a1d1bc43ee
This is now solely focused on introducing the asset shelf internally, 3D
View support and the UI template will be committed separately.
Author
Member

@blender-bot build

@blender-bot build
Julian Eisel added 1 commit 2023-08-03 17:22:56 +02:00
Author
Member
Committed as: - [98142f5e35b4: UI: Asset Shelf Support (Experimental Feature)](https://projects.blender.org/blender/blender/commit/98142f5e35b488f6c900d283b21ee4d8bdde5207) - [8b19477e9c89: UI: Support asset shelves in 3D Views](https://projects.blender.org/blender/blender/commit/8b19477e9c898663e4ab1b2446fe3ffe8ccb5630) - [268d322e7cd3: BKE: Bump subversion for versioning in previous commit](https://projects.blender.org/blender/blender/commit/268d322e7cd372efffa5a21404cedadb4259aeb6) - [94fdafe90618: Sculpt/UI: Experimental asset shelf for brush assets in sculpt mode](https://projects.blender.org/blender/blender/commit/94fdafe90618304721bf8c78d42c4cd4b0c3b242) - [6764e6949121: UI: Add asset shelf Python UI template](https://projects.blender.org/blender/blender/commit/6764e69491216ee4cfac654af6be5f2cb73fe699) Thanks all!
Julian Eisel closed this pull request 2023-08-03 17:25:53 +02:00

Pull request closed

Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No Assignees
7 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Reference: blender/blender#104831
No description provided.