Brush assets project #106303

Closed
Julian Eisel wants to merge 441 commits from brush-assets-project into main

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

Tasks: #116337

This includes changes from multiple branches that are worked on as part of the brush assets project, see #101895.

At this point the main component is:

  • Core changes to support brush assets as by design: #116338
Tasks: #116337 This includes changes from multiple branches that are worked on as part of the brush assets project, see #101895. At this point the main component is: - Core changes to support brush assets as by design: #116338
Julian Eisel added 125 commits 2023-03-30 12:54:12 +02: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
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.
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
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.
Makes code more focused, improving local readability.
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
Bastien Montagne added 2 commits 2023-03-30 18:42:53 +02:00
Bastien Montagne added 1 commit 2023-04-01 20:21:48 +02:00
Bastien Montagne added 1 commit 2023-04-03 16:05:30 +02:00
Julian Eisel added 3 commits 2023-04-06 12:11:42 +02:00
Bastien Montagne added 5 commits 2023-04-07 14:35:59 +02:00
Bastien Montagne added 1 commit 2023-04-07 16:06:14 +02:00
Bastien Montagne added 3 commits 2023-04-12 15:18:55 +02:00
Bastien Montagne added 1 commit 2023-04-12 16:26:45 +02:00
Julian Eisel added 3 commits 2023-04-13 15:58:28 +02:00
Julian Eisel added 1 commit 2023-04-14 12:02:47 +02:00
Julian Eisel added 1 commit 2023-04-14 12:51:32 +02:00
Bastien Montagne added 1 commit 2023-04-18 11:19:43 +02:00
Bastien Montagne added 1 commit 2023-04-20 11:40:45 +02:00
Bastien Montagne added 1 commit 2023-04-21 11:04:19 +02:00
Julian Eisel added 12 commits 2023-05-17 11:39:17 +02:00
Julian Eisel added 65 commits 2023-05-17 23:32:44 +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
Bastien Montagne added 7 commits 2023-05-19 17:56:22 +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.
In the Python asset shelf type definition, a `draw_context_menu()`
function can be defined now.
Update version bump after changes in main
Some checks failed
buildbot/vexp-code-patch-coordinator Build done.
4d1752fa81
Add toggle for asset shelf to View menu
Some checks failed
buildbot/vexp-code-patch-coordinator Build done.
61482f9c6d
Julian Eisel added 4 commits 2023-05-22 17:04:39 +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.
Only shows up when both the "Asset Shelf" and the "Extended Asset
Browser" experimental features are enabled.
Merge branch 'main' into asset-shelf
Some checks failed
buildbot/vexp-code-patch-coordinator Build done.
c12ac8bef6
Julian Eisel added 3 commits 2023-05-31 17:07:21 +02:00
Julian Eisel added 1 commit 2023-06-05 15:40:20 +02:00
Bastien Montagne added 12 commits 2023-06-08 16:15:51 +02:00
Julian Eisel added 2 commits 2023-06-08 17:42:34 +02:00
Julian Eisel added 21 commits 2023-06-15 16:21:52 +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.
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.
Wouldn't work since e8a89e6eca (intentionally so).
This is handled in a separate PR now.
Julian Eisel added 15 commits 2023-06-20 12:23:48 +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.
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
These RNA files are now compiled in C++, some adjustments were
necessary.
Julian Eisel added 3 commits 2023-06-26 18:00:53 +02:00
Julian Eisel added 5 commits 2023-07-05 17:03:39 +02:00
Julian Eisel added 22 commits 2023-07-13 15:05:11 +02:00
Going a bit back and forth here, but in latest tests we've decided to
try this again.
Uncollapse root level catalogs in the catalog selector
Some checks failed
buildbot/vexp-code-patch-coordinator Build done.
1a809193d5
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:24 +02:00
Bastien Montagne force-pushed brush-assets-project from f6cff26977 to ab0cf3e4a3 2023-09-08 14:37:45 +02:00 Compare
Bastien Montagne force-pushed brush-assets-project from ab0cf3e4a3 to 0c95e0e627 2023-09-08 14:41:03 +02:00 Compare
Bastien Montagne added 3 commits 2023-11-09 12:20:07 +01:00
This commit mainly adds the low-level logic to link and create a runtime
override for brushes.

The biggest changes are in `setup_app_data` (post-loading of .blend
file), to add support to move over some data from old bmain to newly
loaded bmain. The logic is complex, and different depending on whether
it is an undo (aka memfile read) step, or an actual .blend file reading:
* On undo, we only port over brushes themselves, their dependencies are
  not handled. However, since memfile reading code already ported over
  linked IDs, these do not need to be swapped.
* On real .blend file loading, brushes from the old bmain are being
  reused, as long as they do not conflict (name/lib) with brushes from
  the new bmain. Their dependencies are also re-used if needed.
  Only exception: local assets from old bmain are never re-used.

There is also a new step added to the 'open file' process, which checks
if the to-be-opened file is a library of the currently opened one, and
if so, if there are local tweaked overrides of assets from the new file.
The option to save these tweaks in draft is currently an empty mockup,
but the rest is functional.

Brush now has a new `AssetWeakReference` pointer to keep track of the
last active brush asset, and restore it on fileread in case there is
currently no active brush asset for the given paint/sculpt mode.

Some parts of this commits are mockups/place-holders that are not
expected to be committed as-is, if at all:
* Some initial support for an asset-shelf (using code from
  `brush-asset-project` branch), very much WIP still.
* Definition of test brush library with semi-hard-coded path.
* There is also a drawing bug because the poll function of Brush
  panels return false initially (tool has no data-block ref).
  Very unclear what's hapening here.

Ref. #101908.
Note that current code is crashing on initial show of brush asset
browser in curve sculpt mode. Need Julian to help on this.
Conflicts:
	scripts/startup/bl_ui/space_view3d.py
	source/blender/blenloader/intern/versioning_defaults.cc
	source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
Bastien Montagne added 4 commits 2023-11-24 11:20:18 +01:00
This commit mainly adds the low-level logic to link and create a runtime
override for brushes.

The biggest changes are in `setup_app_data` (post-loading of .blend
file), to add support to move over some data from old bmain to newly
loaded bmain. The logic is complex, and different depending on whether
it is an undo (aka memfile read) step, or an actual .blend file reading:
* On undo, we only port over brushes themselves, their dependencies are
  not handled. However, since memfile reading code already ported over
  linked IDs, these do not need to be swapped.
* On real .blend file loading, brushes from the old bmain are being
  reused, as long as they do not conflict (name/lib) with brushes from
  the new bmain. Their dependencies are also re-used if needed.
  Only exception: local assets from old bmain are never re-used.

There is also a new step added to the 'open file' process, which checks
if the to-be-opened file is a library of the currently opened one, and
if so, if there are local tweaked overrides of assets from the new file.
The option to save these tweaks in draft is currently an empty mockup,
but the rest is functional.

Brush now has a new `AssetWeakReference` pointer to keep track of the
last active brush asset, and restore it on fileread in case there is
currently no active brush asset for the given paint/sculpt mode.

Some parts of this commits are mockups/place-holders that are not
expected to be committed as-is, if at all:
* Some initial support for an asset-shelf (using code from
  `brush-asset-project` branch), very much WIP still.
* Definition of test brush library with semi-hard-coded path.
* There is also a drawing bug because the poll function of Brush
  panels return false initially (tool has no data-block ref).
  Very unclear what's hapening here.

Ref. #101908.
This commit mainly adds the low-level logic to link and create a runtime
override for brushes.

The biggest changes are in `setup_app_data` (post-loading of .blend
file), to add support to move over some data from old bmain to newly
loaded bmain. The logic is complex, and different depending on whether
it is an undo (aka memfile read) step, or an actual .blend file reading:
* On undo, we only port over brushes themselves, their dependencies are
  not handled. However, since memfile reading code already ported over
  linked IDs, these do not need to be swapped.
* On real .blend file loading, brushes from the old bmain are being
  reused, as long as they do not conflict (name/lib) with brushes from
  the new bmain. Their dependencies are also re-used if needed.
  Only exception: local assets from old bmain are never re-used.

There is also a new step added to the 'open file' process, which checks
if the to-be-opened file is a library of the currently opened one, and
if so, if there are local tweaked overrides of assets from the new file.
The option to save these tweaks in draft is currently an empty mockup,
but the rest is functional.

Brush now has a new `AssetWeakReference` pointer to keep track of the
last active brush asset, and restore it on fileread in case there is
currently no active brush asset for the given paint/sculpt mode.

Some parts of this commits are mockups/place-holders that are not
expected to be committed as-is, if at all:
* Some initial support for an asset-shelf (using code from
  `brush-asset-project` branch), very much WIP still.
* Definition of test brush library with semi-hard-coded path.
* There is also a drawing bug because the poll function of Brush
  panels return false initially (tool has no data-block ref).
  Very unclear what's hapening here.

