Commit Graph

109201 Commits

Author SHA1 Message Date
Campbell Barton
3290e25dc4 Cleanup: spelling in comments & code 2024-05-08 20:57:05 +10:00
Campbell Barton
e64d067c78 Docs: document why the eventstate is cleared while refreshing a popup
Also correct a comments grammar.
2024-05-08 20:44:36 +10:00
Falk David
737572ed88 Cleanup: GPv3: Use GreasePencil::layer function instead of GreasePencil::layers
This also ensures that there is an assert that checks
for valid indices before accessing the span of layers.
2024-05-08 12:35:06 +02:00
Guillermo Venegas
3a640a4707 Fix #121280: clamp layout panel sub-background color to block region
Pull Request: https://projects.blender.org/blender/blender/pulls/121534
2024-05-08 12:32:51 +02:00
Falk David
bba4555526 Refactor: GPv3: Remove get_eval_grease_pencil_layer_drawing* functions
As part of #121565.

To avoid using drawing indices outside of the internal grease pencil API,
this refactor adds the functions `GreasePencil::get_eval_drawing` to replace
the `get_eval_grease_pencil_layer_drawing*` functions.

Pull Request: https://projects.blender.org/blender/blender/pulls/121567
2024-05-08 12:27:40 +02:00
Pratik Borhade
5f1a31c88a GPv3: Change "active" property to "active_layer"
Rename layer property `active` -> `active_layer` to distinguish
between active layer and active layer group.
The active group property was introduced in d1710f7232.

Pull Request: https://projects.blender.org/blender/blender/pulls/121563
2024-05-08 12:18:00 +02:00
Falk David
2707cc28fd GPv3: Add asserts for drawing access by index
Assert that the index is valid before accessing the span.
2024-05-08 12:09:10 +02:00
Jacques Lucke
6176e66636 Nodes: add node group description
This allows node groups to have a description that is shown in the add menu
or when hovering over the node header.

This new description is stored in `bNodeTree.description`. Unfortunately, it
conflicts a bit with `ID.asset_data.description`. The difference is that the latter
only exists for assets. However, it makes sense for node groups to have
descriptions even if they are not assets (just like `static` functions in C++ should
also be able to have comments). In some cases, node groups are also generated
by addons for a specific purpose. Those should still have a description without
being reusable to make it easier to understand for users.

The solution here is to use the asset description if the node group is an asset,
and to use `bNodeTree.description` otherwise. The description is synced
automatically when marking or clearing assets.

A side benefit of this solution is that appended node group assets can keep their
description, which is currently always lost.

Pull Request: https://projects.blender.org/blender/blender/pulls/121334
2024-05-08 11:25:00 +02:00
Aras Pranckevicius
d66598c16f VSE: Text shadow blur / outline
Text strips in VSE got:
- Configurable shadow angle and offset (previously shadow location relative to
  text was fixed). Currently the shadow position is rounded to integer pixel
  locations; sub-pixel positioning might come later.
- Optional shadow blur amount.
- Optional outline, with color and outline width controls. Outline is
  implemented using jump flooding algorithm.

Images and more detail in pull request.

Pull Request: https://projects.blender.org/blender/blender/pulls/121478
2024-05-08 11:13:20 +02:00
Pratik Borhade
d1710f7232 GPv3: Support layer group selection
Introduce new `active_group` pointer and get/set api functions.
Use RNA to change active group in on_activate() function, similar to
layer selection: 4c12801532

Pull Request: https://projects.blender.org/blender/blender/pulls/121524
2024-05-08 09:05:32 +02:00
Harley Acheson
dfe060ea6f UI: Edit Mesh Knife Status Display
While using the knife tool show keymap entries and statuses in a more
informative and concise way.

