Commit Graph

150077 Commits

Author SHA1 Message Date
Julian Eisel
830342bf8e Fix #134264: Cannot undo asset catalog changes to before initial save
When saving a file, move the catalog service from the runtime asset library into the new on-disk
asset library. This makes all catalog data like the undo history and deleted catalogs be preserved.
The fact that a new asset library type gets allocated is an implementation detail that shouldn't
affect behavior.

Once the service is moved, an undo push is added (so this state can be restored to), and if the new
.blend file location can be associated with a catalog definition file, its catalogs are merged in.

Includes unit tests.

Pull Request: https://projects.blender.org/blender/blender/pulls/135589
2025-03-11 12:49:02 +01:00
Clément Foucault
f7e4fbc636 DRW: Add different mutex for GPUShader critical section
This removes the use of `system_gpu_context_mutex`
which was making render command submission threadsafe.

The only issue is the concurent usage of GPUShader objects.
To fix this, we only guard the submission section which
are the only parts that uses the GPUShaders.

Removing this critical section all together requires some changes
in the GPUShader. See #135406

Rel #134690

Pull Request: https://projects.blender.org/blender/blender/pulls/135595
2025-03-11 12:06:11 +01:00
Falk David
c02449ebea Merge branch 'blender-v4.4-release' 2025-03-11 11:50:23 +01:00
Aleš Jelovčan
dbe7078d07 Fix #135776: Grease Pencil: Average Color tool can create uninitialized values
The average color was not initialized leading to non-sensible values.
Now we initialize it to zeros.

Pull Request: https://projects.blender.org/blender/blender/pulls/135779
2025-03-11 11:49:49 +01:00
Falk David
643d844d01 Merge branch 'blender-v4.4-release' 2025-03-11 11:33:39 +01:00
Pratik Borhade
b613be2713 Fix #135767: Grease Pencil: Separate by layer clears material user count
Material user count in duplicated ob.data is not updated. Separate layer
operation later iterates over all the material slots thenremoves unused
slots from respective objects. Since id.us=1 for individual material, if
material is used by one object but not the other, count is decremented
to zero. If we use `USER_DUP_GPENCIL` then user count is properly
handled in `grease_pencil_foreach_id/id_copy_libmanagement_cb`.

Pull Request: https://projects.blender.org/blender/blender/pulls/135769
2025-03-11 11:33:07 +01:00
Pratik Borhade
bb36490958 Fix #135737: Grease Pencil: Cannot separate layer selected in animation editor
When a layer channel is clicked to select inside dopesheet editor, this
sets the flag `GP_LAYER_TREE_NODE_SELECT` (i.e. is_selected() to true),
It prevents separate layer operation to create a new object for this
layer.

Pull Request: https://projects.blender.org/blender/blender/pulls/135765
2025-03-11 11:21:24 +01:00
Jeroen Bakker
32999913ef SubDiv: Enable GPU subdivision on Metal
This PR enabled GPU based subdivision on Metal.
Most work is done in #135296.

- Metal max storage bindings for compute shaders were never set.

Some performance figures: Suzanne 6 subdivision levels

| Machine         | CPU Subdivision | GPU Subdivision |
| --------------- | --------------- | --------------- |
| M1 Studio Ultra | 7fps            | 12 fps          |
| M2 Air          | 3fps            | 11 fps          |

Pull Request: https://projects.blender.org/blender/blender/pulls/135628
2025-03-11 11:12:01 +01:00
Jeroen Bakker
c7f7c03f4c Subdiv: Enable GPU subdivision on Vulkan
This PR enabled GPU subdivision on Vulkan backend. Measured
performance is slower compared to CPU on my system. But it is
expected that other bottlenecks should be solved in order to
fully benefit from this feature.

We enable it so we keep track of the performance bottlenecks.

Pull Request: https://projects.blender.org/blender/blender/pulls/135777
2025-03-11 11:08:59 +01:00
Sybren A. Stüvel
2cdd75def0 Merge remote-tracking branch 'origin/blender-v4.4-release' 2025-03-11 10:38:55 +01:00
Sybren A. Stüvel
7aeef87250 Fix: Shape Key animation not showing in Dope Sheet
Update the animation filtering code so that the shape key properties
`.eval_time` and `.interpolation` are properly shown in the Shape Key mode
of the Dope Sheet editor.

Pull Request: https://projects.blender.org/blender/blender/pulls/135748
2025-03-11 10:38:28 +01:00
Sybren A. Stüvel
5740aded5e Fix: "Remove Empty Animation Data"
Adjust the "Remove Empty Animation Data" operator so that it properly
handles slotted Actions. It was still investigating the legacy F-Curve
list, and thus always considered Actions as "empty".