Ref. #101908.
Bastien Montagne added 2 commits 2023-11-24 15:32:29 +01:00
This commit mainly adds the low-level logic to link and create a runtime
override for brushes.

The biggest changes are in `setup_app_data` (post-loading of .blend
file), to add support to move over some data from old bmain to newly
loaded bmain. The logic is complex, and different depending on whether
it is an undo (aka memfile read) step, or an actual .blend file reading:
* On undo, we only port over brushes themselves, their dependencies are
  not handled. However, since memfile reading code already ported over
  linked IDs, these do not need to be swapped.
* On real .blend file loading, brushes from the old bmain are being
  reused, as long as they do not conflict (name/lib) with brushes from
  the new bmain. Their dependencies are also re-used if needed.
  Only exception: local assets from old bmain are never re-used.

There is also a new step added to the 'open file' process, which checks
if the to-be-opened file is a library of the currently opened one, and
if so, if there are local tweaked overrides of assets from the new file.
The option to save these tweaks in draft is currently an empty mockup,
but the rest is functional.

Brush now has a new `AssetWeakReference` pointer to keep track of the
last active brush asset, and restore it on fileread in case there is
currently no active brush asset for the given paint/sculpt mode.

Some parts of this commits are mockups/place-holders that are not
expected to be committed as-is, if at all:
* Some initial support for an asset-shelf (using code from
  `brush-asset-project` branch), very much WIP still.
* Definition of test brush library with semi-hard-coded path.
* There is also a drawing bug because the poll function of Brush
  panels return false initially (tool has no data-block ref).
  Very unclear what's hapening here.

Ref. #101908.
Bastien Montagne added 1 commit 2024-01-09 17:26:25 +01:00
Julian Eisel added 1 commit 2024-01-16 11:39:22 +01:00
Hans Goudey added 55 commits 2024-01-17 16:39:30 +01:00
When using EEVEE on high resolution monitors the light buffers might not
get initialized as there are range checks that pass in the first try.

- number of tiles needed is larger than the max_tile_count_threshold
- total_word_count is smaller than max_word_count_threshold as it is
  never set (still initialized to zero.

Solution is to not exit on the first try. In a later stage we might want
to use something that doesn't require any looping.

Fixes: #117128
Pull Request: #117164
Double precision pixel coordinate interpolation was added in 3a65d2f591 to
fix an issue of "wobbly" resulting image at very high scale factors. But
the root cause of that was the fact that the scanline loop was repeatedly
adding the floating point step for each pixel, instead of doing multiplication
by pixel index (repeated floating point additions can "drift" due to
imprecision, whereas multiplications are much more accurate).

Change all that math back to use single precision floats. I checked the
original issue the commit was fixing, it is still fine. Also added a gtest
to cover this situation: `imbuf_transform, nearest_very_large_scale`

This makes `IMB_transform` a tiny bit faster, on Windows/VS2022/Ryzen5950X
scaling an image at 4K resolution:
- Bilinear: 5.92 -> 5.83 ms
- Subsampled3x3: 53.6 -> 52.7 ms

Pull Request: #117160
In 13fac109 the node panels got support for individual option button
callbacks, but these were not included in the node editor side bar.
Only the older top-level buttons are drawn there.

The panel structure is currently not accessible in python since it is
part of the `NodeDeclaration` system. To draw node input sockets and
buttons in the correct panel order as they appear on the node, a new
template function `uiTemplateNodeInputs` has been added. This iterates
over declared panels and their contents in the appropriate order and
draws the buttons before sockets in the same panel.

Pull Request: #116936
This includes an additional fix for precision of some operations that affect
Blender tests.
Properly check for the existence of the Python binary in precompiled libs.
The unregistering of already registered classes is expected behavior,
however this was done silently and can be unsafe as two Addons may have
the same names for operators and in case of name collision the addon
registered first will break silently / start behave unexpectedly.
So reporting the unregister step seems reasonable.

During Addon development, this might seem noisy when classes are
frequently updated, however catching the problematic cases instead of
being silent might be beneficial.

Part of #116370

Pull Request: #116374
The change to use `float3` in `frontface` didn't account for the
fact that the values we sometimes null.
Loading pre-4.0.20 node groups with sockets using subtypes causes
broken socket identifiers. This is because the node tree interface now
expects sockets to use the base identifiers ("NodeSocketFloat" instead
of "NodeSocketFloatFactor" etc.).

To correct this the conversion code now replaces socket idnames that
include a subtype suffix with their base names. This fix is also applied
to files between versions 4.0.20 and 4.1.10, where the socket types
may have been converted incorrectly.

Pull Request: #117133
This `draw` method is optional. The same check is also done elsewhere.

Pull Request: #117061
Grease pencil needs some special handling because it stores layer attributes
independently of point/curve attributes.
This crash happened when trying to store an attribute on the edge domain
on a grease pencil geometry.
Enable huge pages for jemalloc. This requests the Linux kernel to use
huge (2 MB) pages for large allocations. This has the effect of speeding
up first accesses to those allocations, and possibly also speeds up future
accesses by reducing TLB faults.

By default, 4 KB pages are used unless the user enables huge pages through
a kernel parameter or an obscure sysfs setting.

For Cycles benchmarks, this gives about a 5% CPU rendering performance
improvement. It likely also improves performance in other areas of Blender.

Pull Request: #116663
Opacity modifier implementation based on GP2.
Functionality is largely unchanged.

_Color Mode_ is either `Stroke` or `Fill` for modifying color opacity or
`Hardness`.
_Uniform Opacity_ does two things at once (!):
- Sets the same opacity value for every point in a stroke.
- Sets opacity as an absolute value rather than a factor.

_Weight as Factor_ (button to the right of Opacity Factor): Use the
vertex group as opacity __factor__ rather than an overall __influence__.
This is confusing and hard to convey, but copies behavior from GP2.

The _Influence_ panel contains the same filter settings as the GP2
modifier, with some small changes:
- _Layer_ selects only strokes in the respective layer (with an _Invert_
  option)
- _Material_ selects only points with the respective material (with an
  _Invert_ option)
- _Layer Pass_ and _Material Pass_ select only strokes/points which are
  rendered in the respective pass.
  _Note 1: Layers don't have UI for setting a pass yet, this will be a
  generic layer attribute. This can be set through the API for testing._
  _Note 2: In GP2 a pass value of zero was used to disable pass filters.
  Since zero is a valid pass ID an explicit flag has been added for the
  purpose of turning pass filters on and off._
- _Vertex Group_: This can be used as an additional influence filter on
  points. If _Weight as Factor_ is enable the vertex group instead
  replaces the opacity factor. In _Fill_ mode the vertex group weight of
  the stroke's first point is used as influence for the entire stroke.
- _Custom Curve_ is another possible influence factor per point. The
  curve input value is the relative position of a point along its
  stroke.

The Influence settings have been moved into a separate DNA struct, which
should help with reusability in various modifiers. Various utility
functions can be found int `MOD_grease_pencil_util.hh` for handling
influence settings and generating `IndexMasks` for modernized C++ code.

Pull Request: #116946
The parameters for `threading::parallel_for_each` were not correct.
Using layout panels in this context is not yet supported. Therefor, the fix
is to raise an exception instead of crashing.

The problem here is that layout panels need an a parent panel which
has a persistent state. The popover currently does not only has a very
short-lived panel currently that is freed directly after drawing.
Also see `ui_paneltype_draw_impl`.

It's likely that support for this can be added in the future but it's currently
unclear how many changes this would require.
The goal is to simplify future work on #106903.

Pull Request: #117141
There were some abstractions inside `IMB_transform` implementation
that were kinda getting in the way. I want to speed up Subsampled3x3
filtering by reformulating the math being done, but that needs to
sample byte images while storing intermediate result as a float -- but
the whole `Pixel`, `PixelPointer` et al. machinery was not quite prepared
to deal with that. Feels like those helper classes do not achieve much,
just make the code longer.

So remove them (`Pixel`, `PixelPointer`, `ChannelConverter` etc.) and
use simple functions. Now the code is more straightforward (IMHO) and
270 lines shorter (40% of the whole file!), and allows me to do the
follow-up optimization easier.

No functional changes.

Pull Request: #117182
This simplifies memory management and button string manipulation in
general. Just change one of the few strings stored in `uiBut` for now.

Pull Request: #117183
CurvesGeometry has no ".selection" attribute when all control points
are selected. The earlier code assumed that the attribute always exists.
Also Python tests are added for the "extrude" operator.

Pull Request: #117095
String suggestion now allow the operator list to be searched.
Allow double-clicking on Outliner items to select all child items.

Pull Request: #110151
Creates a new "Cleanup" dialog that allows purging unused data blocks,
as well as a window used for managing unused data blocks.

Pull Request: #106653
The code still needs to differentiate a null string from an empty
string in one cast I missed earlier.
Using screen changing functions with screens used for full screen areas
isn't supported & caused corrupt screen data.

Add checks that the current and overriding screen support switching,
raising an error when they don't. Also add a check when restoring the
context not to change any full screen areas.
Set the number of planes based on the number of pass channels.

If the pass contains 2 passes or more than 4 passes set the number
of planes to the previously used value of 32.

This is needed because quite some areas check for the number of
planes for various optimizations. For example, this is one of the
factors which make IMB_create_gpu_texture() to choose the texture
format. If the number of planes for the depth pass is set to the
previously used this function will never consider using single
channel GPU texture.

Unfortunately, this change is not enough to make the GPU texture
to use single channel format as the color space of the image
buffer is also checked, and that is nullptr which means scene linear.
This allows code outside of the render pipeline to make proper
decisions about how the imbuf of render passes are to be handled.

For example, IMB_create_gpu_texture() will now properly select
single channel grayscale texture format for depth pass coming from
multilayer EXR, additionally solving assert in the GPU compositor
code which verifies expected and actual imbuf texture format.

Pull Request: #117184
Make Subsampling 3x3 filter twice faster (on 4K UHD resolution,
Windows/VS2022/Ryzen5950X: 52.7ms -> 28.3ms), by reformulating how it works:

Conceptually Subsampling filter is a box filter: it sums up N source image
pixels, computes their average and outputs the result. Critical thing is,
that should be done in premultiplied space so that colors from fully or
mostly transparent regions do not "override" opaque  colors.

Previously, when operating on byte images, the code achieved this by always
working on byte values, doing "progressively smaller" lerp into byte color
result, taking care of premultiplication and again storing the "straight"
alpha for each sample being processed. This meant that for each sample, there
are 3 divisions involved! This also led to some precision loss, since for all
9 samples all the intermediate results would only be stored at byte precision.

Reformulate that by simply accumulating the premultiplied color as a float.
This gets rid of all divisions, except the last step when said float needs to
be written back into a byte color.

The unit test results have a tiny difference, since now it is arguably better
(as per above, previously it was having some precision loss).

Pull Request: #117125
This is necessary to be able to invoke baking of individual bake nodes
or simulation zones with Python.
This allows scripts to filter the set of bakes by e.g. the node name.
More filtering options will be necessary, but this is a good start.
`bounds_min_max` returns an optional and it can be `nullopt` when
curve points are 0.

Pull Request: #117163
`GIZMO_GT_button_2d` has no modal/custom_modal callback function
defined hence the crash due to calling `modal_fn()`

Pull Request: #117194
Curve resizing is already handled in `copy_only_curve_domain` (i.e.
copy curve nums/attributes, point_num = 0, fresh offset array)

Pull Request: #117166
The issue was that some code expected the "extend" sockets
to always exist. This was already always true from the user
point of view, but not internally.

There are different possible fixes, but this patch makes sure
that the extend socket will be available as expected. This is
achieved by making them part of the static node declaration.
We want to extend the static declaration of such dynamic
nodes anyway, to improve reflection capabilities without
having to instantiate nodes.
This patch ports the redesigned GPU Defocus node to the CPU.

Pull Request: #117174
Previously, calling the bake operator was always creating a job that will
be run in parallel to Blender. This is good when baking from the UI, but may
be undesired when baking with a script.

Now, when the `exec` method of the bake operator is called, the baking
happens synchronously. That means that the operator call will return only
after the baking is done. The `invoke` method has the same behavior as
before. This approach is similar to e.g. `FLUID_OT_bake_all`.

I did notice that calling the invoke method from a script can still result
in a crash sometimes, probably due to conflicting depsgraph evaluations.
That has to be investigated more.
The goal is to simplify the interface of the geometry nodes modifier while also
making it more scalable. This allows creating better looking modifiers which
feel more built-in. No functionality is removed by this patch.

The following changes are done:
* The `Output Attributes` panel is hidden when there are no output attributes.
* The `Internal Dependencies` panel is replaced by a new `Manage` panel that
  contains all the stuff that is common to all geometry nodes modifiers. It
  contains new `Bake` and `Named Attributes` panels for now.

Potential next steps:
* Merge `Output Attributes` panel with the rest of the input list.
* Support hiding the `Manage` panel under some circumstances.

Pull Request: #117170
A library probably shouldn't reference a single specific asset anyway.
These days the function on AssetRepresentation can probably be used instead
Brecht Van Lommel added 1 commit 2024-01-17 17:12:30 +01:00
Julian Eisel added 1 commit 2024-01-17 19:38:11 +01:00
Julian Eisel added 4 commits 2024-01-17 19:52:29 +01:00
Change for development/prototyping only: Include the brush assets from
the `working/` part of the SVN libraries repository, not just the ones
under `publish/`. This is managed by CMake during the installation build
step.
Had to add support for JSon (de)serializing of boolean properties.
Only show curve sculpt brushes in curve sculpt mode
Some checks failed
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
5e813f1563
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/PR106303) when ready.
Hans Goudey added 1 commit 2024-01-17 20:08:01 +01:00
Hans Goudey added 1 commit 2024-01-18 14:13:25 +01:00
The need to repeat std::pair isn't great, but at least this won't
result in a heap allocation.
Bastien Montagne added 1 commit 2024-01-19 12:32:34 +01:00
Bastien Montagne added 1 commit 2024-01-23 15:46:14 +01:00
Bastien Montagne added 1 commit 2024-01-23 15:53:39 +01:00
Bastien Montagne added 1 commit 2024-01-24 11:27:24 +01:00
Merge branch 'main' into brush-assets-project
Some checks failed
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
94b18b9e67
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/PR106303) when ready.
Julian Eisel added 1 commit 2024-01-24 18:20:46 +01:00
Hans Goudey added 1 commit 2024-01-24 19:09:35 +01:00
Hans Goudey added 2 commits 2024-01-24 20:02:44 +01:00
This fact is mentioned in the docs of #BKE_paint_brush_asset_set,
no need to duplicate the information.
Hans Goudey added 1 commit 2024-01-24 20:15:38 +01:00
Bastien Montagne added 1 commit 2024-01-25 10:35:07 +01:00
Hans Goudey added 1 commit 2024-01-25 16:13:37 +01:00
Bastien Montagne added 1 commit 2024-01-25 17:08:46 +01:00
Bastien Montagne added 1 commit 2024-01-25 17:10:47 +01:00
This commit extends the reporting and overwrite confirmation system
created for blendfiles saved by later Blender version, to also detect
and handle 'asset library' blendfiles.