Pull Request: https://projects.blender.org/blender/blender/pulls/121506
2024-05-07 22:15:12 +02:00
Hans Goudey
ba9286706a Geometry Nodes: Sample Grid Index node
This (experimental, for now) node retrieve's voxel values
at specific voxel indices for a grid input. It's similar to the
Sample Grid node (77cba3d551), but there is
no interpolation, and it uses indices instead of positions.

Pull Request: https://projects.blender.org/blender/blender/pulls/118690
2024-05-07 21:53:22 +02:00
Harley Acheson
42a8947eb1 UI: Edit Mesh Inset Faces Status Display
Show changing values in the area header, but keymap entries on the
Status Bar.

Pull Request: https://projects.blender.org/blender/blender/pulls/121504
2024-05-07 21:45:34 +02:00
Habib Gahbiche
6f2afc7390 Fix #121436: Compositor: 2d Stabilization translates image when set to bicubic
The node uses multiple transform operations, each using its own sampling. Using bicubic sampling in the translate node causes undesired offsets.

These changes were intentional (see test updates in `c4e1be73`), but the offsets were thought to be too small for users to notice.

Pull Request: https://projects.blender.org/blender/blender/pulls/121495
2024-05-07 21:08:28 +02:00
Hans Goudey
c4051c3216 Fix #121347: GPU subdivision loose edges hidden with no non-loose edges
There was an incorrect early return in 1b7e67a851.
2024-05-07 14:07:30 -04:00
Richard Antalik
897664ccc5 Fix #121319: Mask modifier not clamped to mask strip
Skip modifier, when using strip as a mask that ends before specified
timeline frame. To make behavior of missing mask more consistent,
modifier is also skipped, when strip produces blank output due to
missing data.

Skipping modifier due strip boundary only works, when "Mask Time" is set
to Relative mode. This is because absolute mode ignores strip offsets.

Pull Request: https://projects.blender.org/blender/blender/pulls/121498
2024-05-07 19:37:24 +02:00
Hans Goudey
1210a53c6d Fix #121503: Loose edges lines index buffer crash
The array used to not set the data for an edge multiple times
was the wrong size.
2024-05-07 13:18:52 -04:00
Miguel Pozo
96c0533997 Fix #120762: Linked materials always initialize MA_BL_TRANSPARENT_SHADOW from EEVEE settings
If `bmain->scenes.first` is null, we can't know which engine settings we should
use to initialize `MA_BL_TRANSPARENT_SHADOW`.
Default to Cycles settings in this case, since EEVEE-Next is going to break
compatibility anyway.
See
https://projects.blender.org/blender/blender/issues/120762#issuecomment-1183725

Pull Request: https://projects.blender.org/blender/blender/pulls/121537
2024-05-07 19:17:58 +02:00
Clément Foucault
bd34a74439 Fix: EEVEE-Next: Incorrect Alpha in AOVs
Was caused by float imprecision and storage precision
conversion. Use same fix as combined pass but
more selective as the alpha channel can contain
other data for AOVs.

Fix #118494
2024-05-07 18:39:33 +02:00
Raul Fernandez
00e2f55239 Fix #99887: Multires Unsubdivide freezes Blender with hidden geometry
Previously in
```
edge_y = edge_step(current_vertex_y, edge_y, &current_vertex_y);
while (!BM_elem_flag_test(current_vertex_y, BM_ELEM_TAG))
```
With hidden faces this code enters in an infinite loop by returning the same null
edge in edge_step() and the same current_vertex_y causing Blender to crash.

The current fix solves the infinite loop and provides a solution when faces are hidden.
This causes the hidden faces to be merged into one for unsubdivided per original dev's implementation.

At minimum the crash is identified and a solution proposed.
Attached is a video of the fix

Pull Request: https://projects.blender.org/blender/blender/pulls/121086
2024-05-07 18:04:52 +02:00
Vitaljok
88b56a6ad2 Fix: EEVEE-Next: Missing Shader to RGB node when dragging output link from the node and searching
Added `BLENDER_EEVEE_NEXT` engine ID to polling code called during
"drag search". Main ADD menu routines already had this ID.