Pull Request: https://projects.blender.org/blender/blender/pulls/135740
2025-03-11 10:38:06 +01:00
Sybren A. Stüvel
064421a02d Anim: expose Action Slot users to RNA
Add a new RNA function `ActionSlot.users()` that returns the
data-blocks that are animated by this slot.

This covers direct assignment of the action & slot, but also use in
the NLA and in Action constraints.

```python
>>> D.actions['SuzanneAction'].slots['OBSuzanne'].users()
[bpy.data.objects['Suzanne']]
```

This was implemented as a function, and not a collection property,
because Blender's bookkeeping of the slot users can be marked 'dirty'.
In that case the slot user list needs to be rebuilt, which happens for
all Actions and all their slots simultaneously. This was considered
too broad a data-changing action to 'hide' inside a getter of a
property. Also it needs a `bmain` pointer, which is not available in
getters, but is available in functions.

Pull Request: https://projects.blender.org/blender/blender/pulls/135734
2025-03-11 10:36:59 +01:00
Pratik Borhade
46086bc1c1 Fix #135436: Attribute "name collisions" show on every UIList
draw_attribute_warnings() called in every attribute panel code.
Following function iterates through entire attribute list
mesh.attributes along with vgroup list to identify the colliding name.
This results in printing collision names in irrelavant panels. Now fixed
by passing relevant attributes to compare in `draw_attribute_warnings`.
First find colliding names, add them to the list if they exists in current attribute list
passed to the function

Pull Request: https://projects.blender.org/blender/blender/pulls/135495
2025-03-11 10:28:34 +01:00
Jeroen Bakker
cdc37b2235 GPU: Add support for GPU_vertbuf_update_sub
`GPU_vertbuf_update_sub` is used by GPU based subdivision to integrate
quads, triangles and edges. This is just an implementation to make it
work as we are planning bigger changes to improve performance of
uploading data to the GPU.

Pull Request: https://projects.blender.org/blender/blender/pulls/135774
2025-03-11 10:14:00 +01:00
Jeroen Bakker
96c9f480b3 Cleanup: Subdiv: Remove 2nd derivatives
2nd derivatives aren't used within Blender but all
logic branches end up with checking for it. This PR
removes the 2nd derivatives from the code so we
can skip this test.

Pull Request: https://projects.blender.org/blender/blender/pulls/135745
2025-03-11 09:26:35 +01:00
Pratik Borhade
1f3de4e0ba Cleanup: Fix comment
Enum used for separating individual layer, not just active layer

Pull Request: https://projects.blender.org/blender/blender/pulls/135771
2025-03-11 07:49:33 +01:00
Jesse Yurkovich
05c7fb1eae Merge branch 'blender-v4.4-release' 2025-03-10 22:25:42 -07:00
Campbell Barton
729b317061 Merge branch 'blender-v4.4-release' 2025-03-11 16:22:55 +11:00
Jesse Yurkovich
a5b80c06bc Fix #134764: Increase range of allowed node locations
The bug was caused because the new node's location was being clamped to
the [-100000, 100000] range. Expand this by 10x further.

Pull Request: https://projects.blender.org/blender/blender/pulls/134887
2025-03-11 06:22:34 +01:00
Campbell Barton
90e47e6bc9 Fix error saving a new imbuf from the Python API
Correct the argument for the number of planes.
2025-03-11 16:18:36 +11:00
YimingWu
df346a1b6b Fix #135229: Soft light blending mode for 8 bit colors is wrong
It appears that 8 bit `blend_color_softlight_byte` call used a wrong
blending routing (overlay), while `blend_color_softlight_float` is
correct. Seems that this was never caught. The correct fomula should be
`dst = 2ab + a^2 * (1 - 2b)`.

Pull Request: https://projects.blender.org/blender/blender/pulls/135382
2025-03-11 05:34:21 +01:00
Campbell Barton
19e8fe18ff Cleanup: remove use of WM_global_report for screen operators 2025-03-11 14:39:28 +11:00
Campbell Barton
cdea7c32ec Fix incorrect reporting for the quadreflow operator
- When called from Python, the operator would always return
  success even on failure.
- Errors are now reported to the operator or to the job-systems
  wmJobWorkerStatus::reports.
- Failure now returns OPERATOR_CANCELLED;
- Replace magic numbers with an enum.
2025-03-11 14:07:19 +11:00
Campbell Barton
f36a3bba81 Merge branch 'blender-v4.4-release' 2025-03-11 13:55:15 +11:00
Campbell Barton
53c8672284 Fix QuadriFlow sometimes failing when called from Python
When the QuadriFlow was called with immediate execution `G.is_break`,
if the user had pressed Escape, the value could be set to true and the
operator would immediately exit reporting the operation was canceled.
2025-03-11 13:51:49 +11:00
Campbell Barton
bd06baf6e6 WM: rename WM_report* to WM_global_report*, note it's often bad practice
WM_report was originally added for special cases however new code
has been using this in operators for example, where reports should be
sent to the operator via BKE_report, so the caller can handle,
and so Python can catch the errors.