Asset library blendfiles are defined by:
* Not having a defined current Screen or Scene in their global data.
* Having a filename ending by `.asset.blend`.

This is required to avoid/warn users about editing a file that would have
been generated in the 'default' asset library, e.g. when saving a new Brush
asset (see also Part of #116337 and #117239).

Pull Request: #117346
Hans Goudey added 1 commit 2024-01-25 21:45:50 +01:00
Hans Goudey added 1 commit 2024-01-26 19:20:12 +01:00
Hans Goudey added 1 commit 2024-01-26 19:48:31 +01:00
Hans Goudey added 1 commit 2024-01-26 20:40:03 +01:00
Hans Goudey added 1 commit 2024-01-26 21:08:33 +01:00
Instead of showing an active tool for every brush type,
just show a single active tool and rely on the asset shelf
to select different brushes.

A single generic "Brush" icon is used instead of the tool
icons. That avoids raising many questions in the future as
we get more brushes.

Pull Request: #117491
Brecht Van Lommel added 1 commit 2024-01-26 21:21:18 +01:00
Hans Goudey added 2 commits 2024-01-27 01:00:54 +01:00
Hans Goudey added 1 commit 2024-01-27 01:07:14 +01:00
Hans Goudey added 1 commit 2024-01-27 01:18:45 +01:00
Brecht Van Lommel added 1 commit 2024-01-27 23:32:13 +01:00
Brecht Van Lommel added 1 commit 2024-01-28 00:01:26 +01:00
Brush Assets: Save As, Delete, Revert and Update operators
Some checks failed
buildbot/vexp-code-experimental-lint Build done.
buildbot/vexp-code-experimental-darwin-arm64 Build done.
buildbot/vexp-code-experimental-darwin-x86_64 Build done.
buildbot/vexp-code-experimental-linux-x86_64 Build done.
buildbot/vexp-code-experimental-windows-amd64 Build done.
buildbot/vexp-code-experimental-coordinator Build done.
8e6dbddc5a
This is quickly hacked code to get basic features and user interface
testable. A lot more work will be required to make this good.

* Add Save As Asset and Delete Asset operators. These create and delete
  brushes assets in asset blend files in a user asset library.
* Update Asset save the current settings to the brush to the asset blend.
* Revert to Asset reverts settings to the ones from the asset blend.
* Regular datablock management buttons are replaced by this mechanism and
  hidden from the UI.
* Custom icon, modes and tool have been put into a subpanel. These will need
  to find a better place, but should be out of the way for now.

There are many TODO comments in the code, but some main things:
* Delete Asset should become undoable, perhaps with a Trash mechanism.
* Asset shelf refresh performance is poor and looks flickery.
* The brush selector menu lists local, linked and override brushes which is
  confusing. It should be made to match the asset shelf.
* Brush dependencies like textures are not handled yet.
* The partial write mechanism and various other parts of this code will
  need refactoring to be less hacky.

![brush_asset.png](/attachments/100f59cb-4ddf-429c-83d3-39b071c0cb08)

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: #117513
Brecht Van Lommel added 1 commit 2024-01-29 12:33:58 +01:00
Brecht Van Lommel added 1 commit 2024-01-29 12:44:20 +01:00
Brecht Van Lommel added 1 commit 2024-01-29 13:34:26 +01:00
Fix: missing catalogs, replace bundled assets entirely with testing/
Some checks failed
buildbot/vexp-code-experimental-lint Build done.
buildbot/vexp-code-experimental-darwin-arm64 Build done.
buildbot/vexp-code-experimental-darwin-x86_64 Build done.
buildbot/vexp-code-experimental-linux-x86_64 Build done.
buildbot/vexp-code-experimental-windows-amd64 Build done.
buildbot/vexp-code-experimental-coordinator Build done.
e26ebf6324
Not ideal to not have the hair node group assets, but we can have only
one catalog file so better to have brushes working at least.
Hans Goudey added 2 commits 2024-01-29 23:47:15 +01:00
Hans Goudey added 3 commits 2024-01-31 21:13:52 +01:00
Brecht Van Lommel added 3 commits 2024-01-31 21:24:19 +01:00
Brecht Van Lommel added 1 commit 2024-01-31 21:36:38 +01:00
Hans Goudey added 4 commits 2024-02-01 02:33:25 +01:00
* Add documentation / comments
* Apply const where possible to cache_init function codepath
* Minor cleanup of conditionals and initialization

Contains changes that were deferred from #117316

Pull Request: #117651
The benefits are O(1) access to the string size, clearer ownership,
and easily accessible utility functions. For now, only change functions
where the string is clearly non-null. It's not clear in what cases some
other functions recieve null strings.
Hans Goudey added 2 commits 2024-02-01 03:56:05 +01:00
Julian Eisel added 1 commit 2024-02-01 15:13:18 +01:00
Hans Goudey added 1 commit 2024-02-01 17:02:28 +01:00
Hans Goudey added 1 commit 2024-02-01 19:57:11 +01:00
Hans Goudey added 1 commit 2024-02-02 17:01:06 +01:00
Hans Goudey added 1 commit 2024-02-02 20:33:05 +01:00
Julian Eisel added 1 commit 2024-02-05 10:45:53 +01:00
Julian Eisel added 1 commit 2024-02-05 16:07:50 +01:00
Adds a new `bpy.types.AssetShelf.get_active_asset()` method to return
an active asset reference.
Hans Goudey added 1 commit 2024-02-05 17:21:38 +01:00
Hans Goudey added 1 commit 2024-02-05 17:43:44 +01:00
Julian Eisel added 1 commit 2024-02-05 18:26:46 +01:00
Julian Eisel added 1 commit 2024-02-07 10:58:05 +01:00
Julian Eisel added 1 commit 2024-02-07 16:33:18 +01:00
Hans Goudey added 1 commit 2024-02-07 18:36:01 +01:00
Hans Goudey added 1 commit 2024-02-07 18:48:47 +01:00
Hans Goudey added 1 commit 2024-02-07 19:02:56 +01:00
Don't use a keymap for the asset shelf to activate brushes; there's no
need to recreate basic UI interaction at this level. Instead use an
operator button so the ability to add a shortcut is automaticaly added
by other UI code.

Also change the operator to use an explicit asset reference instead of
the "context asset". This was already done for other operators that add
data-blocks from assets.

Pull Request: #117861
Hans Goudey added 1 commit 2024-02-07 19:18:29 +01:00
I'm not sure what the "data_block" part of the tool dictionary
actually does anymore but I won't get rid of it for now
Julian Eisel added 1 commit 2024-02-07 20:40:07 +01:00
Hans Goudey added 1 commit 2024-02-08 18:28:38 +01:00
Hans Goudey added 1 commit 2024-02-08 18:39:09 +01:00
Also use StringRef and pass the string refs by value
Hans Goudey added 1 commit 2024-02-08 18:47:28 +01:00
Hans Goudey added 1 commit 2024-02-08 21:22:30 +01:00
Hans Goudey added 1 commit 2024-02-08 23:48:01 +01:00
Hans Goudey added 1 commit 2024-02-09 00:02:45 +01:00
A new option controls where duplicated brushes are stored.
Maybe eventually the duplicate operator will allow choosing the
library, but it also seems reasonable to store a default so users
don't have to make that choice every time.

Pull Request: #117963
Hans Goudey added 1 commit 2024-02-09 00:07:04 +01:00
Hans Goudey added 1 commit 2024-02-09 00:11:50 +01:00
The idea is to make this code more general in the future
so it doesn't just deal with brush assets
Hans Goudey added 2 commits 2024-02-09 00:21:26 +01:00
Pass the asset library to some functions that always just retrieved the
default before. That makes them more flexible and fixes some potential
issues where the wrong asset library was updated or used in a poll
function, etc.
Just to make a diff in a future PR cleaner
Hans Goudey added 1 commit 2024-02-09 00:23:18 +01:00
Hans Goudey added 2 commits 2024-02-09 00:26:22 +01:00
Hans Goudey added 1 commit 2024-02-09 00:29:54 +01:00
Hans Goudey added 1 commit 2024-02-09 20:05:56 +01:00
Hans Goudey added 1 commit 2024-02-12 20:57:40 +01:00
Merge branch 'main' into brush-assets-project
All checks were successful
buildbot/vexp-code-experimental-darwin-x86_64 Build done.
buildbot/vexp-code-experimental-windows-amd64 Build done.
buildbot/vexp-code-experimental-darwin-arm64 Build done.
buildbot/vexp-code-experimental-lint Build done.
buildbot/vexp-code-experimental-linux-x86_64 Build done.
buildbot/vexp-code-experimental-coordinator Build done.
da344d30cd
Hans Goudey added 1 commit 2024-02-14 17:00:21 +01:00
Hans Goudey added 1 commit 2024-02-14 17:34:14 +01:00
Hans Goudey added 1 commit 2024-02-14 17:37:07 +01:00
Previously the new brush would always be saved to the default library.
Now the user is presented with a choice that defaults to the library marked
as "Default" in the preferences.

Because the library is now chosen by an operator property, we can't check
its editable status in the poll function. Instead we just check it when the
operator executes.

Pull Request: #118021
Hans Goudey added 2 commits 2024-02-14 19:35:04 +01:00
Soon there will be another asset library variable with a different type,
this is to distinguish the two
Hans Goudey added 1 commit 2024-02-14 20:25:42 +01:00
Activate the new brush tool when opening old files, and activate the
default brush asset for the mode. I'm guessing we may end up storing
the default brush asset for each mode somewhere else in the long term,
but doing it in versioning is simple now, and has the benefit of decoupling
the one time change from the defaults in the future.

Also replace the workspace's tool reference that could still point to the
old separate tools for each brush. This makes everything work by default
when opening a new factory startup file.

Pull Request: #118289
Hans Goudey added 1 commit 2024-02-14 23:24:13 +01:00
Hans Goudey added 1 commit 2024-02-15 17:37:58 +01:00
Julian Eisel added 1 commit 2024-02-15 18:01:08 +01:00
Adds a new `DEFAULT_VISIBLE` option for the `bl_options` of an asset
shelf. When this asset shelf will be created for the first time, the
asset shelf will be made visible, otherwise it will be hidden.

We don't mess with the visibility further, meaning, when re-opening a
previously active asset shelf, we keep the current asset shelf
visibility. So only the first load is affected. Alternatively asset
shelves could remember their last visibility state, and restore that as
context (e.g. the mode) changes. To be evaluated.

Had to add some trickery to make this overriding of visibility possible.
Julian Eisel added 1 commit 2024-02-15 18:05:29 +01:00
Brecht Van Lommel added 3 commits 2024-02-15 21:14:45 +01:00
Hans Goudey added 1 commit 2024-02-15 22:24:34 +01:00
Julian Eisel added 1 commit 2024-02-16 16:57:16 +01:00
Hans Goudey added 1 commit 2024-02-16 17:05:32 +01:00
Julian Eisel added 1 commit 2024-02-16 18:40:15 +01:00
After feedback from Julien, the "Cloth", "General" and "Painting"
catalogs are the ones we want to enable by default in mesh sculpt mode.
Other modes are fine with "All" only.
Hans Goudey added 2 commits 2024-02-20 21:07:46 +01:00
Hans Goudey added 1 commit 2024-02-20 21:35:21 +01:00
Julian Eisel added 1 commit 2024-02-21 12:23:25 +01:00
Julian Eisel added 1 commit 2024-02-21 13:04:11 +01:00
Hans Goudey added 1 commit 2024-02-21 14:03:49 +01:00
Adds the ability to choose which of the libraries catalogs to add the
new asset to, or to create a new catalog. The catalogs are presented
in a dropdown list, and every hierarchy level is available. Eventually
we might want some form of tree view here. But for now this approach is
very simple.

Pull Request: #118382
Hans Goudey added 1 commit 2024-02-21 15:52:16 +01:00
Hans Goudey added 2 commits 2024-02-21 16:25:55 +01:00
Hans Goudey added 1 commit 2024-02-21 16:27:04 +01:00
Hans Goudey added 1 commit 2024-02-21 16:59:56 +01:00
Hans Goudey added 1 commit 2024-02-21 17:08:17 +01:00
Hans Goudey added 1 commit 2024-02-21 23:09:58 +01:00
Julian Eisel added 1 commit 2024-02-22 17:48:18 +01:00
Hans Goudey added 1 commit 2024-02-22 19:03:45 +01:00
Hans Goudey added 1 commit 2024-02-22 21:54:57 +01:00
Brecht Van Lommel added 5 commits 2024-02-27 14:52:29 +01:00
This is an experiment, but we hope this can become stable
and in an acceptable state in the brush-assets-project branch.

* One main database per asset blend file, so that there are no
  conflicts between the regular main and different asset blend files.
* Various code for avoiding conflicts and untangling databases can
  be removed because of this.
* Assets are appended to this, no linking and overrides. Highlighting
  property changes is gone because of this. This change does not
  necessarily need to be made along with the rest, but it does simplify
  making renaming and editing textures work.
* Some basic checks to avoid linking between regular main and
  asset main, but much more would be needed.
* Tool settings brush pointers were changed to do no user counting,
  but really should not be part of ID management at all and handled
  purely through some runtime lookup outside of it.
* Basic texture editing works and gets saved and loaded. But will need
  more work for all operators, RNA, editors to deal with different mains.

Includes other changes for brush/tool selection.
* Remove "brush select" operator
* Remove creating a new brush on Paint init when none is found
* Remove unnecessary tool -> brush connection
* Remove BRUSH_OT_add operator

Pull Request: #117730
This doesn't seem to be visible anywhere in the UI. New brushes
are more easily created by duplicating existing brushes anyway.
These were adding brushes and finding brushes in the active (non-asset)
main. This sort of thing should be handled differently now anyway
Now instead of creating a brush from scratch, the default asset
should be used instead. I'm pretty sure that is done elsewhere,
and if it isn't it should be fixed.
Selecting a brush based on the tool type isn't done anymore,
and this operator doesn't really make sense in the context of
prioritizing brush selection instead of tool selection / the asset
shelf. It would otherwise have to be fixed for storing brush
data-blocks in other mains.
Hans Goudey added 1 commit 2024-02-28 15:49:09 +01:00
Brecht Van Lommel added 5 commits 2024-02-28 17:12:38 +01:00
Instead of specifically naming this function after asset weak
references.
Including no main database cases that were not checked previously.
Replaces BKE_id_is_in_global_main assets by moving them in
BKE_main_from_id which needs to be called anyway.
Hans Goudey added 1 commit 2024-02-28 17:23:59 +01:00
Hans Goudey added 1 commit 2024-02-28 18:59:44 +01:00
This code that set a different tool as active depending on the brush
isn't relevant anymore. It's possible that the deletion could go further
into Python code, but the separation isn't so clear there.
Julian Eisel added 1 commit 2024-02-28 19:54:30 +01:00
Apparently userdef versioning doesn't run for factory settings.
Hans Goudey added 2 commits 2024-02-28 20:20:20 +01:00
I found two cases where `BKE_blender_free` frees pointers that
are owned by the asset main, resulting in use-after-frees:
- Image pool for sculpt brush evaluation
- Freeing the "moviecache" system which isn't stored per-Main

To fix these, free the asset main data-bases after the global main.
Put the new image data-block in the asset main if the owner
of the pointer property is also in that Main.
Brecht Van Lommel added 1 commit 2024-02-28 20:23:00 +01:00
Fix: Restore bundling of testing/ assets that got lost in merge
Some checks failed
buildbot/vexp-code-experimental-lint Build done.
buildbot/vexp-code-experimental-darwin-x86_64 Build done.
buildbot/vexp-code-experimental-linux-x86_64 Build done.
buildbot/vexp-code-experimental-windows-amd64 Build done.
buildbot/vexp-code-experimental-coordinator Build done.
buildbot/vexp-code-experimental-darwin-arm64 Build done.
e7c03c1644
Hans Goudey added 2 commits 2024-02-28 22:15:09 +01:00
Julian Eisel added 1 commit 2024-02-29 12:27:30 +01:00
Julian Eisel added 1 commit 2024-02-29 12:47:22 +01:00
Take brush assets out of experimental
Some checks failed
buildbot/vexp-code-experimental-lint Build done.
buildbot/vexp-code-experimental-darwin-arm64 Build done.
buildbot/vexp-code-experimental-darwin-x86_64 Build done.
buildbot/vexp-code-experimental-linux-x86_64 Build done.
buildbot/vexp-code-experimental-windows-amd64 Build done.
buildbot/vexp-code-experimental-coordinator Build done.
554dcdd429
This makes brush assets be fully supported (non-experimental) asset types.
Julian Eisel added 1 commit 2024-02-29 14:40:11 +01:00
Hans Goudey added 1 commit 2024-02-29 16:36:45 +01:00
Hans Goudey added 2 commits 2024-02-29 17:43:56 +01:00
Hans Goudey added 1 commit 2024-02-29 17:54:28 +01:00
Julian Eisel added 1 commit 2024-02-29 17:55:37 +01:00
Hans Goudey added 1 commit 2024-02-29 19:57:13 +01:00
Otherwise a name change doesn't update the asset shelf.
Though there are still other issues with renaming- duplicate brushes
will be created when renaming a local copy, switching brushes, then
switching back. Other local changes will also be lost in that case.
Hans Goudey added 2 commits 2024-02-29 20:43:35 +01:00
Hans Goudey added 1 commit 2024-02-29 21:11:01 +01:00
UI: Use "label tooltip" as a fallback for quick favorites menu text
Some checks reported errors
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-experimental-coordinator Build done.
buildbot/vexp-code-experimental-lint Build done.
buildbot/vexp-code-experimental-darwin-x86_64 Build done.
buildbot/vexp-code-experimental-darwin-arm64 Build done.
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
buildbot/vexp-code-experimental-linux-x86_64 Build done.
buildbot/vexp-code-experimental-windows-amd64 Build done.
151e5f4fe2
Useful when the button has no display text but has been set up
to have a quickly accessible tooltip in its place.
Brecht Van Lommel added 1 commit 2024-03-06 18:13:46 +01:00
Hans Goudey added 1 commit 2024-03-06 19:56:58 +01:00
Julian Eisel added 1 commit 2024-03-07 17:18:57 +01:00
Julian Eisel added 1 commit 2024-03-07 17:19:39 +01:00
Julian Eisel added 2 commits 2024-03-13 16:30:04 +01:00
Julian Eisel added 1 commit 2024-03-13 17:43:17 +01:00
Julian Eisel added 1 commit 2024-03-13 17:49:43 +01:00
Julian Eisel added 2 commits 2024-03-20 18:38:01 +01:00
Brecht Van Lommel added 5 commits 2024-03-22 20:09:08 +01:00
Brecht Van Lommel added 1 commit 2024-03-22 20:21:13 +01:00
Brecht Van Lommel added 1 commit 2024-03-22 20:40:29 +01:00
Brecht Van Lommel added 1 commit 2024-03-25 14:35:04 +01:00
This is done by reloading or freeing the entire main of the asset, and
remapping pointers for all datablocks contained in it. This remapping is
primarily needed for the user interface to point to the same datablocks.

Pull Request: #119806
Hans Goudey added 1 commit 2024-03-27 14:02:11 +01:00
Hans Goudey added 1 commit 2024-03-27 14:38:40 +01:00
Hans Goudey added 2 commits 2024-03-27 14:46:02 +01:00
Hans Goudey added 1 commit 2024-03-27 17:20:09 +01:00
Hans Goudey added 1 commit 2024-03-27 21:29:15 +01:00
Hans Goudey added 1 commit 2024-03-28 14:38:56 +01:00
Julian Eisel added 1 commit 2024-03-28 16:38:20 +01:00
Hans Goudey added 1 commit 2024-03-28 20:52:53 +01:00
Hans Goudey added 1 commit 2024-03-29 16:51:20 +01:00
Hans Goudey added 1 commit 2024-03-29 17:01:33 +01:00
There was a catch I didn't expect with the outliner treestore, but
solving that this way seems fine anyway.

Pull Request: #120039
Brecht Van Lommel added 1 commit 2024-03-29 17:23:47 +01:00
* Move from paint_ops.cc and asset_weak_reference.cc into asset_edit.cc
* Rename AssetWeakReferenceMain to AssetEditBlend
* Change some functions to be based on ID instead of main pointer
* Make most of save as and update code no longer brush specific

Pull Request: #119888
Hans Goudey added 1 commit 2024-03-29 17:57:37 +01:00
Hans Goudey added 1 commit 2024-03-29 18:01:00 +01:00
Use the library from the operator's last execution instead of storing a
"default" option in the user preferences. Or if the last library isn't available,
use the current library as a default, or the first library if the current
library isn't editable.

Also use the asset's current catalog path for the initial asset path.

Pull Request: #120028
Hans Goudey added 1 commit 2024-03-29 18:05:27 +01:00
The operator requires the paint->brush_asset_reference.
That should always be set anyway, but better to be safe.
Hans Goudey added 1 commit 2024-03-29 18:11:26 +01:00
Null-ness of paint and brush is checked in the operator's poll function
Hans Goudey added 1 commit 2024-03-29 18:12:41 +01:00
Hans Goudey added 1 commit 2024-03-29 19:24:01 +01:00
Hans Goudey added 1 commit 2024-04-03 16:01:01 +02:00
Julian Eisel added 1 commit 2024-04-04 11:33:57 +02:00
Julian Eisel added 1 commit 2024-04-10 17:02:51 +02:00
Hans Goudey added 1 commit 2024-04-11 00:38:58 +02:00
Hans Goudey added 1 commit 2024-04-11 14:36:17 +02:00
Hans Goudey added 1 commit 2024-04-11 17:19:04 +02:00
Hans Goudey added 2 commits 2024-04-11 18:09:15 +02:00
The catalog wasn't found for the "All" catalog, for example.
Not sure why, but there's no reason to be so strict here.
Hans Goudey added 3 commits 2024-04-11 20:54:15 +02:00
Hans Goudey added 1 commit 2024-04-11 21:53:46 +02:00
Hans Goudey added 1 commit 2024-04-17 16:42:45 +02:00
Hans Goudey added 1 commit 2024-04-17 17:00:05 +02:00
Hans Goudey added 1 commit 2024-04-17 17:29:12 +02:00
Add an operator to edit the catalog, author, and description of brush
assets. This doesn't edit the preview image yet, I prefer to add that
separately.

![image](/attachments/50ab300d-f130-44be-9134-df7a3a15b233)

Pull Request: #120081
Hans Goudey added 1 commit 2024-04-18 14:28:11 +02:00
The asset system makes some assumptions about these `.asset.blend`
files that make working with them much easier. Disallowing manual
saving was a way to help keep those assumptions true. However
it also gets in the way when working with these files.

This PR removes the stripping of the ".asset" part of the file path
and rephrases the warning message.

Pull Request: #120746
Hans Goudey added 1 commit 2024-04-18 15:53:55 +02:00
Hans Goudey added 2 commits 2024-04-19 22:08:23 +02:00
Hans Goudey added 1 commit 2024-04-22 20:54:54 +02:00
Hans Goudey added 1 commit 2024-04-23 19:46:49 +02:00
Hans Goudey added 1 commit 2024-04-23 19:50:42 +02:00
Hans Goudey added 1 commit 2024-04-24 14:33:16 +02:00
Julian Eisel added 1 commit 2024-04-24 17:37:43 +02:00
Adds a new asset shelf option (`STORE_ENABLED_CATALOGS_IN_PREFERENCES` option in BPY) to use the Preferences for storing the enabled catalogs. This way asset shelf types can decide if for their use-case, they want to synchronize the enabled catalogs over Blender sessions and files, or keep the stored locally in the file.

This is important because for example on one hand, it would be annoying if for brush assets you'd have to enable the visible catalog tabs for every 3D View and every file, while on the other hand you need that level of control for the pose library where the catalogs the rigger/animator cares about varies from project to project, character to character and shot to shot.

Conceptually this also makes some sense: The new brush assets workflow synchronizes brush assets and their catalogs across Blender sessions and files, basically making them globally accessible independent of the current file/project, so treating the enabled catalogs the same is consistent.

Pull Request: #120264
Hans Goudey added 1 commit 2024-04-24 21:13:51 +02:00
Hans Goudey added 1 commit 2024-04-24 21:17:06 +02:00
Hans Goudey added 1 commit 2024-04-24 21:42:54 +02:00
Julian Eisel added 2 commits 2024-04-25 16:09:39 +02:00
Julian Eisel added 1 commit 2024-04-26 12:40:43 +02:00
Julian Eisel added 1 commit 2024-04-26 16:03:20 +02:00
Hans Goudey added 1 commit 2024-04-26 18:16:31 +02:00
Hans Goudey added 1 commit 2024-04-26 18:36:46 +02:00
When adding a new brush asset in a new catalog,
make it visible in the currently active asset shelf.

Pull Request: #120531
Julian Eisel added 2 commits 2024-04-30 12:48:56 +02:00
Julian Eisel added 1 commit 2024-04-30 18:40:23 +02:00
Needs a bit of polish and should be enabled by default (while allowing
other interactions with the popup, which isn't trivial), but works
otherwise.
Hans Goudey added 1 commit 2024-05-01 15:04:23 +02:00
Hans Goudey added 1 commit 2024-05-01 16:49:29 +02:00
Hans Goudey added 2 commits 2024-05-01 18:09:44 +02:00
Hans Goudey added 1 commit 2024-05-01 18:28:42 +02:00
Hans Goudey added 1 commit 2024-05-01 18:43:56 +02:00
The diff doesn't try to find similarities between deleted and added code this way
Julian Eisel added 1 commit 2024-05-01 19:11:58 +02:00
Brecht Van Lommel added 3 commits 2024-05-01 19:26:43 +02:00
* Update asset shelves in all open areas, the operator can not be
  expected to be running in the 3D viewport specifically.
* Don't use unreachable asset when there is no shelf found with
  active_shelf_from_area. This is expected behavior in both places
  the function is used.
Hans Goudey added 3 commits 2024-05-01 20:06:40 +02:00
Hans Goudey added 1 commit 2024-05-01 20:16:18 +02:00
Fix: Correct default tools in affected modes
Some checks failed
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
66ec79e536
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/PR106303) when ready.
Hans Goudey added 1 commit 2024-05-02 18:01:16 +02:00
Hans Goudey added 1 commit 2024-05-02 18:06:05 +02:00
Hans Goudey added 1 commit 2024-05-02 18:23:30 +02:00
Hans Goudey added 1 commit 2024-05-02 18:34:56 +02:00
Hans Goudey added 1 commit 2024-05-02 18:39:38 +02:00
Hans Goudey added 1 commit 2024-05-02 18:44:31 +02:00
Hans Goudey added 1 commit 2024-05-02 19:02:07 +02:00
Hans Goudey added 1 commit 2024-05-02 19:49:35 +02:00
Hans Goudey added 1 commit 2024-05-02 19:52:21 +02:00
Brecht Van Lommel added 2 commits 2024-05-02 21:03:49 +02:00
Hans Goudey added 1 commit 2024-05-03 00:58:54 +02:00
Allow using the definition outside of space_view3d.py in a way that doesn't
cause circular dependencies.
Hans Goudey added 1 commit 2024-05-03 00:59:23 +02:00
Hans Goudey added 1 commit 2024-05-03 03:37:36 +02:00
Hans Goudey added 1 commit 2024-05-03 03:41:08 +02:00
One grease pencil operator added a local brush if one didn't exist already.
That shouldn't be necessary anymore because the brushes will all be assets,
so there will always be brushes available. Similarly, the "reset" operators
aren't useful anymore because we reset to the state stored in assets rather
than some other default state, and that's handled by the asset system.

The grease pencil icon code managed icons for each brush tool. That's now
unnecessary for the same reason-- the icons/previes are managed by the
asset system.

A follow up PR will make the brush UI in the 3D view sidebar follow this
design better.
Hans Goudey added 1 commit 2024-05-03 15:06:42 +02:00
Hans Goudey added 1 commit 2024-05-03 16:21:55 +02:00
Hans Goudey added 1 commit 2024-05-03 16:36:56 +02:00
Being so strict here isn't helpful, it's not hard to trigger this
Hans Goudey added 1 commit 2024-05-03 17:06:54 +02:00
Also move the old brush icon to a separate panel.
Also make GPv2 modes work properly and mostly fixes GPv3,
though I think there are problems with grease pencil itself
for that too.
Hans Goudey added 1 commit 2024-05-03 17:08:29 +02:00
Hans Goudey added 1 commit 2024-05-03 17:09:24 +02:00
Julian Eisel added 1 commit 2024-05-03 17:44:34 +02:00
Julian Eisel added 1 commit 2024-05-03 18:08:20 +02:00
Hans Goudey added 2 commits 2024-05-03 18:21:54 +02:00
These local brushes aren't necessary anymore, assets are used instead.
We can assume all the necessary brushes exist in the essentials library.
Local brushes should never really be necessary for a typical user-- we
always edit them directly in their asset libraries.
Hans Goudey added 1 commit 2024-05-03 18:23:46 +02:00
Julian Eisel added 1 commit 2024-05-03 18:27:15 +02:00
Brecht Van Lommel added 1 commit 2024-05-03 18:57:34 +02:00
All these brushes are getting deleted at the end of the function.
Brecht Van Lommel added 1 commit 2024-05-03 19:28:27 +02:00
Brecht Van Lommel added 1 commit 2024-05-03 19:51:04 +02:00
Fix: Issues restoring brush after secondary smooth brush usage
Some checks reported errors
buildbot/vexp-code-experimental-lint Build done.
buildbot/vexp-code-experimental-darwin-x86_64 Build done.
buildbot/vexp-code-experimental-darwin-arm64 Build done.
buildbot/vexp-code-experimental-linux-x86_64 Build done.
buildbot/vexp-code-experimental-windows-amd64 Build done.
buildbot/vexp-code-experimental-coordinator Build done.
a25c1b9418
Storing the brush pointer instead of the name should be fine for the
duration of a brush stroke.
Brecht Van Lommel added 1 commit 2024-05-03 20:46:10 +02:00
Brecht Van Lommel added 1 commit 2024-05-03 21:26:43 +02:00
Previous refactor removed too much code, and soft eraser still needs to
be made to work again after this.
Hans Goudey added 1 commit 2024-05-03 21:30:32 +02:00
Merge branch 'main' into brush-assets-project
Some checks failed
buildbot/vexp-code-experimental-lint Build done.
buildbot/vexp-code-experimental-darwin-arm64 Build done.
buildbot/vexp-code-experimental-darwin-x86_64 Build done.
buildbot/vexp-code-experimental-linux-x86_64 Build done.
buildbot/vexp-code-experimental-windows-amd64 Build done.
buildbot/vexp-code-experimental-coordinator Build done.
0d15cc96a3
Hans Goudey added 1 commit 2024-05-03 21:35:46 +02:00
Hans Goudey added 1 commit 2024-05-03 22:14:15 +02:00
Make the asset shelf always show in the image editor's paint
UI mode. And fix the popup to show in the sidebar. That required
changing the way we retrieve the brush asset shelf name from the
context. ALso fix a few panels that didn't check for whether there
was a brush. While that shouldn't really happen it does currently
and it's nice to avoid the errors.
Julian Eisel added 2 commits 2024-05-03 23:25:23 +02:00
Julian Eisel added 1 commit 2024-05-03 23:32:56 +02:00
Cleanup: Unnecessary include
Some checks failed
buildbot/vexp-code-experimental-lint Build done.
buildbot/vexp-code-experimental-darwin-arm64 Build done.
buildbot/vexp-code-experimental-darwin-x86_64 Build done.
buildbot/vexp-code-experimental-windows-arm64 Build done.
buildbot/vexp-code-experimental-linux-x86_64 Build done.
buildbot/vexp-code-experimental-windows-amd64 Build done.
buildbot/vexp-code-experimental-coordinator Build done.
5e6dbe5ebf
Julian Eisel added 1 commit 2024-05-06 15:49:40 +02:00
- Ensure all items in the grid view have the correct width. Also fixes
  the issue where items in the last row had a different width.
- Fix width of catalog tree (would sometimes increase/decrease width)
- Improve padding around popup content
- Properly attach the popup to the button

Note that previews are bigger now, think the same size as in other
search boxes with previews. We can decide on the default
size still.
Julian Eisel added 1 commit 2024-05-06 15:51:49 +02:00
Not showing this is mostly for space saving and aesthetic reasons,
which are not as relevant for the popup that isn't permanently on
screen.
Brecht Van Lommel added 1 commit 2024-05-06 16:12:19 +02:00
Julian Eisel added 1 commit 2024-05-06 16:13:34 +02:00
Actually more than cleanup, this ensures the same setup is done if the
asset shelf can't be created/found.
Hans Goudey added 1 commit 2024-05-07 01:43:38 +02:00
Hans Goudey added 1 commit 2024-05-07 14:40:58 +02:00
A simple operator like the existing `ed.lib_id_load_custom_preview`
operator. I didn't reuse that because the requirements are a bit
different. In particular we want to re-save the asset when the
preview image is changed.

The operator is available as a new entry in the existing brush asset
context menu.

Pull Request: #121505
Julian Eisel added 1 commit 2024-05-07 15:54:27 +02:00
Brecht Van Lommel added 2 commits 2024-05-07 20:48:55 +02:00
Handle node editor, RNA function calls, image unpack, and a few more
things that were missed.
Brecht Van Lommel added 1 commit 2024-05-07 21:15:44 +02:00
Julian Eisel added 1 commit 2024-05-08 13:25:20 +02:00
Merge branch 'main' into brush-assets-project
Some checks failed
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
9bba514e89
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/PR106303) when ready.
Brecht Van Lommel added 2 commits 2024-05-08 15:36:50 +02:00
Mesh > Sculpt to Mesh Sculpt, Painting to Paint, Transforming to Transform.
Still doesn't fix the missing brush selection in the 2D animation
template though.
Hans Goudey added 1 commit 2024-05-08 18:05:21 +02:00
Hans Goudey added 1 commit 2024-05-08 18:24:14 +02:00
Hans Goudey added 1 commit 2024-05-08 19:04:23 +02:00
Hans Goudey added 1 commit 2024-05-08 21:45:20 +02:00
Brecht Van Lommel added 2 commits 2024-05-10 22:44:41 +02:00
Brecht Van Lommel added 1 commit 2024-05-13 16:37:24 +02:00
Instead of a boolean on brushes, this is now a secondary brush pointer
and asset reference. It can be chosen from a new Eraser panel in the
brush tool properties.

