WIP: Brush assets project #106303

Draft
Julian Eisel wants to merge 286 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.

286 Commits

Author SHA1 Message Date
Hans Goudey 2ff7ed0366 Brush Assets: Show new catalog in asset shelf when duplicating brush
When adding a new brush asset in a new catalog,
make it visible in the currently active asset shelf.

Pull Request: #120531
2024-04-26 18:36:27 +02:00
Hans Goudey eb041d185c Merge branch 'main' into brush-assets-project 2024-04-26 12:10:05 -04:00
Julian Eisel 1f83f277dc Brush asset shelf popup
Pull Request: #119217
2024-04-26 16:03:00 +02:00
Julian Eisel e41ecb28db Merge branch 'main' into brush-assets-project 2024-04-26 12:40:17 +02:00
Julian Eisel 3be12541cd Fix compile error after changes in main
See fe0e2907b3.
2024-04-25 16:09:00 +02:00
Julian Eisel 1217e35359 Merge branch 'main' into brush-assets-project 2024-04-25 15:46:40 +02:00
Hans Goudey cdba752bb0 Brush Assets: Add asset shelf to image editor
Pull Request: #120844
2024-04-24 21:44:09 +02:00
Hans Goudey f60eeb9e3e Fix: Compile error after merge 2024-04-24 15:42:27 -04:00
Hans Goudey d7ae38471b Cleanup: Remove unnecessary change in versioning 2024-04-24 15:15:30 -04:00
Hans Goudey d2e56527e5 Merge branch 'main' into brush-assets-project 2024-04-24 15:12:15 -04:00
Julian Eisel f2086022ee Brush Assets: Make enabled catalog storage in preferences optional
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
2024-04-24 17:37:23 +02:00
Hans Goudey cf2afed071 Merge branch 'main' into brush-assets-project 2024-04-24 08:32:48 -04:00
Hans Goudey da0a06ec17 Merge branch 'main' into brush-assets-project 2024-04-23 13:50:15 -04:00
Hans Goudey 3f0259fad9 Merge branch 'main' into brush-assets-project 2024-04-23 13:36:52 -04:00
Hans Goudey 3ef687d20e Merge branch 'main' into brush-assets-project 2024-04-22 14:54:26 -04:00
Hans Goudey 7ed4691310 Cleanup: Unused variable 2024-04-19 16:08:03 -04:00
Hans Goudey c0632dc453 Merge branch 'main' into brush-assets-project 2024-04-19 15:38:46 -04:00
Hans Goudey ee06ffdeb3 Merge branch 'main' into brush-assets-project 2024-04-18 09:53:19 -04:00
Hans Goudey c01e9a6637 Brush Assets: Allow manually saving managed asset files
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
2024-04-18 14:27:49 +02:00
Hans Goudey b8bc1c56f7 Brush Assets: Operator to edit asset metadata
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
2024-04-17 17:28:48 +02:00
Hans Goudey c5f3dd13fa UI: Grammar: Add missing periods in asset save text 2024-04-17 10:59:36 -04:00
Hans Goudey e6587b1e15 Merge branch 'main' into brush-assets-project 2024-04-17 10:34:27 -04:00
Hans Goudey 30bd6b908f Merge branch 'main' into brush-assets-project 2024-04-11 15:32:46 -04:00
Hans Goudey ec3e4fc7d9 Change GPv3 to use new single tool for all brushes
Note this currently doesn't work because the brush assets use the
old GPv2 object mode.
2024-04-11 14:53:47 -04:00
Hans Goudey 6546c957fb Fix: GPv3 sculpt mode 2024-04-11 14:47:20 -04:00
Hans Goudey 759cc436df Fix GPv2 brush tools, consistency in toolbar file 2024-04-11 14:44:33 -04:00
Hans Goudey f245bc2b16 Fix: Make catalog path fetching in save as operator forgiving
The catalog wasn't found for the "All" catalog, for example.
Not sure why, but there's no reason to be so strict here.
2024-04-11 12:08:46 -04:00
Hans Goudey 5044b5a375 Fix: null pointer access in brush RNA function 2024-04-11 12:07:07 -04:00
Hans Goudey f164e6ceed Merge branch 'main' into brush-assets-project 2024-04-11 10:16:07 -04:00
Hans Goudey 2fdd7c6a56 Merge branch 'main' into brush-assets-project 2024-04-11 08:35:47 -04:00
Hans Goudey 62715f4230 Merge branch 'main' into brush-assets-project 2024-04-10 18:38:24 -04:00
Julian Eisel a4b5510600 Merge branch 'main' into brush-assets-project 2024-04-10 17:01:42 +02:00
Julian Eisel ad9d48493c Merge branch 'main' into brush-assets-project 2024-04-04 11:33:33 +02:00
Hans Goudey 9e2f88acfe Merge branch 'main' into brush-assets-project 2024-04-03 10:00:32 -04:00
Hans Goudey a800bdc473 Cleanup: Use references, StringRef for asset edit API functions 2024-03-29 14:23:34 -04:00
Hans Goudey d558bfcdad Cleanup: Avoid unnecessary context lookup 2024-03-29 13:12:06 -04:00
Hans Goudey 37a94b6e12 Cleanup: Remove redundant null check in save as operator
Null-ness of paint and brush is checked in the operator's poll function
2024-03-29 13:10:58 -04:00
Hans Goudey 6a545523e5 Fix: Poll function for brush asset delete operator
The operator requires the paint->brush_asset_reference.
That should always be set anyway, but better to be safe.
2024-03-29 13:04:58 -04:00
Hans Goudey c0653b1fff Brush Assets: Improve defaults for "Duplicate Asset" operator
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
2024-03-29 18:00:41 +01:00
Hans Goudey d6363a5ce5 Cleanup: Remove unnecessary namespace specification 2024-03-29 12:57:05 -04:00
Brecht Van Lommel ba71fa3909 Refactor: Move asset editing code into own file and refactor
* 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
2024-03-29 17:23:28 +01:00
Hans Goudey 7142ec1695 Brush Assets: Remove local brushes from default startup file
There was a catch I didn't expect with the outliner treestore, but
solving that this way seems fine anyway.