Rename the functions to make them less easily confused with BKE_report
and add a code-comment on why their use should be avoided.
2025-03-11 12:36:17 +11:00
Harley Acheson
a064c23de5 Merge branch 'blender-v4.4-release' 2025-03-10 18:17:10 -07:00
John Kiril Swenson
58c29625b2 Fix: UI: Action/info/console scrollbar padding/hiding state
Properly pad the action scrollbar by calling
`ED_time_scrub_clamp_scroller_mask` which was overlooked. Also hide it
when the entire view is visible. Adds versioning code to hide console
and info scrollbars as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/135142
2025-03-11 02:10:49 +01:00
Harley Acheson
1a6eb39fed Merge branch 'blender-v4.4-release' 2025-03-10 17:11:59 -07:00
John Kiril Swenson
d8f3f8cc61 Fix: UI: Improve scrollbar hotspot region
Mouse and action zone interaction for scrollbars depend on `v2d->vert`
and `v2d->hor`, which are updated through `view2d_masks`. However,
scrollbar drawing through `UI_view2d_scrollers_draw` calls
`view2d_scrollers_calc`, which pads these sizes further, meaning that
drawn scrollbars are slightly out of sync with their hotspots. This is
noticeable at track edges for shrinking scrollers or when tracks are
opaque. Fix by moving the extra (noticeable) padding code from
`view2d_scrollers_calc` to `view2d_masks`.

Pull Request: https://projects.blender.org/blender/blender/pulls/135021
2025-03-11 01:10:48 +01:00
Jason Fielder
ff4b6c033d Metal: Fix framebuffers being cleared during subpasses.
Stops clearing the framebuffer when we split the scene into multiple renders.

Fixes default cube rendering as black on some Mac systems.

Authored by Apple: James McCarthy"

Co-authored-by: James McCarthy <jamesmccarthy@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/135099
2025-03-11 00:10:33 +01:00
Harley Acheson
b28a75d7ac Merge branch 'blender-v4.4-release' 2025-03-10 14:23:31 -07:00
Harley Acheson
d29f631b18 Refactor: Avoid Copying with Std::String in #135593
Commit 5ea6ffef68 used std::string in cases where StringRef or
StringRefNull could be used instead. This PR just changes those uses,
and therefore avoids some unnecessary string copying.

Pull Request: https://projects.blender.org/blender/blender/pulls/135756
2025-03-10 22:22:30 +01:00
Sean Kim
791b0745fd Fix: ID_CHECK_UNDO macro has operator precedence issues
Introduced in 0dd326592a

As written, the macro was not actually filtering out changes for the
Brush ID type when used inside `ed_undo.cc` due to operator precedence
issues.

This commit simplifies the macro by using `ELEM` to avoid similar errors
in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/135754
2025-03-10 22:05:42 +01:00
Jesse Yurkovich
467df7a66c Merge branch 'blender-v4.4-release' 2025-03-10 14:02:16 -07:00
Jesse Yurkovich
5b26ae10a6 Fix: Integer overflow when saving large EXR images
Various intermediate calculations would overflow inside both
`imb_save_openexr_float` and `imb_save_openexr_half`.

Additionally, use a raw array for the half conversion since `vector`
will perform an unnecessary zero-initialize on a large amount of memory.

Refer to: #135648

Pull Request: https://projects.blender.org/blender/blender/pulls/135678
2025-03-10 22:01:33 +01:00
Jesse Yurkovich
3fe61d1b22 Fix: Use higher default OIIO file size limit
Increase the default OIIO limit for uncompressed image buffers. Without
this Cycles could, among some other operations, encounter the following
type of error:
```
E0307 19:21:38.489921  2588 tile.cpp:634] Error opening tile file t:\temp\blender_a26776\cycles-tile-buffer-34740-2157603138768-0-0.exr
OpenImageIO exited with a pending error message that was never
retrieved via OIIO::geterror(). This was the error message:
Uncompressed image size 33645.6 MB exceeds the 32768 MB limit.
Image claimed to be 42000x42000, 5-channel float. Possible corrupt input?
If this is a valid file, raise the OIIO attribute "limits:imagesize_MB".
```

Users are able to bypass this themselves in two different ways if
the limit does not meet their needs.

The primary downside of this change is that it increases the memory
consumed if the file is actually malicious. Perhaps well beyond what
most consumer devices have available with physical+swap.

An alternate design would be to expose a System-level preference
for this limit and keep the default 32gb.

Refer to: #135648