It was implemented generically, since this functionality may be useful
to extend to other modes in the future.

This currently defaults to Eraser Hard, should be changed to Eraser
Soft once the essentials library has been updated to include this.

Note: actually selecting the brush depends on #121597.

Pull Request: #121675
Julian Eisel added 1 commit 2024-05-14 17:24:36 +02:00
Brecht Van Lommel added 1 commit 2024-05-15 20:55:45 +02:00
It can be confusing to have the brush highlighted when it doesn't
actually do anything currently.

Pull Request: #121671
Julian Eisel added 1 commit 2024-05-16 12:41:03 +02:00
Brecht Van Lommel added 1 commit 2024-05-16 16:27:36 +02:00
Brecht Van Lommel added 5 commits 2024-05-17 14:55:29 +02:00
The datablocks remain linked, but are marked as editable anyway. This is
restricted to datablock types related to brush assets.
Using the implementation from Bastien with some tweaks. It will only
preserve linked editable brushes, textures, nodes and images. In theory
these datablocks could reference e.g. an object through custom properties,
and it seems safer not to drag those along.
Create new textures, node groups and images in the same library as the
brush. Don't allow linking to local brush templates in ID template.

This covers the cases relevant to brush assets. But it does not make
all RNA and operators validate this.
For the Python API and other code to properly retain the brush on save
and reload.
Brecht Van Lommel added 2 commits 2024-05-21 18:51:38 +02:00
Julian Eisel added 1 commit 2024-05-23 15:48:09 +02:00
Brecht Van Lommel added 6 commits 2024-05-23 18:06:12 +02:00
Julian Eisel added 1 commit 2024-05-24 13:06:42 +02:00
Would print errors when switching workspaces
Julian Eisel added 1 commit 2024-05-24 18:14:55 +02:00
Brush assets: Use Popover for asset shelves & operator to invoke from shortcut
Some checks failed
buildbot/vexp-code-experimental-lint Build done.
buildbot/vexp-code-experimental-darwin-x86_64 Build done.
buildbot/vexp-code-experimental-darwin-arm64 Build done.
buildbot/vexp-code-experimental-linux-x86_64 Build done.
buildbot/vexp-code-experimental-windows-amd64 Build done.
buildbot/vexp-code-experimental-coordinator Build done.
27137265d8
- Turn the asset shelf popup into a popover. This requires instantiating it via
  a panel.