Pull Request: #120039
2024-03-29 17:01:16 +01:00
Hans Goudey 0656847bc9 Merge branch 'main' into brush-assets-project 2024-03-29 11:50:53 -04:00
Hans Goudey ca8ce120e9 Merge branch 'main' into brush-assets-project 2024-03-28 15:52:25 -04:00
Julian Eisel 065e59fc9f Merge branch 'main' into brush-assets-project 2024-03-28 16:38:00 +01:00
Hans Goudey aec2761e9c Merge branch 'main' into brush-assets-project 2024-03-28 09:38:24 -04:00
Hans Goudey 62f27e4612 Merge branch 'main' into brush-assets-project 2024-03-27 13:37:03 -04:00
Hans Goudey ac78d7bb78 Merge branch 'main' into brush-assets-project 2024-03-27 12:19:39 -04:00
Hans Goudey 15a886ddab Brush Assets: Add back brush selection shortcuts 2024-03-27 09:45:34 -04:00
Hans Goudey 2d45411108 Format 2024-03-27 09:43:51 -04:00
Hans Goudey 3e53bcfb99 Fix: Build error from mistake in versioning code merge 2024-03-27 09:36:13 -04:00
Hans Goudey 8d0da8093c Merge branch 'main' into brush-assets-project 2024-03-27 09:01:39 -04:00
Brecht Van Lommel 99b9650f87 Brush Assets: Make revert and delete operators affect dependencies
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
2024-03-25 14:34:44 +01:00
Brecht Van Lommel b716ea6849 Fix: Crash saving brush asset with empty catalog 2024-03-22 20:39:39 +01:00
Brecht Van Lommel 5ce0e4ca17 Brush: Add more detailed delete confirmation for brush asset delete
Until we have a trash mechanism.
2024-03-22 20:20:39 +01:00
Brecht Van Lommel 3a7ebb7dc7 Refactor: Remove some abstraction brush assets API, not helpful anymore
Pull Request: #119801
2024-03-22 20:08:49 +01:00
Brecht Van Lommel 626d6e76e0 Brushes: Remove unused paint tool slots
These were used for associating brushes with specific tools.
2024-03-22 18:38:06 +01:00
Brecht Van Lommel e2fce46588 Brush: Add functions to set default and essentials brushes, use where needed 2024-03-22 18:38:06 +01:00
Brecht Van Lommel c6541d36e6 Brush: Remove brush.reset operator, replaced by reverting to essentials asset 2024-03-22 15:06:19 +01:00
Brecht Van Lommel 05ab2baacc Refactor: Access paint brush through accessor function 2024-03-22 15:06:17 +01:00
Julian Eisel 3bb99d0a25 Bump subversion after previous merge 2024-03-20 18:37:25 +01:00
Julian Eisel cd5e061069 Merge branch 'main' into brush-assets-project 2024-03-20 18:36:56 +01:00
Julian Eisel 521583f8e5 Cleanup: Apply clang format 2024-03-13 17:47:25 +01:00
Julian Eisel 6c71d0e544 Merge branch 'main' into brush-assets-project 2024-03-13 17:42:57 +01:00
Julian Eisel b96d3d1f2e Update subversion after merge 2024-03-13 16:29:26 +01:00
Julian Eisel 5560757d95 Merge branch 'main' into brush-assets-project 2024-03-13 16:25:01 +01:00
Julian Eisel 0e32443c28 Merge branch 'main' into brush-assets-project 2024-03-07 17:19:23 +01:00
Julian Eisel 43f3142156 Fix build error after previous merge 2024-03-07 17:18:30 +01:00
Hans Goudey 38aa50e8f2 Merge branch 'main' into brush-assets-project 2024-03-06 12:47:19 -05:00
Brecht Van Lommel 068c2e0dda Fix: Duplicated code to install assets 2024-03-06 18:12:54 +01:00
Hans Goudey 151e5f4fe2 UI: Use "label tooltip" as a fallback for quick favorites menu text
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-experimental-coordinator Build done. Details
buildbot/vexp-code-experimental-lint Build done. Details
buildbot/vexp-code-experimental-darwin-x86_64 Build done. Details
buildbot/vexp-code-experimental-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
buildbot/vexp-code-experimental-linux-x86_64 Build done. Details
buildbot/vexp-code-experimental-windows-amd64 Build done. Details
Useful when the button has no display text but has been set up
to have a quickly accessible tooltip in its place.
2024-02-29 15:10:27 -05:00
Hans Goudey 605110fbf0 UI: Show plus icon to hint that save as operator can create new catalogs 2024-02-29 14:43:08 -05:00
Hans Goudey ade1056a29 Merge branch 'main' into brush-assets-project 2024-02-29 14:28:20 -05:00
Hans Goudey 5204c7dd43 Fix: Refresh asset libraries after updating asset
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.
2024-02-29 13:56:39 -05:00
Julian Eisel 019a551cb6 Merge branch 'main' into brush-assets-project 2024-02-29 17:55:19 +01:00
Hans Goudey 4ab5e38eca Fix: Use after free when selecting asset in some cases 2024-02-29 11:54:01 -05:00
Hans Goudey 9f8fd30f03 Fix build errors after merging main 2024-02-29 11:43:25 -05:00
Hans Goudey 919299023f Merge branch 'main' into brush-assets-project 2024-02-29 11:34:32 -05:00
Hans Goudey 490f572ada Merge branch 'main' into brush-assets-project 2024-02-29 10:36:14 -05:00
Julian Eisel 890d3b4045 Fix crash when showing toolbar tooltips
Crashed since 5cc18152c0.
2024-02-29 14:39:33 +01:00
Julian Eisel 554dcdd429 Take brush assets out of experimental
buildbot/vexp-code-experimental-lint Build done. Details
buildbot/vexp-code-experimental-darwin-arm64 Build done. Details
buildbot/vexp-code-experimental-darwin-x86_64 Build done. Details
buildbot/vexp-code-experimental-linux-x86_64 Build done. Details
buildbot/vexp-code-experimental-windows-amd64 Build done. Details
buildbot/vexp-code-experimental-coordinator Build done. Details
This makes brush assets be fully supported (non-experimental) asset types.
2024-02-29 12:46:10 +01:00
Julian Eisel e71556270d Merge branch 'main' into brush-assets-project 2024-02-29 12:27:12 +01:00
Hans Goudey e9588e5175 Fix: Correct assert in BKE_main_from_id for embedded IDs 2024-02-28 16:14:17 -05:00
Hans Goudey ea833527f6 Change toolbars in other "brush" modes
Affect all modes except for grease pencil and particle edit
2024-02-28 16:13:57 -05:00
Julian Eisel e7c03c1644 Fix: Restore bundling of testing/ assets that got lost in merge
buildbot/vexp-code-experimental-lint Build done. Details
buildbot/vexp-code-experimental-darwin-x86_64 Build done. Details
buildbot/vexp-code-experimental-linux-x86_64 Build done. Details
buildbot/vexp-code-experimental-windows-amd64 Build done. Details
buildbot/vexp-code-experimental-coordinator Build done. Details
buildbot/vexp-code-experimental-darwin-arm64 Build done. Details
2024-02-28 20:22:39 +01:00
Hans Goudey 038b29caa5 Fix: Support separate asset main in image open operator
Put the new image data-block in the asset main if the owner
of the pointer property is also in that Main.
2024-02-28 14:19:54 -05:00
Hans Goudey 0c75cdf626 Fix: Use after free on exit
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.
2024-02-28 14:19:54 -05:00
Julian Eisel 7677c036c0 Fix factory settings not using default catalogs
Apparently userdef versioning doesn't run for factory settings.
2024-02-28 19:53:59 +01:00
Hans Goudey c5b25d954b Fix: Brushes not activated properly in curves sculpt mode
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.
2024-02-28 12:58:47 -05:00
Hans Goudey f0bf7bc630 Merge branch 'main' into brush-assets-project 2024-02-28 11:23:27 -05:00
Brecht Van Lommel 32696f6a30 Refactor: Improve datablock selector main checking 2024-02-28 16:51:13 +01:00
Brecht Van Lommel 2ac6f8d455 RNA: Better validation of matching main database
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.
2024-02-28 16:51:13 +01:00
Brecht Van Lommel f29e118487 Refactor: Add BKE_main_from_id for main lookups
Instead of specifically naming this function after asset weak
references.
2024-02-28 16:50:27 +01:00
Brecht Van Lommel a78f52f5d0 Fix: Tag new datablocks in asset main, wrong tag value 2024-02-28 16:50:27 +01:00
Brecht Van Lommel fc40e662a5 Refactor: Remove now unnecessary brush library override support 2024-02-28 16:50:27 +01:00
Hans Goudey f32c5d6653 Merge branch 'main' into brush-assets-project 2024-02-28 09:46:29 -05:00
Hans Goudey 5cc18152c0 Remove "brush select" operator
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.
2024-02-27 14:52:03 +01:00
Hans Goudey 951eedb2ae Remove creating a new brush on Paint init when none is found
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.
2024-02-27 14:52:03 +01:00
Hans Goudey 88602a74da Remove unnecessary tool -> brush connection
These were adding brushes and finding brushes in the active (non-asset)
main. This sort of thing should be handled differently now anyway
2024-02-27 14:52:02 +01:00
Hans Goudey a4e5d54a76 Remove BRUSH_OT_add operator
This doesn't seem to be visible anywhere in the UI. New brushes
are more easily created by duplicating existing brushes anyway.
2024-02-27 14:52:02 +01:00
Brecht Van Lommel b030911aa9 Brush Assets: Store assets outside Main
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
2024-02-27 14:51:53 +01:00
Hans Goudey b83ac545ec Merge branch 'main' into brush-assets-project 2024-02-22 15:54:28 -05:00
Hans Goudey 1657c3643d Merge branch 'main' into brush-assets-project 2024-02-22 13:03:06 -05:00
Julian Eisel c86d6bf244 Merge branch 'main' into brush-assets-project 2024-02-22 17:34:43 +01:00
Hans Goudey 50e4d3820f Merge branch 'main' into brush-assets-project 2024-02-21 17:09:40 -05:00
Hans Goudey 914ad994f2 Fix: Handle null strings in asset weak reference comparison
Mistake in earlier cleanup
2024-02-21 11:07:59 -05:00
Hans Goudey 5e15c9caa7 Merge branch 'main' into brush-assets-project 2024-02-21 10:59:15 -05:00
Hans Goudey 0acf98a0e0 Merge branch 'main' into brush-assets-project 2024-02-21 10:26:41 -05:00
Hans Goudey 84997955b4 Change AssetWeakReference equality functions to free functions
Just a more typical pattern. Also use STREQ and make all three
comparisons look the same.
2024-02-21 10:25:19 -05:00
Hans Goudey 525e85bd30 Cleanup: Use asset weak reference copy constructor instead of function 2024-02-21 10:08:45 -05:00
Hans Goudey 22a1c00eb3 Merge branch 'main' into brush-assets-project 2024-02-21 09:51:54 -05:00
Hans Goudey 633e0a6b3a Brush Assets: Add catalog option to asset pushing operator
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
2024-02-21 14:03:30 +01:00
Julian Eisel 964f12dc54 Merge remote-tracking branch 'origin/main' into brush-assets-project 2024-02-21 13:03:54 +01:00
Julian Eisel 74fcbf4523 Merge remote-tracking branch 'origin/main' into brush-assets-project 2024-02-21 12:23:05 +01:00
Hans Goudey c0eacdb574 Fix more errors after merge 2024-02-20 15:35:01 -05:00
Hans Goudey d616f2a3ea Fix build errors after merge 2024-02-20 15:07:27 -05:00
Hans Goudey d300038721 Merge branch 'main' into brush-assets-project 2024-02-20 14:34:43 -05:00
Julian Eisel 2c4f83d901 Enable sculpt brush catalogs by default
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.
2024-02-16 18:39:56 +01:00
Hans Goudey 41db6c889d Merge branch 'main' into brush-assets-project 2024-02-16 11:05:08 -05:00
Julian Eisel 50c3c18d4e Merge branch 'main' into brush-assets-project 2024-02-16 16:57:00 +01:00
Hans Goudey 39eb3fe070 Merge branch 'main' into brush-assets-project 2024-02-15 16:24:12 -05:00
Brecht Van Lommel 42f1fce567 Brush Assets: Remove Reset to Defaults from menu, it works too poorly 2024-02-15 21:04:20 +01:00
Brecht Van Lommel a49e8d0509 Fix: Essentials brushses show delete asset when not supported 2024-02-15 21:04:20 +01:00
Brecht Van Lommel 9a7e824632 Asset Shelf: slight increase default brush size from 40 to 48
To make them slightly larger than toolbar buttons still.
2024-02-15 20:53:36 +01:00
Julian Eisel dc687427fc Cleanup: clarify lambda purpose in comment 2024-02-15 18:05:00 +01:00
Julian Eisel b5d44d8f5d Make asset shelf visible by default in sculpt/paint modes
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.
2024-02-15 18:00:54 +01:00
Hans Goudey 85ebff0e0a Merge branch 'main' into brush-assets-project 2024-02-15 11:37:31 -05:00
Hans Goudey ea56950b47 Merge branch 'main' into brush-assets-project 2024-02-14 17:23:49 -05:00
Hans Goudey 126636854b Brush Assets: Versioning to activate new brush tool and asset
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
2024-02-14 20:25:19 +01:00
Hans Goudey 71f2c80a77 Cleanup: Rename variable
Soon there will be another asset library variable with a different type,
this is to distinguish the two
2024-02-14 13:34:46 -05:00
Hans Goudey f4a5bcabbd Cleanup: Extract function to convert user library to library reference 2024-02-14 13:34:17 -05:00
Hans Goudey a2768e3066 Brush Assets: Add library choice to "Save As" operator
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
2024-02-14 17:36:48 +01:00
Hans Goudey d35df02001 Fix build errors after merging main 2024-02-14 11:33:55 -05:00
Hans Goudey 4b0ed42eb0 Merge branch 'main' into brush-assets-project 2024-02-14 10:59:59 -05:00
Hans Goudey da344d30cd Merge branch 'main' into brush-assets-project
buildbot/vexp-code-experimental-darwin-x86_64 Build done. Details
buildbot/vexp-code-experimental-windows-amd64 Build done. Details
buildbot/vexp-code-experimental-darwin-arm64 Build done. Details
buildbot/vexp-code-experimental-lint Build done. Details
buildbot/vexp-code-experimental-linux-x86_64 Build done. Details
buildbot/vexp-code-experimental-coordinator Build done. Details
2024-02-12 14:57:22 -05:00
Hans Goudey 55c0af72b4 Merge branch 'main' into brush-assets-project 2024-02-09 14:01:58 -05:00
Hans Goudey 25f6ad437c UI: Customize confirm text in save as brush asset popup 2024-02-08 18:29:33 -05:00
Hans Goudey 58d2699f63 UI: Use proper title case in operator name 2024-02-08 18:26:03 -05:00
Hans Goudey 868af4a5c6 Brush Assets: Focus name in Save as Brush Asset operator popup 2024-02-08 18:25:43 -05:00
Hans Goudey bb1ba7c8e6 Fix build error 2024-02-08 18:22:09 -05:00
Hans Goudey 24d4ee1ab6 Cleanup: Reorder static function
Just to make a diff in a future PR cleaner
2024-02-08 18:21:09 -05:00
Hans Goudey 9c1b837578 Fix: Refresh proper library after deleting asset
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.
2024-02-08 18:20:11 -05:00
Hans Goudey 2dec98b69f Cleanup: Rename more variables that aren't brush specific
The idea is to make this code more general in the future
so it doesn't just deal with brush assets
2024-02-08 18:11:32 -05:00
Hans Goudey 4bedf2f2a0 Cleanup: Rename functions that aren't brush specific 2024-02-08 18:06:47 -05:00
Hans Goudey 4812d45c21 Brush Assets: Add "Default" option for asset library for new brushes
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
2024-02-09 00:02:30 +01:00
Hans Goudey ec898027a8 Brush Assets: Add asset operations to shelf context menu
Pull Request: #118017
2024-02-08 23:47:42 +01:00
Hans Goudey 32c472c0af Merge branch 'main' into brush-assets-project 2024-02-08 15:03:56 -05:00
Hans Goudey 6d9f313ba1 Fix compile warnings in asset shelf settings code 2024-02-08 12:47:08 -05:00
Hans Goudey 9817b56c9b Cleanup: Move new code to proper namespace
Also use StringRef and pass the string refs by value
2024-02-08 12:38:52 -05:00
Hans Goudey 122a09e939 Merge branch 'main' into brush-assets-project 2024-02-08 12:28:15 -05:00
Julian Eisel 2d7c804ebc Store enabled catalogs per asset shelf (= more or less per mode) in preferences 2024-02-07 20:39:50 +01:00
Hans Goudey f6898f9bcb Fix brush tool dissapears with no brush active
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
2024-02-07 13:18:08 -05:00
Hans Goudey 44b80df241 Brush Assets: Support adding shortcut to asset shelf items
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
2024-02-07 19:02:38 +01:00
Hans Goudey 6c74295f54 Fix build error 2024-02-07 12:48:30 -05:00
Hans Goudey 13c7bb4e55 Merge branch 'main' into brush-assets-project 2024-02-07 12:35:40 -05:00
Julian Eisel f8a7a61d1f Fix recently added asset shelf preview-size option not optional 2024-02-07 16:32:47 +01:00
Julian Eisel 4e17d78a9b Default preview size of 40 for brush asset shelves 2024-02-07 10:57:34 +01:00
Julian Eisel 7ac21ae357 Merge branch 'main' into brush-assets-project 2024-02-05 18:26:31 +01:00
Hans Goudey 33f3d1912b Merge branch 'main' into brush-assets-project 2024-02-05 11:43:23 -05:00
Hans Goudey c98b855ed6 Merge branch 'main' into brush-assets-project 2024-02-05 11:21:12 -05:00
Julian Eisel 128d9e142e Bind active brush two asset shelf active item
Adds a new `bpy.types.AssetShelf.get_active_asset()` method to return
an active asset reference.
2024-02-05 16:05:46 +01:00
Julian Eisel b0194294c1 Merge branch 'main' into brush-assets-project 2024-02-05 10:45:34 +01:00
Hans Goudey 95bf12856e Merge branch 'main' into brush-assets-project 2024-02-02 14:32:43 -05:00
Hans Goudey d4d58418be Merge branch 'main' into brush-assets-project 2024-02-02 11:00:46 -05:00
Hans Goudey c310969f67 Merge branch 'main' into brush-assets-project 2024-02-01 13:46:24 -05:00
Hans Goudey 7f85165265 Merge branch 'main' into brush-assets-project 2024-02-01 10:44:19 -05:00
Julian Eisel 91bc69f069 Sort assets in asset shelf by catalogs (and withing catalogs by name) 2024-02-01 15:12:29 +01:00
Hans Goudey bb61ab2f50 Merge branch 'main' into brush-assets-project 2024-01-31 21:18:28 -05:00
Hans Goudey c57d217563 Merge branch 'main' into brush-assets-project 2024-01-31 21:14:47 -05:00
Hans Goudey b3cea96228 Cleanup: Use StringRef arguments for some UI button functions
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.
2024-01-31 20:32:38 -05:00
Hans Goudey 684d837c30 Cleanup: Move remaining spreadsheet editor code to C++ namespace 2024-01-31 20:32:38 -05:00
Hans Goudey 2e9763c25e Fix: Memory leak in gizmo tooltip function 2024-01-31 20:32:38 -05:00
Sean Kim 458716b675 Cleanup: Perform cleanup on sculpt_automasking.cc
* 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
2024-01-31 20:32:38 -05:00
Brecht Van Lommel 53b8fed093 Fix: missing properties editor redraws on brush duplicate 2024-01-31 21:36:14 +01:00
Brecht Van Lommel 6b4e9c8217 Brush Assets: move brush modes to Advanced, hide custom icon for assets 2024-01-31 21:23:03 +01:00
Brecht Van Lommel dc1a45f996 Brush Assets: move brush tool to Brush Settings > Advanced 2024-01-31 21:23:03 +01:00
Brecht Van Lommel 287500e993 Cleanup: make format 2024-01-31 21:23:03 +01:00
Hans Goudey 2120714afe Cleanup: Use proper enum type 2024-01-31 14:35:53 -05:00
Hans Goudey 8e2f9df9d6 Cleanup: Use continue to reduce indentation 2024-01-31 14:33:44 -05:00
Hans Goudey e9a6c790fd Merge branch 'main' into brush-assets-project 2024-01-31 14:32:48 -05:00
Hans Goudey 2f0c95b16d Change name of single brush tool to "Brush" 2024-01-29 17:46:55 -05:00
Hans Goudey df8261aa51 Merge branch 'main' into brush-assets-project 2024-01-29 17:45:48 -05:00
Brecht Van Lommel e26ebf6324 Fix: missing catalogs, replace bundled assets entirely with testing/
buildbot/vexp-code-experimental-lint Build done. Details
buildbot/vexp-code-experimental-darwin-arm64 Build done. Details
buildbot/vexp-code-experimental-darwin-x86_64 Build done. Details
buildbot/vexp-code-experimental-linux-x86_64 Build done. Details
buildbot/vexp-code-experimental-windows-amd64 Build done. Details
buildbot/vexp-code-experimental-coordinator Build done. Details
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.
2024-01-29 13:31:33 +01:00
Brecht Van Lommel 64db6bd4be Fix: crash when selected asset brush file goes missing 2024-01-29 12:42:28 +01:00
Brecht Van Lommel 63484e0e96 Brush Assets: switch to dedicated testing/ folder for bundled brushes 2024-01-29 12:32:56 +01:00
Bastien Montagne 8e6dbddc5a Brush Assets: Save As, Delete, Revert and Update operators
buildbot/vexp-code-experimental-lint Build done. Details
buildbot/vexp-code-experimental-darwin-arm64 Build done. Details
buildbot/vexp-code-experimental-darwin-x86_64 Build done. Details
buildbot/vexp-code-experimental-linux-x86_64 Build done. Details
buildbot/vexp-code-experimental-windows-amd64 Build done. Details
buildbot/vexp-code-experimental-coordinator Build done. Details
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
2024-01-28 00:01:05 +01:00
Brecht Van Lommel be87bf8727 Merge branch 'main' into brush-assets-project 2024-01-27 23:31:34 +01:00
Hans Goudey a0ebef3a93 Cleanup: Remove unused property 2024-01-26 19:18:27 -05:00
Hans Goudey 0ad37cc012 Merge branch 'main' into brush-assets-project 2024-01-26 19:06:51 -05:00
Hans Goudey e1a32ba714 Fix build errors 2024-01-26 19:00:34 -05:00
Hans Goudey e1a2f8a23f Merge branch 'main' into brush-assets-project 2024-01-26 18:50:52 -05:00
Brecht Van Lommel 39e40f6371 Brush Assets: make asset select operator work with all paint modes 2024-01-26 21:20:49 +01:00
Hans Goudey 65fce64213 Brush Assets: Switch to a single "Brush" active tool
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
2024-01-26 21:08:13 +01:00
Hans Goudey a45de2fd4f Merge branch 'main' into brush-assets-project 2024-01-26 14:39:41 -05:00
Hans Goudey 82193d995e Merge branch 'main' into brush-assets-project 2024-01-26 13:48:11 -05:00
Hans Goudey 036d47af63 Merge branch 'main' into brush-assets-project 2024-01-26 13:19:49 -05:00
Hans Goudey 4e781aeda3 Merge branch 'main' into brush-assets-project 2024-01-25 15:45:30 -05:00
Bastien Montagne dcc1894b89 Report/confirm overwrite of 'asset library' blendfiles.
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
2024-01-25 17:10:29 +01:00
Bastien Montagne b3a0fc4755 Merge branch 'main' into brush-assets-project 2024-01-25 17:08:28 +01:00
Hans Goudey 1db2f2380a Merge branch 'main' into brush-assets-project 2024-01-25 10:13:12 -05:00
Bastien Montagne 2ae5c3be2a Merge branch 'main' into brush-assets-project 2024-01-25 10:34:47 +01:00
Hans Goudey b135801309 Merge branch 'main' into brush-assets-project 2024-01-24 14:15:15 -05:00
Hans Goudey 6f84c5da8f Cleanup: Remove redundant comment
This fact is mentioned in the docs of #BKE_paint_brush_asset_set,
no need to duplicate the information.
2024-01-24 14:02:25 -05:00
Hans Goudey d44d3fe35b Merge branch 'main' into brush-assets-project 2024-01-24 13:32:51 -05:00
Hans Goudey b36b035791 Merge branch 'main' into brush-assets-project 2024-01-24 13:03:09 -05:00
Julian Eisel 8be8f10305 Add asset shelves for all paint modes 2024-01-24 18:18:28 +01:00
Bastien Montagne 94b18b9e67 Merge branch 'main' into brush-assets-project
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
2024-01-24 11:27:08 +01:00
Bastien Montagne 3bbcfeebf0 Fix merge mistakes. 2024-01-23 15:50:39 +01:00
Bastien Montagne bc0631f23a Merge branch 'main' into brush-assets-project 2024-01-23 15:45:55 +01:00
Bastien Montagne ea5b3310f9 Merge branch 'main' into brush-assets-project 2024-01-19 12:22:04 +01:00
Hans Goudey 33cc4af2a2 Cleanup: Use slightly simpler constexpr array
The need to repeat std::pair isn't great, but at least this won't
result in a heap allocation.
2024-01-18 08:12:21 -05:00
Hans Goudey 01436255b5 Fix build error 2024-01-17 14:07:44 -05:00
Julian Eisel 5e813f1563 Only show curve sculpt brushes in curve sculpt mode
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
2024-01-17 19:52:10 +01:00
Julian Eisel 335876b4cf Fix error in IDProperty serializer for bools 2024-01-17 19:51:55 +01:00
Julian Eisel d9f2fce614 Write compatible modes to brush asset metadata
Had to add support for JSon (de)serializing of boolean properties.
2024-01-17 19:51:39 +01:00
Julian Eisel c65b0ad144 Bundle WIP brush assets as essentials
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.
2024-01-17 19:51:17 +01:00
Julian Eisel 7aa661f795 Merge branch 'main' into brush-assets-project 2024-01-17 19:37:12 +01:00
Brecht Van Lommel 9a553f3b71 Fix: crash when selecting a brush asset from the wrong mode
Ideally these should not appear at all in the asset shelf, but it's not
obvious that will 100% ensure the right mode.