Fixes #121026 missing `Shader to RGB` node.
`Specular BSDF` node had similar problem, fixed as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/121231
2024-05-07 18:03:15 +02:00
Sybren A. Stüvel
b56daddda6 Anim: restore logging of key insertion errors on stdout
An earlier commit accidentally removed too much code. This is now
restored, so that when keyframe insertion fails, at least on stdout it's
logged which F-Curve caused this failure.

8dbd167e80 did improve the error
reporting, but even that does not explicitly mention which F-Curves
caused those errors (for good reason, as cluttering the UI would be very
simple then).

Pull Request: https://projects.blender.org/blender/blender/pulls/121527
2024-05-07 17:57:26 +02:00
Clément Foucault
f5a4dec458 Fix: EEVEE-Next: Missing shadow refresh after compilation
This affects only transparent materials. Ideally, the shader
compilation should trigger a tag update on the object but
that's bad level call.

Instead, we just discard all shadows after finishing recompiling
a transparent material. This is overly conservative but it fixes
the issue.

Fixes #119624
2024-05-07 17:53:35 +02:00
Julian Eisel
952bc075ae Fix #121490: Unable to access asset from context in asset shelf
Displaying an operator in the context menu that would access the asset
via context would fail.

3 issues here in fact:
- 798219225d removed code to attach the asset to the button's context.
  Brought this back.
- If the `AssetShelf.get_active_asset()` method (in Python) isn't set,
  `AssetViewItem::should_be_active()` would always return false, making
  it impossible to lookup the active item. Instead it should return an
  empty value so the view's internal active state is used instead.
  Mistake in a700c90ec3.
- These kind of context queries can't rely on cursor coordinates, it's
  not well defined what state they are in. In fact `wmWindow.eventstate`
  is unset in debug builds to help enforce this. Also an issue from
  a700c90ec3. With the above two corrections this change can be
  undone so the query doesn't depend on cursor coordinates anymore.
2024-05-07 17:45:15 +02:00
Clément Foucault
286cbc8317 Fix: EEVEVE-Next: Wrong material reused for transmission material
This is caused by #121137 as the bug disappear if
`can_use_default_cb` returns false.


The issue is caused by the material binning system.
`ShaderKey` uses the `GPUMaterial` to differentiate between
material. But with #121137, different materials can reuse the
same `GPUMaterial`.

The fix is to not reuse the shader for the prepass (even if opaque)
for transmission enabled shaders.

Fix #121343
2024-05-07 17:34:36 +02:00
Clément Foucault
d9915b86a6 EEVEE-Next: Remove shadow softness factor parameter
This parameter was introduced to mitigate shadow tracing
artifacts. These are no longer present since #121317 and
leaving this parameter breaks PBR rules which opens other
issues with shadow disconnected from shading.
2024-05-07 15:49:49 +02:00
Jeroen Bakker
32e6042230 EEVEE-Next: Fix division by zero when copying motion vectors
Due to recent changes geometry without any vertices could lead to
a division by zero when copying motion vectors.

This PR fixes this by skipping the copy step when there are no
vertices to copy.

Pull Request: https://projects.blender.org/blender/blender/pulls/121516
2024-05-07 15:43:51 +02:00
Philipp Oeser
3dd08beab3 Fix #121459: STL / Alembic / PLY export empty meshes in editmode
Export would also assert in debug builds.

Similar to f8b11528b2, this now ensures we have mesh data in editmode.

Pull Request: https://projects.blender.org/blender/blender/pulls/121512
2024-05-07 15:20:03 +02:00
Philipp Oeser
238ee9683a Fix: memleak in Graph Editor Keyframe jump operator
In case no frame to jump to was found, `ANIM_animdata_freelist` wasnt
called.

Spotted while looking into #121463

Pull Request: https://projects.blender.org/blender/blender/pulls/121484
2024-05-07 15:19:05 +02:00
Philipp Oeser
734a9dec43 Fix #121463: Graph Editor Keyframe jump operator shifts keyframes
Caused by 598af45459