- Add operator to call an asset shelf popover. It takes the idname of the asset
  shelf to display as operator property.
- Allow assigning a shortcut for an asset shelf popover through the context
  menu of buttons invoking the asset shelf popover ("Assign Shortcut", "Remove
  Shortcut" and "Change Shortcut").
- Add Shift+spacebar as asset panel popover shortcut for testing. Unclear if we
  want to keep it there.
- Removed change to always support refreshing popup blocks flagged with
  `UI_BLOCK_KEEP_OPEN`. Might make sense still, but will keep it separate.

Had to add support for storing strings as context members, to pass the asset
shelf name to the panel code somehow before the panel is created even. Think
this is generally useful, as we've tried to pass such strings through context
before. We'd fallback to creating RNA structs holding a single string property
to be able to do this, an annoying workaround.

Pull Request: #122068
Julian Eisel added 2 commits 2024-06-04 12:48:43 +02:00
Julian Eisel added 1 commit 2024-06-04 12:49:13 +02:00
Julian Eisel added 1 commit 2024-06-05 18:28:39 +02:00
Julian Eisel added 1 commit 2024-06-07 19:21:35 +02:00
Julian Eisel added 1 commit 2024-06-07 19:41:19 +02:00
Julian Eisel added 1 commit 2024-06-10 10:26:12 +02:00
Hans Goudey added 1 commit 2024-06-10 14:43:12 +02:00
Hans Goudey added 2 commits 2024-06-10 15:06:20 +02:00
Julian Eisel added 1 commit 2024-06-11 19:00:11 +02:00
Julian Eisel added 1 commit 2024-06-12 13:20:13 +02:00
Julian Eisel added this to the Brush Assets & Asset Shelf project 2024-06-14 11:49:31 +02:00
Julian Eisel added 1 commit 2024-06-14 15:13:35 +02:00
Julian Eisel added 1 commit 2024-06-14 15:30:46 +02:00
Running `make update` on this branch should now also automatically
checkout the `brush-assets-project` branch of the bundled assets
repository, which contains the assets ready for merging into the main
branch.
Julian Eisel added 1 commit 2024-06-14 16:53:08 +02:00
Julian Eisel added 1 commit 2024-06-14 16:53:51 +02:00
Julian Eisel added 1 commit 2024-06-14 17:14:26 +02:00
Idea is to make the asset shelf popup work like search-boxes, where the search
text field is always active, but the rest of the popup stays interactive too
(mouse hover feedback, click to activate, context menu, etc). This requires
some changes in the button event handling, since we don't support multiple
active/focused buttons, search-boxes have their own handling outside the normal
layout, drawing & event handling code.

Other developers expressed that this seems like something we'd want to use more
often.

Pull Request: #122871
Julian Eisel added 1 commit 2024-06-14 22:41:47 +02:00
Julian Eisel added 1 commit 2024-06-14 22:42:34 +02:00
Julian Eisel added 1 commit 2024-06-17 12:30:46 +02:00
Julian Eisel added 1 commit 2024-06-17 15:26:47 +02:00
Julian Eisel added 1 commit 2024-06-19 14:23:58 +02:00
Julian Eisel added 1 commit 2024-06-19 15:31:08 +02:00
Following experiments in #123202. It seems like most people agree that this is
the best way to go about it.
Julian Eisel added 1 commit 2024-06-19 16:36:20 +02:00
Julian Eisel added 1 commit 2024-06-20 16:23:30 +02:00
Julian Eisel added 1 commit 2024-06-20 17:27:12 +02:00
Setting the asset weak reference for the active brush wouldn't work for
assets local to the file, the case simply wasn't handled.

Pull Request: #123492
Julian Eisel added 1 commit 2024-06-20 18:43:24 +02:00
- Better name ("repository" is not a term we use in this context), could
  also name it `is_asset_system_file`.
- Make comment less abstract
- Don't comment on what it's used for, gets outdated quickly and can be
  easily found out.

Pull Request: #123501
Julian Eisel added 1 commit 2024-06-21 14:46:44 +02:00
Julian Eisel added 1 commit 2024-06-25 11:37:15 +02:00
Merge branch 'main' into brush-assets-project
Some checks failed
buildbot/vexp-code-experimental-lint Build done.
buildbot/vexp-code-experimental-darwin-x86_64 Build done.
buildbot/vexp-code-experimental-darwin-arm64 Build done.
buildbot/vexp-code-experimental-windows-arm64 Build done.
buildbot/vexp-code-experimental-linux-x86_64 Build done.
buildbot/vexp-code-experimental-windows-amd64 Build done.
buildbot/vexp-code-experimental-coordinator Build done.
4ed140a4db
Julian Eisel added 1 commit 2024-06-26 13:43:44 +02:00
Julian Eisel added 1 commit 2024-06-26 14:17:48 +02:00
Julian Eisel added 1 commit 2024-06-26 16:17:14 +02:00
Dalai suggested this, think it's reasonable to not "encourage" people too much
to edit these files.

Could also have something like a `AssetRepresentation.is_from_asset_file` RNA
property, but that may have false positives if users manually chose a
`.asset.blend` name. In that case we might want to check if the files are
library-only files, but seems overkill for this use case.

Pull Request: #123781
Julian Eisel added 1 commit 2024-06-27 13:12:58 +02:00
Julian Eisel added 1 commit 2024-06-27 15:51:45 +02:00
5695298832 removed code initializing the icons, so they weren't usable,
just their ICON_ enumerator still existed. Remove the icons from RNA to
avoid errors.

Fixes empty icons in the brush tool menu and error prints.
Julian Eisel added 1 commit 2024-06-27 16:10:23 +02:00
Julian Eisel added 1 commit 2024-06-28 12:29:25 +02:00
Dalai Felinto added 1 commit 2024-06-28 14:43:25 +02:00
Julian Eisel added 1 commit 2024-07-01 11:16:58 +02:00
Julian Eisel added 1 commit 2024-07-01 14:29:58 +02:00
Julian Eisel added 1 commit 2024-07-01 15:37:07 +02:00
I think calling the brush activation function with an already active brush
can be considered success in the API. Plus, we may still have to update
the brush asset reference, otherwise it might end up outdated, or out of
sync with the actually active brush. Noted in comment.

Pull Request: #123990
Dalai Felinto added 1 commit 2024-07-01 15:43:30 +02:00
Julian Eisel added 1 commit 2024-07-01 15:51:43 +02:00
Use the term "activate" since that's consistent with Blender
terminology, where "select" is for when multiple items can be selected.
Discussed with Hans in the chat.
Julian Eisel added 1 commit 2024-07-02 11:51:12 +02:00
Julian Eisel added 1 commit 2024-07-02 12:07:38 +02:00
Julian Eisel added 1 commit 2024-07-02 16:12:56 +02:00
Make sure the view item the context menu is spawned from is always
activated. The context menu relies on that (it accesses the active brush
from paint settings, and the brush needs to be imported to apply
operations like "Edit Metadata").

Had to refactor how closing the popup on activation works. It's now a
general view feature and enabled by default. Can be disabled using
`ui::AbstractView::set_popup_keep_open()`.

Pull Request: #124043
Julian Eisel added 1 commit 2024-07-03 13:03:03 +02:00
Julian Eisel added 1 commit 2024-07-03 13:04:27 +02:00
Julian Eisel added 1 commit 2024-07-03 14:10:25 +02:00
Julian Eisel added 1 commit 2024-07-04 19:42:01 +02:00
Julian Eisel added 1 commit 2024-07-04 19:50:41 +02:00
Julian Eisel added 1 commit 2024-07-04 22:47:14 +02:00
Julian Eisel added 1 commit 2024-07-05 12:12:32 +02:00
Julian Eisel added 1 commit 2024-07-05 12:27:49 +02:00
Julian Eisel added 1 commit 2024-07-05 14:56:50 +02:00
The name "tool" is overloaded, plus, there actually is a "Brush Tool" now. As a
follow up to the assets project merge we can rename this in C++, added to #116337
and opened #124201. At least rename it in the UI for a start.

Pull Request: #124203
Julian Eisel added 1 commit 2024-07-05 18:35:12 +02:00
Brush Assets: Better detection & protection for asset system files
All checks were successful
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
f71d7c5794
Only relying on the .asset.blend extension was weak, it was too easy to save
files this way. Not just by manually naming files, but also by using "Save As"
on such a file (as suggested by previous the warning popup), without actually
changing the file name.

Instead, additionally set a flag for asset system files, only treat these as
writable by the asset system, and disallow overriding them manually.

- Opening an asset system file shows a warning.
- The status bar shows a permanent warning for such a file.
- Attempting to save such an asset system file will fail with a warning popup.
  It lets you choose to cancel or use "Save As" instead, but not override the
  file.
- When using "Save As" from an asset system file, the .asset.blend is replaced
  with .blend
- An additional check in the main .blend file writing function prevents
  writing files as asset system files if they are not identified as such.

This should prevent us from any unintentional user data loss through file
saving and asset editing.

Files may still manually be named .asset.blend now. They are just normal
.blend files.

Pull Request: #124246
Julian Eisel changed title from WIP: Brush assets project to Brush assets project 2024-07-05 19:35:54 +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/PR106303) when ready.
Julian Eisel added 1 commit 2024-07-06 11:18:53 +02:00
Julian Eisel added 1 commit 2024-07-06 12:02:18 +02:00
There was no good reason to wait with that, so merged as c02a78249c.
Julian Eisel added 1 commit 2024-07-06 12:08:10 +02:00
Julian Eisel added 1 commit 2024-07-07 20:25:25 +02:00
Julian Eisel added 1 commit 2024-07-08 10:49:36 +02:00
Author
Member

Merged into main: d51cab60df...f4525c9901

Merged into `main`: https://projects.blender.org/blender/blender/compare/d51cab60df6e36972dc14055a3d2f854a7e2d3c4...f4525c99015afa5aa1aa02bcfc40305bcf2d1efd
Julian Eisel closed this pull request 2024-07-09 10:32:59 +02:00

Pull request closed

Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
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
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
EEVEE & Viewport
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
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
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
6 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#106303
No description provided.