Also fix a missing redraw of the properties editor when switching
brushes.

Pull Request: #117233
2024-01-17 17:30:52 +01:00
Brecht Van Lommel c5243b0e0b Merge branch 'main' into brush-assets-project 2024-01-17 17:04:34 +01:00
Hans Goudey 23f0914744 Cleanup: Remove unused asset handle function
These days the function on AssetRepresentation can probably be used instead
2024-01-17 10:36:39 -05:00
Hans Goudey 448c30cc45 Cleanup: Capitalization in operator UI description 2024-01-17 10:36:39 -05:00
Hans Goudey 5fc94a3872 Cleanup: Avoid single/two letter variable names 2024-01-17 10:36:39 -05:00
Hans Goudey 173661713d Cleanup: Functional style cast for enum 2024-01-17 10:36:39 -05:00
Hans Goudey eedd55e770 Cleanup: remove unnecessary struct keyword 2024-01-17 10:36:39 -05:00
Hans Goudey 99a38e9c18 Cleanup: Comment style, clang format 2024-01-17 10:36:39 -05:00
Hans Goudey 058ec36130 Cleanup: Remove unused weak asset reference in Library
A library probably shouldn't reference a single specific asset anyway.
2024-01-17 10:36:39 -05:00
Jacques Lucke 52493e26a0 Cleanup: make format 2024-01-17 10:36:39 -05:00
Jacques Lucke 16875c82bb Geometry Nodes: reorganize panels in modifier
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
2024-01-17 10:36:39 -05:00
Jacques Lucke e296f9fcaa Geometry Nodes: support synchronous baking
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.
2024-01-17 10:36:39 -05:00
Omar Emara 6454d989fd Compositor: Port redesigned Defocus node to CPU
This patch ports the redesigned GPU Defocus node to the CPU.