Above commit added respect for the NLA strip offset (rightfully so, by
using `ANIM_nla_mapping_apply_fcurve`).
However, when no closest frame was found, the code moved on to the next
FCurve without restoring to the original FCurve --
`ANIM_nla_mapping_apply_fcurve` needs to be called in pairs.

To resolve, now always restore to the original FCurve.

Pull Request: https://projects.blender.org/blender/blender/pulls/121483
2024-05-07 15:17:26 +02:00
Philipp Oeser
b57916463c Fix #121121: NLA push down places local tracks before library overrides
The history here goes from c0bd240ad0 through 89ae4a7a2a (which were
still good), but then with 81b56f8bbc we have gotten to a point were
tracks were placed **before** overrides in case no local tracks were
found.

Now corrected.

Pull Request: https://projects.blender.org/blender/blender/pulls/121395
2024-05-07 15:16:47 +02:00
Clément Foucault
d6aa790301 Cleanup: EEVEE-Next: Remove warnings 2024-05-07 15:07:41 +02:00
Nathan Vegdahl
8dbd167e80 Anim: add failure propagation to more lower-level keying functions
This changes the following keyframing functions to return
`SingleKeyingResult`, which is in turn used for better failure
reporting in the higher-level functions that call them:

- `KeyframeStrip::keyframe_insert()`
- `insert_vert_fcurve()`

As a side effect, this also means that
`rna_KeyframeAnimationStrip_key_insert()` can no longer return an
`FCurve *`, and now instead returns a bool indicating success.

This is part of an ongoing progressive refactor to improve error
messages and failure handling in the keyingframing code.

Pull Request: https://projects.blender.org/blender/blender/pulls/121517
2024-05-07 15:06:57 +02:00
Clément Foucault
87d164c56b EEVEE-Next: Improve shadow tracing
The goal of this PR is to remove the per face, NDC space
tracing for shadow maps.