Pull Request: https://projects.blender.org/blender/blender/pulls/135676
2025-03-10 22:01:03 +01:00
Harley Acheson
8ded9a8350 Merge branch 'blender-v4.4-release' 2025-03-10 12:29:11 -07:00
Harley Acheson
5ea6ffef68 Fix #135134: Do Not Show Full Path to Built-In Assets
We are showing full paths to the library file on some tooltips, like
for brush assets. This PR checks to see if the asset is in the
BLENDER_SYSTEM_DATAFILES/assets folder. If so it just shows it as
"Built-in Asset:" and with the last portion of the path.

Pull Request: https://projects.blender.org/blender/blender/pulls/135593
2025-03-10 20:28:00 +01:00
Sean Kim
45ff1619f3 Fix: Editor changes to tool-settings push unnecessary undo steps
When users make changes to certain settings from the editor (e.g.
changing the Proportional Edit or Snapping settings), an undo step is
created in the undo stack that has no effect when undone. These steps
should not be created, therefore this commit clears the `STRUCT_UNDO`
tag from the `ToolSettings` struct and any structs that it contains.
A prior commit, 0dd326592a, introduced filtering on the `STRUCT_UNDO`
flag for changes being applied from the UI.

Pull Request: https://projects.blender.org/blender/blender/pulls/134836
2025-03-10 18:11:37 +01:00
илья _
fd9ac90395 Fix #135581: node tree incorrect evaluation
Instances attributes are propagated by default by `Curve Fill`, but this
is not mentioned in a declaration.

Pull Request: https://projects.blender.org/blender/blender/pulls/135597
2025-03-10 18:10:28 +01:00
Sean Kim
96d9619935 Cleanup: Add NonCopyable to Paint BVH Node class
When working with the Paint BVH, we mostly want to operate on the
existing set of nodes stored in the Tree, even when parititioning and
creating new nodes. Adding `NonCopyable` to the base `Node` class
prevents a subtle class of errors early where a copy is made instead of
acquiring a reference.

Pull Request: https://projects.blender.org/blender/blender/pulls/135547
2025-03-10 17:55:53 +01:00
Julian Eisel
1e55035b55 Merge branch 'blender-v4.4-release' 2025-03-10 17:17:10 +01:00
Bastien Montagne
1d76cbab64 Cleanup: sequencer: Replace 'void' MEM_[cm]allocN with templated, type-safe MEM_[cm]allocN<T>.
The main issue of 'type-less' standard C allocations is that there is no check on
allocated type possible.

This is a serious source of annoyance (and crashes) when making some
low-level structs non-trivial, as tracking down all usages of these
structs in higher-level other structs and their allocation is... really
painful.

MEM_[cm]allocN<T> templates on the other hand do check that the
given type is trivial, at build time (static assert), which makes such issue...
trivial to catch.

NOTE: New code should strive to use MEM_new (i.e. allocation and
construction) as much as possible, even for trivial PoD types.

Pull Request: https://projects.blender.org/blender/blender/pulls/135747
2025-03-10 17:16:43 +01:00
Julian Eisel
2b92b0d6d8 Fix #135664: Crash deleting pose asset from saved current file
Rather new code to build the asset library reference from a library
didn't cover the case where the current file library is saved to disk,
and as such implemented as on-disk library.
2025-03-10 17:10:43 +01:00
Hans Goudey
9104cc3406 Merge branch 'blender-v4.4-release' 2025-03-10 11:58:51 -04:00
Hans Goudey
6eb5566104 Fix: Allow RNA functions to return collection properties
Possibly broken by acd1b0b7f9.
Though returning a collection property from an RNA function doesn't
seem to have been used before. The mistakes are relatively obvious.
The RNA parameter list data isn't initialized so placement new and
calling the CollectionVector destructor manually are necessary.

This fix is necessary for #135734 which is targeted at 4.4.

Pull Request: https://projects.blender.org/blender/blender/pulls/135746
2025-03-10 16:57:13 +01:00
Bastien Montagne
83a2e34654 Cleanup: shader_fx & simulation: Replace 'void' MEM_[cm]allocN with templated, type-safe MEM_[cm]allocN<T>.
The main issue of 'type-less' standard C allocations is that there is no check on
allocated type possible.

This is a serious source of annoyance (and crashes) when making some
low-level structs non-trivial, as tracking down all usages of these
structs in higher-level other structs and their allocation is... really
painful.

MEM_[cm]allocN<T> templates on the other hand do check that the
given type is trivial, at build time (static assert), which makes such issue...
trivial to catch.

NOTE: New code should strive to use MEM_new (i.e. allocation and
construction) as much as possible, even for trivial PoD types.

Pull Request: https://projects.blender.org/blender/blender/pulls/135744
2025-03-10 16:39:38 +01:00
Falk David
6c0bd4ebce Merge branch 'blender-v4.4-release' 2025-03-10 16:29:26 +01:00