Pull Request: #117174
2024-01-17 10:36:39 -05:00
Jacques Lucke d8fe96d6ce Fix: crash when adding repeat zone from search
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.
2024-01-17 10:36:39 -05:00
Pratik Borhade 741c13d1e9 Cleanup: Curves: Remove redundant resizing in extrude operator
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
2024-01-17 10:36:39 -05:00
Pratik Borhade f5685e1570 Fix #117191: Crash using the Extrude tool and Snap Base
`GIZMO_GT_button_2d` has no modal/custom_modal callback function
defined hence the crash due to calling `modal_fn()`

Pull Request: #117194
2024-01-17 10:36:39 -05:00
Pratik Borhade a18b0405f0 Curves: Debug crash after switching to sculpt mode
`bounds_min_max` returns an optional and it can be `nullopt` when
curve points are 0.

Pull Request: #117163
2024-01-17 10:36:39 -05:00
Jacques Lucke a2915e83e5 Geometry Nodes: expose NodesModifierBake.node property in Python API
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.
2024-01-17 10:36:39 -05:00
Jacques Lucke c98323fc14 Geometry Nodes: expose bake id in Python API
This is necessary to be able to invoke baking of individual bake nodes
or simulation zones with Python.
2024-01-17 10:36:39 -05:00
Aras Pranckevicius 50ec05a245 VSE: Speedup Subsampled 3x3 image filter
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
2024-01-17 10:36:39 -05:00
Sergey Sharybin 2592fa1dc7 Render: Set non-color colorspace for ImBuf of data passes
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
2024-01-17 10:36:39 -05:00
Sergey Sharybin b1dcb37f76 Fix incorrect number of planes for ImBuf used for render passes
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.
2024-01-17 10:36:39 -05:00
Campbell Barton 3ce407e757 Fix font sub-pixel AA impacting character spacing when AA is disabled 2024-01-17 10:36:39 -05:00
Campbell Barton 5b4391c950 PyAPI: improve warnings when addons from extensions repos fail to load 2024-01-17 10:36:39 -05:00
Campbell Barton 79804353ad Fix #117188: Context.temp_override() failed with full-screen areas
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.
2024-01-17 10:36:39 -05:00
Hans Goudey 09871cec4e Fix: Tooltip contains bogus text after recent button string cleanup
The code still needs to differentiate a null string from an empty
string in one cast I missed earlier.
2024-01-17 10:36:39 -05:00
Hans Goudey ef18df9db5 Fix: Memory leaks after recent button string cleanup 2024-01-17 10:36:39 -05:00
Campbell Barton c3334fa10b Fix #107805: Render border without an active region crashes 2024-01-17 10:36:39 -05:00
Harley Acheson df57dc1882 UI: Cleanup Dialog to Manage Orphaned Data
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
2024-01-17 10:36:39 -05:00
M. Grady Saunders 03155f1316 Outliner: Double-click on item icon to select contents/hierarchy
Allow double-clicking on Outliner items to select all child items.

