Commit Graph

107223 Commits

Author SHA1 Message Date
Sietse Brouwer
23ef8cc8e7 Fix: GPv3: Move to layer operator doesn't do anything
The 'move to layer' operator in GPv3 wasn't doing anything, since the `exec` function wasn't called by the operator's `invoke`.
Caused by b37ee403b2.

This PR fixes that.

Pull Request: https://projects.blender.org/blender/blender/pulls/118793
2024-02-27 11:54:21 +01:00
Campbell Barton
66a8cb6f72 Merge branch 'blender-v4.1-release' 2024-02-27 21:32:08 +11:00
Campbell Barton
3d18896e4b Fix #102526: Fix crash performing nested viewport drawing
Performing an off-screen draw call while drawing the viewport isn't
supported, add a check that raises an exception when called from Python
instead of crashing.

Ref: !118780
2024-02-27 21:29:38 +11:00
Campbell Barton
333090572c Merge branch 'blender-v4.1-release' 2024-02-27 21:27:51 +11:00
Campbell Barton
efdbdd6915 Fix #118767: Incorrect Python syntax highlighting for mult-line strings
Lines beginning with a back-slash used a previous character that
was initialized to the default which isn't correct for multi-line
strings.
2024-02-27 21:24:37 +11:00
Campbell Barton
f81448807c Merge branch 'blender-v4.1-release' 2024-02-27 20:51:50 +11:00
Omar Emara
219d06689d Fix: Shader compile error on Metal
Shader compile error on Metal due to mixing between float and integer
types. Fix by manual casting.
2024-02-27 11:48:29 +02:00
Campbell Barton
0d9cd1ee2d Fix crash hiding a region from Python with a popover & region overlap
This was reported as #93410 & fixed with [0] however the fix didn't
help for animated logic (with region overlap enabled).
Resolve by adding a function ED_region_visibility_change_update_ex which
is called by the animated and non-animated region hiding functions.

[0]: 8f69c91408
2024-02-27 20:47:48 +11:00
Omar Emara
b93d5d9c33 Merge branch 'blender-v4.1-release' 2024-02-27 11:43:09 +02:00
Omar Emara
d88cdb3cf1 Fix: Crash when the input of Kuwahara is translated
Blender would crash if the input of the Classic Kuwahara node is
translated. This is due to an out of bound access due to the miss-use of
IndexRange, where it was assumed to have a start-end constructor, while
it was in fact a start-size one. Fix this by computing the size from the
area and supplying it to the constructor.
2024-02-27 11:37:35 +02:00
Omar Emara
a7d4174f8b Compositor: Unify Keying node between CPU and GPU
This patch unifies the Keying node between the CPU and GPU. The
difference was due to imprecision when computing pixel saturation in the
CPU code. This typically happens when the pixel is gray-scale, and
should have a zero saturation, but it came out negative due to
imprecision. To fix this, reorder the mix expression so that the minimum
and maximum values are differenced first.

Ideally, the code shouldn't have such abrupt conditionals and should be
more robust to tiny imprecisions, but that would break the behavior and
should be evaluated separately.

Pull Request: https://projects.blender.org/blender/blender/pulls/118625
2024-02-27 10:09:16 +01:00
Omar Emara
3295123fca Fix: Variable sized blur truncates filter kernel
The GPU compositor Blur node truncates the filter kernel if the blur
radius is lower than the base radius. That's because it evaluated the
filter kernel only up to the desired radius. To fix this, we evaluate
at the entire kernel for all radii using a texture sampler for the
weights.
2024-02-27 11:03:15 +02:00
Lukas Tönne
ffcdf8b4dc Cleanup: Remove unused lambda capture. 2024-02-27 09:46:49 +01:00
Jeroen Bakker
be0c57a0a8 Cleanup: EEVEE: Use uint for enum specialization
Enums are stored as uints, but due to a missing implementation they
where stored in shaders as ints. As draw manager now supports uints
as specialization constants we can update these constants to be
stored as uints on the shader side as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/118788
2024-02-27 08:38:31 +01:00
Campbell Barton
9795c432e1 Cleanup: avoid redundant copy-by-value for 4x4 matrices & float3 2024-02-27 17:57:50 +11:00
Jesse Yurkovich
96ef405c19 Merge branch 'blender-v4.1-release' 2024-02-26 22:47:41 -08:00
Jesse Yurkovich
5b65e2dd7c Fix #118704: permit filepaths without extensions in STL batch mode
The STL exporter was enforcing file paths with an extension when used
from the file browser. This would cause oddness during Batch export mode
and was different than the prior Python based exporter[1].