This requires custom occluder extrapolation but in return
removes quite a lot of complexity in other areas, namely:
- No more per face transform before the tracing
- No more per face jittering (fix #119565)
- No more frustum padding (increased maximum precision)
- Better use of 32bit precision shadow map
- Fix #121343

This improve softness at relatively low step count (default 6
is better) and reduces light leaking at very low sample
count (sharper). It makes it more intuitive now that
higher sample count is smoother.

Pull Request: https://projects.blender.org/blender/blender/pulls/121317
2024-05-07 14:52:47 +02:00
Sybren A. Stüvel
18cccafeaf Refactor: Lattice deform: prevent incrementing nullptr
The lattice deform code would always call `co += 3` in a loop, even when
co is `nullptr`. This is invoking undefined behaviour, and causes UBSAN
warnings.

Pull Request: https://projects.blender.org/blender/blender/pulls/121396
2024-05-07 14:23:27 +02:00
Campbell Barton
9a5366cf8e UI: increase precision of the camera's focus distance
For metric units the depth was being rounded to the nearest meter
(in the range of 10-100 meters), increase the precision from 2 to 4
so it's possible to see centimeter precision.
2024-05-07 22:17:21 +10:00
Richard Antalik
afa828ffca VSE: Various refactorings
These changes are not very useful on their own, but committed in order
to make PR #109522 easier to review
2024-05-07 13:37:16 +02:00
Richard Antalik
b062980318 Cleanup: Refactor VSE handle drawing code
Split handle rectangle and handle position text drawing to separate
functions.
2024-05-07 13:37:16 +02:00
Clément Foucault
d97e22f2cd Fix: EEVEE-Next: Missing world diffuse lighting
Caused by c99e7519c4

Missed the initial `local_radiance` value.
2024-05-07 12:53:28 +02:00
Aras Pranckevicius
6efa5c16ab Mesh: speedup BKE_mesh_validate
BKE_mesh_validate is called by mesh.validate() Python API, as well as optionally
when doing file imports. This PR speeds it up a bit:
- Faster face data sorting by using parallel sort instead of qsort,
- One allocation for all face vertex indices, instead of a separate allocation
  for each face,
- (more like a fix) Validation no longer adds a MDeformVert layer when there was
  none in the input mesh.
- Small cleanups (more const inputs, etc.)

On my Windows/VS2022/Ryzen5950X machine, import time in seconds (validation on
before this PR -> validation on with this PR, validation off):
- USD (Intel Moore Lane): 9.1 -> 6.7, 4.8.
- OBJ (Blender 3.0 splash): 22.7 -> 18.6, 16.5.

Pull Request: https://projects.blender.org/blender/blender/pulls/121413
2024-05-07 12:29:32 +02:00
Jacques Lucke
89a1a2cd7e Fix #121458: crash when using layout panels in operator ui
The same fix is used in e.g. `wm_block_dialog_create`.
2024-05-07 12:01:11 +02:00
Jacques Lucke
96db947f16 Geometry Nodes: show info in simulation node when it is baked
This adds the same overlay that already exists for the bake node to the simulation output node.
Without this, it's quite hard to see if the simulation zone is baked or not currently.

Pull Request: https://projects.blender.org/blender/blender/pulls/121497
2024-05-07 11:35:03 +02:00
Pratik Borhade
8d8d358196 GPv3: Replace active_layer with active_node
This was discussed in #121390 for further selection support of
layer groups.

Pull Request: https://projects.blender.org/blender/blender/pulls/121475
2024-05-07 11:26:33 +02:00
Jacques Lucke
5f02eaae9f Geometry Nodes: use aligned sockets in bake node
This aligns the corresponding input and output sockets in the Bake node.
A similar change has been done for simulation and repeat zones before in #118335.

Pull Request: https://projects.blender.org/blender/blender/pulls/121496
2024-05-07 11:23:23 +02:00
Christoph Lendenfeld
afe13175da Anim: run bezier handle calculation in parallel
Bezier handles are recalculated in many places in the
animation code. Threading that code can give a performance
boost  all over Blender.
This patch only threads a part of the handle calculation code.
`BKE_nurb_handle_smooth_fcurve` can still be run in parallel,
but that's more complicated, so not done in this PR.

Overall this patch mostly benefits code paths that are not already threaded.

------

Performance delta

| Action | Before | After |
| - | - | - |
| `recalcData_graphedit` moving a single key | 1.06 ms | 1.0 ms |
| `recalcData_graphedit` moving 300 keys of a single FCurve | 1.6 ms | 1.4 ms |
| `recalcData_graphedit` moving 300 keys of multiple FCurves | 60 ms | 55 ms |
| `ANIM_animdata_update` when using the Breakdown operator in the GE | 90 ms | 73 ms |

Test file used
https://download.blender.org/ftp/sybren/animation-rigging/heavy_mocap_test.blend

Pull Request: https://projects.blender.org/blender/blender/pulls/119388
2024-05-07 10:42:53 +02:00
Campbell Barton
7456d716f4 Fix #120811: Loop cut crash with symmetry enabled
Resolve regression introduced in [0].

[0]: 7f1b70ac50
2024-05-07 17:02:03 +10:00
Campbell Barton
aa03383838 Cleanup: resolve cppcheck funcArgNamesDifferent warnings in blenlib 2024-05-07 13:07:02 +10:00
Campbell Barton
1838499f55 Cleanup: suppress unassignedVariable warning with cppcheck
While not an error this has the minor benefit of simplifying the macro.
2024-05-07 12:59:21 +10:00
Campbell Barton
74a59076d8 Cleanup: spelling in comments, use doxy-sections 2024-05-07 12:59:13 +10:00
Campbell Barton
eda129a768 Cleanup: quiet parentheses warning 2024-05-07 12:59:12 +10:00