Pull Request: #110151
2024-01-17 10:36:39 -05:00
Campbell Barton 9ff2dec171 Cleanup: remove outdated comment
String suggestion now allow the operator list to be searched.
2024-01-17 10:36:39 -05:00
Hans Goudey 7c88cce9a2 Tests: Enable new triangulate geometry node test files 2024-01-17 10:36:39 -05:00
Laurynas Duburas 59f3f88e46 Fix: Curves extrude with all points selected
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
2024-01-17 10:36:39 -05:00
Hans Goudey 96041c9516 Cleanup: Use std::string to store UI button string
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
2024-01-17 10:36:39 -05:00
Aras Pranckevicius 22087e908a Cleanup: simplify code in IMB_transform
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
2024-01-17 10:36:39 -05:00
Hans Goudey b341e6ea7d Cleanup: Use Map instead of GHash for memfile writing
The goal is to simplify future work on #106903.

Pull Request: #117141
2024-01-17 10:36:39 -05:00
Hans Goudey 602d593b30 Cleanup: Use LISTBASE_FOREACH file in memfile merge 2024-01-17 10:36:39 -05:00
Hans Goudey 85c9bd5268 Cleanup: Remove unnecessary extern symbols in undofile header 2024-01-17 10:36:39 -05:00
Hans Goudey 93a9dde143 Cleanup: Make format 2024-01-17 10:36:39 -05:00
Falk David ceeb7d62a8 Cleanup: GPv3: Modifier filter UI 2024-01-17 10:36:39 -05:00
Jacques Lucke a622a8573f Fix #117168: crash when using layout panel in popover
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.
2024-01-17 10:36:39 -05:00
Falk David e010e99579 GPv3: Change display name of modifier to "Opacity" 2024-01-17 10:36:39 -05:00
Falk David f49b856bb0 Fix: GPv3: Opacity modifier compilation error
The parameters for `threading::parallel_for_each` were not correct.
2024-01-17 10:36:39 -05:00
Hans Goudey c7d228c1de Cleanup: Make format 2024-01-17 10:36:39 -05:00
Lukas Tönne 6c4a058e8b GPv3: Opacity modifier
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
2024-01-17 10:36:39 -05:00
Eugene Kuznetsov dd67d941e5 Linux: Use huge pages in jemalloc to speed up allocations
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
2024-01-17 10:36:39 -05:00
Jacques Lucke 619d83d5ea Fix: crash trying to store an attribute on unsupported grease pencil domain
This crash happened when trying to store an attribute on the edge domain
on a grease pencil geometry.
2024-01-17 10:36:39 -05:00
Jacques Lucke 35c362db89 Fix: incorrect Exists output in Named Attribute node for grease pencil
Grease pencil needs some special handling because it stores layer attributes
independently of point/curve attributes.
2024-01-17 10:36:39 -05:00
Pedro A. 35d4c509e7 Fix: error when custom socket has no 'draw' function
This `draw` method is optional. The same check is also done elsewhere.