Permit the exporter to accept names without an extension as before.

[1] [Prior python exporter](https://projects.blender.org/blender/blender-addons/src/branch/blender-v4.0-release/io_mesh_stl/__init__.py#L239)

Pull Request: https://projects.blender.org/blender/blender/pulls/118777
2024-02-27 07:46:29 +01:00
Campbell Barton
63a295f307 Merge branch 'blender-v4.1-release' 2024-02-27 17:03:48 +11:00
Campbell Barton
b16ef496a6 Fix #113479: Crash on script error after calling modal_handler_add()
Operators that added themselves as modal handlers would crash if there
was a Python exception in the script before returning.

Now modal handlers are removed an exception occurs in exec & invoke
operator callbacks.
2024-02-27 16:38:01 +11:00
YimingWu
9e143968d3 LineArt: Fix back transformation issue for v3
Line art v3 strokes should not move along with the grease pencil object
to keep the same behaviour as the old line art. Now fixed.
2024-02-27 13:07:47 +08:00
Hans Goudey
ad648a83ac Merge branch 'blender-v4.1-release' 2024-02-26 22:33:10 -05:00
Hans Goudey
341166c728 Fix #118538: Sculpt smooth mask broken for multires
Mistake in bd51bb7623.
2024-02-26 22:31:55 -05:00
Campbell Barton
523909dd73 Merge branch 'blender-v4.1-release' 2024-02-27 13:10:12 +11:00
Campbell Barton
fe8e27ad17 Fix #116680: Crash disabling an add-on used in the file-selector
Clear SpaceFile::op pointer when unregistering an operator to
prevent a use after free error.
2024-02-27 13:04:38 +11:00
Ray Molenkamp
cfb60c98be CMake: MSVC: Add natvis file for blender's native types
This currently contains some types I personally needed
more types can be added if people desire them.

Due to the .natvis being added to creator, Visual Studio
will automatically pick up on these types and show the
improved visualizers while debugging.

vscode can also use this file, but you'll have to check
its documentation on how to set that up.

Pull Request: https://projects.blender.org/blender/blender/pulls/118576
2024-02-27 01:02:42 +01:00
Hans Goudey
dbc884fa92 Cleanup: Use enum class for sculpt mask filter type 2024-02-26 15:54:10 -05:00
Hans Goudey
f7b661b554 Cleanup: Remove useless sculpt mask filter enum descriptions
These don't add anything beyond the enum item names. Better to have
nothing than waste people's time reading useless descriptions.
2024-02-26 15:47:23 -05:00
Hans Goudey
19c6f7bfac Fix: Build error after recent commit with incorrect header names
5d9e127234
2024-02-26 15:14:25 -05:00
Hans Goudey
2697413fc7 Cleanup: Remove unused code in points to volume node 2024-02-26 15:04:29 -05:00
Hans Goudey
0f9ee1194f Geometry Nodes: Add link drag search items to store named grid node 2024-02-26 15:04:29 -05:00
Hans Goudey
9d349896a7 Cleanup: Remove BKE_mesh.hh include from mesh_to_volume.cc
Avoid rebuilding this file when changing BKE_mesh.hh, since it's very slow.
Instead pass the necessary data directly as spans.
2024-02-26 15:04:28 -05:00
Hans Goudey
291a3c681f Cleanup: Sort node definitions alphabetically 2024-02-26 15:04:28 -05:00
Jesse Yurkovich
e3122d270d Merge branch 'blender-v4.1-release' 2024-02-26 11:48:43 -08:00
Jesse Yurkovich
5d9e127234 Fix: Proper error handling for STL, PLY, and OBJ IO
Properly handle exceptions from STL and PLY code to prevent crashes on
invalid file paths.

This will now also Report errors/warnings to the callers of these
formats as well. For the UI this means a Report banner and Info editor
entry. For Python scripts this means an exception instead of silently
continuing.

Related to #117881
Pull Request: https://projects.blender.org/blender/blender/pulls/118731
2024-02-26 20:45:46 +01:00
Julian Eisel
9bf10d9a69 Cleanup: Use const for catalog service functions
These expose internal data for unit testing purposes. While it might be
better to avoid this entirely, at least make the returned data const, so
there's no unexpected modification from outside the catalog service
internals.
2024-02-26 20:15:14 +01:00
Julian Eisel
a9858c1565 Assets: Make asset catalog tree building (mostly) thread safe
Making this thread safe is quite trivial now. Note that for building the
tree we iterate the catalogs map, which may still be modified from
another thread in parallel. Making this thread safe is kept for a
separate commit.
2024-02-26 20:14:13 +01:00
Lukas Tönne
5599172499 GPv3: Armature Modifier
Armature deformation modifier for Grease Pencil v3.

Changes compared to GPv2:
- `multi` DNA field was unused and was removed.
- `vert_coords_prev` array is unused and was removed (gets passed to
  armature functions but never gets allocated).
- GPv3 modifier uses the common `influence` struct to store the vertex
  group name, for consistency. The
  `GREASE_PENCIL_INFLUENCE_INVERT_VERTEX_GROUP` flag is copied to
  `deformflag` as `ARM_DEF_INVERT_VGROUP` before evaluation, which is
  used internally by armature functions.
- `BKE_armature_deform_coords_with_curves` is added as another variant
  of the deform function, but uses C++ parameter types (spans instead
  of raw pointers). It gets a `Span<MDeformVert>` directly instead of
  deducing it internally from the object type. This is because we want
  to do this curve-by-curve and already use arbitrary vector spans for
  positions.

Pull Request: https://projects.blender.org/blender/blender/pulls/118752
2024-02-26 19:36:10 +01:00
Bastien Montagne
920b9ab134 Merge branch 'blender-v4.1-release' 2024-02-26 18:49:24 +01:00
Bastien Montagne
3748e49034 LibOverride: When created from IDTemplate UI, ensure instanciation of hierarchy root.
When a new liboverride is created from the IDTemplate UI widget, in case
its hierarchy root is different than the liboverride itself, ensure that
it is also instanciated in the scene, if possible (i.e. if it's an
object or collection).

Should allow for better representation of liboverride hierarchies
created that way, and reduce the risk of getting key liboverrides hidden
from the scene's hierarchy (in the Outliner ViewLayer view e.g.).
2024-02-26 18:48:37 +01:00
Bastien Montagne
73a2af3ae5 Fix #118714: Crash on trying to create override on nested linked object.
LibOverride creation code wrapper when called from the IDTemplates in
the UI was a tad too permissive in its attempts to find the best
possible liboverride hierarchy root, leading to potential invalid linked
ID selection.
2024-02-26 18:48:37 +01:00
Hans Goudey
f83471fa95 Cleanup: Use C++ matrix type in mesh render data 2024-02-26 11:46:01 -05:00
Hans Goudey
53f1ebf232 Cleanup: Pass field directly to mesh render data creation
Avoid the need to set use_hide afterwards when other things are stored directly.
2024-02-26 11:46:01 -05:00
Philipp Oeser
85c350e3e9 Merge branch 'blender-v4.1-release' 2024-02-26 17:41:17 +01:00
Philipp Oeser
a6060ea8ee Fix #118637: crash after editbone duplication in certain case
Crash happens in `action_group_colors_set_from_posebone` /
`ANIM_bonecolor_posebone_get` on a `bPoseChannel` without a `bone`.
If I am not mistaken a new `bPoseChannel` (e.g. after duplication) will
only get its `bone` after leaving editmode.

So in a way the situation is similar to 2a8ce1f121

Behavior of `animchan_sync_group` is not reliable in a way that getting
a `bPoseChannel` from an `bActionGroup` will guarantee these are really
corresponding. So usually, if you dulplicate/symmetrize a bone, there
would be no corresponding `bActionGroup` and nothing would happen
really. But you could for example group fcurves from `Bone` under a
group called `Bone.001` and vice versa. This is totally allowed to do.
In this case, `animchan_sync_group` is doing nothing totally helpful, so
it could find the "wrong" `bPoseChannel`. And it could try
`action_group_colors_set_from_posebone` with that `bPoseChannel` which
still does not have a `bone` and then crash.

So now only do this if we have a valid `bone`.

Pull Request: https://projects.blender.org/blender/blender/pulls/118676
2024-02-26 17:40:57 +01:00
Miguel Pozo
c713fbc2d3 GPU: Allow printing full shader source on compilation error
Add a define (DEBUG_LOG_SHADER_SRC_ON_ERROR ) in gpu_shader_private.h
to print the full source code of shaders that fail to compile.

Pull Request: https://projects.blender.org/blender/blender/pulls/116470
2024-02-26 17:30:15 +01:00
Hans Goudey
5463dd1f69 Cleanup: Rename mesh extraction file
The "pos_nor" file only extracts postions after bace4c9a29.
2024-02-26 11:28:33 -05:00
Philipp Oeser
663c1ea14d Merge branch 'blender-v4.1-release' 2024-02-26 17:16:33 +01:00
Philipp Oeser
ae022e515b Fix 104657: crash when trying to create a Pivot Constraint for armature
`RootPChanMap` will be nullptr when building DEG object-level
constraints (as as opposed to bone constraints where this map is built
prior), and in that case we don't need to check for the common chains in
`bone_target_opcode`.

Thx @sergey for additional confirmation

Pull Request: https://projects.blender.org/blender/blender/pulls/118745
2024-02-26 17:15:58 +01:00
Clément Foucault
c04eb58134 EEVEE-Next: Make denoising roughness correct for refraction
Avoid overblurred refractions.

Fix #110760
2024-02-26 16:21:08 +01:00
Jeroen Bakker
8dce2a422b EEVEE-Next: Specialization Constants for Film Accumulation
On lower end hardware the film accumulation has bad performance. Sometimes
upto 10ms. This PR improves the performance somewhat by adding a
specialization constant around the renderpasses that are actually needed for
rendering, the number of samples and if reprojection is enabled.

`enabled_categories`: Based on the enabled render passes some outer loops are
enabled/disabled that handle the specific render passes. This improves the performance
as no memory will be reserved for branches that are never accessed.

`samples_len` & `use_reprojection`: GPU compilers tend to optimize texture fetches
when they to the outer loop. This is only possible when the inner loop can be unrolled.
In the case of the film accumulation the inner loop couldn't be unrolled. By adding a
specialization constant would allow unrolling of the inner loop.

On old or low-end devices the improvement is around 40%. On newer devices
the improvement is 50+%. Performance of this shader is similar to
the godot.

| GPU                  | Before | New   |
|----------------------|--------|-------|
| NVIDIA GTX 760       | 3.5ms  | 2.4ms |
| GFX1036 (RDNA2 iGPU) | 9.9ms  | 6.2ms |
| AMD Radeon Pro W7500 | 2.1ms  | 0.9ms |

Pull Request: https://projects.blender.org/blender/blender/pulls/118385
2024-02-26 16:19:26 +01:00