Pull Request: #117061
2024-01-17 10:36:39 -05:00
Lukas Tönne 645b0e75c2 Fix #116477: Node group sockets with subtypes have broken idnames
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
2024-01-17 10:36:39 -05:00
Hans Goudey f0e840375e Fix #117158: Multires sculpting crash
The change to use `float3` in `frontface` didn't account for the
fact that the values we sometimes null.
2024-01-17 10:36:39 -05:00
Philipp Oeser af93b2877a Report when `register_class` overrides classes with the same bl_idname
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
2024-01-17 10:36:39 -05:00
Brecht Van Lommel c23d4869f5 Fix: broken make update on new macOS build
Properly check for the existence of the Python binary in precompiled libs.
2024-01-17 10:36:39 -05:00
Brecht Van Lommel da6aae413e Build: bump sse2neon version to latest hash
This includes an additional fix for precision of some operations that affect
Blender tests.
2024-01-17 10:36:38 -05:00
Lukas Tönne 1c0d7ccc65 Fix #115727: Draw panel buttons in the node editor side bar
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
2024-01-17 10:36:38 -05:00
Aras Pranckevicius 5b952c0085 ImBuf: no need to use double precision inside IMB_transform
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
2024-01-17 10:36:38 -05:00
Jeroen Bakker 1f94c11d53 EEVEE: Fix Lights On High-res Monitors
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
2024-01-17 10:36:38 -05:00
Julian Eisel 2393517e33 Merge branch 'main' into brush-assets-project 2024-01-16 11:38:59 +01:00
Bastien Montagne ffd5014347 Merge branch 'main' into brush-assets-project 2024-01-09 17:26:00 +01:00
Bastien Montagne fc91ee9092 Merge branch 'tmp-brush-assets' into brush-assets-project 2023-11-24 15:32:10 +01:00
Bastien Montagne eb505ad1c7 Brush Assets: Add initial support for the new 'brush asset' usage.
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.
2023-11-24 15:31:43 +01:00
Bastien Montagne dcc7b560ca Merge branch 'tmp-brush-assets' into brush-assets-project 2023-11-24 10:41:38 +01:00
Bastien Montagne b3964b1b0d Brush Assets: Add initial support for the new 'brush asset' usage.
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.
2023-11-24 10:41:13 +01:00
Bastien Montagne 6977314c29 Merge branch 'tmp-brush-assets' into brush-assets-project 2023-11-23 11:38:45 +01:00
Bastien Montagne fe9e7eab13 Brush Assets: Add initial support for the new 'brush asset' usage.
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.
2023-11-23 11:07:22 +01:00
Bastien Montagne 1e576c827f Merge branch 'tmp-brush-assets' into brush-assets-project
Conflicts:
	scripts/startup/bl_ui/space_view3d.py
	source/blender/blenloader/intern/versioning_defaults.cc
	source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
2023-11-09 12:14:27 +01:00
Bastien Montagne e3ef163816 Fixes from rebase on main.
Note that current code is crashing on initial show of brush asset
browser in curve sculpt mode. Need Julian to help on this.
2023-11-09 12:06:40 +01:00
Bastien Montagne 477bb662d7 Brush Assets: Add initial support for the new 'brush asset' usage.
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.
2023-11-09 12:06:40 +01:00
Bastien Montagne 0c95e0e627 Brush Assets: Add initial support for the new 'brush asset' usage.
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.
2023-09-08 14:40:47 +02:00