Commit Graph

109338 Commits

Author SHA1 Message Date
Sybren A. Stüvel
ac4e00da0d Refactor: return C++ type in BKE_pose_minmax() instead of return params
Return a `std::optional<Bounds<float3>>` instead of having two return
parameters and returning a `bool`.

No functional changes.
2024-05-13 15:42:33 +02:00
Sybren A. Stüvel
81d73881ca Cleanup: Return early in BKE_pose_minmax
Reduce cognitive complexity by returning early in `BKE_pose_minmax()`.

Also rename `changed` to `found_pchan`, as that explains better what's
being tracked.

No functional changes.
2024-05-13 15:42:33 +02:00
Sybren A. Stüvel
b4cc9329e5 Refactor: Anim, remove 'use_hidden' from BKE_pose_minmax()
Remove the `use_hidden` parameter of the `BKE_pose_minmax()` function.
This parameter was only used with `use_selected` set to the same value,
with the following effects:

- Both set to `true`: only selected bones are considered. Since hidden
  bones are automatically deselected, this effectively excluded hidden
  bones.
- Both set to `false`: explicitly excludes hidden bones.

So in both use cases hidden bones were ignored, which IMO is the correct
approach anyway, as the bounding box is used for centering in view,
snapping to bounding box, etc.

No functional changes.
2024-05-13 15:42:33 +02:00
Sybren A. Stüvel
6212c3c374 Fix #121161: Regression: Frame Selected Includes Hidden Bones
Refactor `BKE_armature_min_max()` so that it calls `BKE_pose_minmax(ob,
use_hidden=false)`. The former took neither bone visibility nor custom
bone shapes into account when computing the bounding box. Now these two
are unified, fixing the regression.

`BKE_armature_min_max()` is now basically a thin wrapper that uses more
modern C++ types in its signature. This will be cleaned up in a
follow-up refactor commit.

Another difference is that these functions return the AABB in different
coordinate spaces (object vs. world). This isn't done entirely correctly
(just transforming the two extreme points), but in a way that is
symmetrical with `BKE_object_minmax()`.

Pull Request: https://projects.blender.org/blender/blender/pulls/121739
2024-05-13 15:42:33 +02:00
Sybren A. Stüvel
547067f599 Cleanup: Anim, add const to BKE_pose_minmax()
Make the `Object *` argument `const` in `BKE_pose_minmax()`. There is no
writing to the object to cache the bounding box, and that's now clear from
the declaration as well.

No functional changes.
2024-05-13 15:42:33 +02:00
Falk David
281bbe198d Cleanup: GPv3: Use get_drawing_at in modifier util functions
Part of #121565.

Instead of accessing the drawing indices directly, use
`get_drawing_at` in the utility functions.

Pull Request: https://projects.blender.org/blender/blender/pulls/121732
2024-05-13 15:40:36 +02:00
Falk David
a80d53bd75 Cleanup: GPv3: Use get_drawing_at in get_evaluated_grease_pencil_drawing_deformation
Part of #121565.

Use the `get_drawing_at` function instead of reading the drawing indices.
This gets us closer to not exposing the drawing indices
at all.
2024-05-13 14:54:20 +02:00
Clément Foucault
c7bc3334ad EEVEE-Next: Shadow: Add Maximum Resolution Option
This adds a light parameter to avoid near camera pixels
allocating too much shadow resolution.

This is more intuitive than the scale shadow setting and
allows reducing the precision without changing the look
of distant shadows.

For sun lights, the property sets the minimum pixel
size the shadow can contains. This allows to
remove a lot tilemap close up.

For local lights, there is another additional property
to set the maximum resolution in shadow space (like
EEVEE-Legacy) instead of in world space (like sun
lights). This allows making older files lighter and
allow a more conservative approach to resolution.

This add versionning code to handle EEVEE-Legacy files
that had fixed resolution per light type.

The resolution setting is always in world space distance
as the maximum shadow resolution distribution might change
in the future or be dependent on other parameters
(like beam angle). This ensure that there is no
dependency on these parameters, but make the
setting use very small units. But this is more of
a UI problem.

Pull Request: https://projects.blender.org/blender/blender/pulls/121701
2024-05-13 14:34:11 +02:00
Clément Foucault
ab48b08cde Fix: EEVEE-Next: Avoid syncing issues on AMD with cryptomatte
There was a missing barrier, which created
blocky, non-deterministic artifacts in the
cryptomatte render tests.
2024-05-13 14:10:26 +02:00
Jeroen Bakker
e0da623d33 Vulkan: Don't record drawlist commands for invalid batches
Overlay engine extra layer can record draw list commands with an
empty index buffer. This would not affect any pixels and should be
ignored.

Issue detected when vulkan validation layers are turned on and loading
default scene.

Pull Request: https://projects.blender.org/blender/blender/pulls/121736
2024-05-13 14:09:37 +02:00
Jeroen Bakker
5c369768d7 Vulkan: Revert incorrect fix for begin rendering
Reverting a quick fix which didn't solve the root cause. The root
cause was fixed by #121723.

Pull Request: https://projects.blender.org/blender/blender/pulls/121726
2024-05-13 13:28:05 +02:00
Brecht Van Lommel
7f912e09c7 Assets: Sort by library name if all else is equal
Previously this would be random, which makes the order in the asset
shelf unpredictable when duplicating an essentials brush asset and
keeping the same name.
2024-05-13 13:22:49 +02:00
Falk David
22d8d52058 Temp fix: Assert in CTX_wm_region_popup_set for debug builds
Caused by 7ae77e61cd.
Opening files and templates would cause an assert to be hit in
debug mode.

For now, comment the assert out to temporarily fix the issue.
2024-05-13 13:11:18 +02:00
Falk David
750ab86b5c Cleanup: GPv3: Use get_drawing_at in grab sculpt tool
Part of #121565.

Instead of using the drawing index to get the drawing,
use `get_drawing_at`.

Pull Request: https://projects.blender.org/blender/blender/pulls/121731
2024-05-13 12:13:50 +02:00
Falk David
69f3062909 Cleanup: GPv3: Use get_editable_drawing_at in draw tool
Instead of using the `drawing_index` use the `get_editable_drawing_at`
function to retrieve the drawing.
2024-05-13 11:43:22 +02:00
Falk David
7f8d4df410 UI: Add eyedropper button to camera focus distance
Blender already had the ability to sample the depth with an eyedropper
and fill the focus distance (see `"ui.eyedropper_depth"`). But this feature
was fairly hidden. You had to hover over the `focal_distance` property
in the camera data panel and then press `E` (then sample a distance
in the 3D viewport).

This patch adds a `prop_data_path` property to the `ui.eyedropper_depth`
operator to allow specifying the property that should be filled with the
depth value.

The idea for this is taken from `wm.radial_control`, which also uses this
approach to write to a property. This allows us to add the eyedropper
as a button.

Pull Request: https://projects.blender.org/blender/blender/pulls/121486
2024-05-13 11:01:57 +02:00
Aras Pranckevicius
39150096d8 Fix #121720: OBJ does not import some curves properly
If a curve was not using U parameter range of 0..1, the importer
did not properly detect whether the "U endpoint" flag should
be set on it. Fixed that, along with test coverage for the case.
2024-05-13 11:45:20 +03:00
Jeroen Bakker
b998697d4f Vulkan: Fix out of bound access in begin rendering
There is an implementation flaw in the render graph where local pointers
cannot be updated, but the data it refers to can be reallocated to
another location.

The cause of this is that the nodes use an union, which can only contain
simple constructed structs (eg memcpy). this union is stored in a vector
and can relocate the union. Any local pointers can (and will) become
invalid.

This PR is a quick fix by updating the pointers just before sending
them to the command buffer. In future a better fox needs to be done
as part of #121649.

Pull Request: https://projects.blender.org/blender/blender/pulls/121723
2024-05-13 09:35:36 +02:00
Jason Fielder
405be29540 Metal: Fix texture update data sizing for compressed textures
Resolves issue for texture data upload sizing not taking
compressed texture input data size into account.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/121210
2024-05-13 09:35:08 +02:00
Sergey Sharybin
f9f7173a15 Cleanup: Strict compiler warning, unused function argument
Pull Request: https://projects.blender.org/blender/blender/pulls/121725
2024-05-13 09:29:38 +02:00
Jeroen Bakker
ca40b12240 Vulkan: Remove unneeded device usage in render graph tests
The render graph tests initialized a command buffer wrapper that
requires a working device. The wrapper was not used, but when
destructing it would try to deallocate the command buffer, which
cannot be done as that requires a working device as well.

This PR removes the unneeded command buffer wrappers in the test
cases.
2024-05-13 08:32:58 +02:00
Campbell Barton
83b6a4dfbd Extensions: add a repository option to check for updates on startup
Optionally check for updates on startup (disabled by default),
used when experimental extensions support is enabled.
2024-05-13 12:38:46 +10:00
Charles Wardlaw
2db96ee8ca Build: USD: Small fix to allow compiling against both 23.11 and 24.05
The API in question was modified as part of [1] several months ago. The
example scene in the PR now displays correctly with both USD versions.

[1] 7469ddd8bd

Pull Request: https://projects.blender.org/blender/blender/pulls/121636
2024-05-13 03:02:31 +02:00
Lukas Tönne
db1443249c GPv3: Snap operators for edit mode
Implements snapping for grid, selected-to-cursor, and cursor-to-selected,
as well as the regular menu and pie menu for these operators.

Pull Request: https://projects.blender.org/blender/blender/pulls/121582
2024-05-12 10:24:07 +02:00
Clément Foucault
e63fef6162 Fix: EEVEE-Legacy: Broken Specular BSDF 2024-05-11 17:08:15 +02:00
Clément Foucault
b76960673f Fix: DRW: Thread safety in pointcloud IBO builder
`GPU_indexbuf_add_tri_verts` is not threadsafe.
Use direct memory access.

Also cleanup to increase code clarity.
2024-05-11 15:40:44 +02:00
Clément Foucault
73a496121b DRW: PointCloud: Multithread index buffer creation 2024-05-11 14:00:28 +02:00
Clément Foucault
41b0e11839 DRW: Reduce number of bits used to store shape indice
Fix #108901
2024-05-11 14:00:28 +02:00
Aras Pranckevicius
aa350a945d Cleanup: format 2024-05-11 14:42:34 +03:00
Clément Foucault
414854a09f Metal: Change error assert into system backtrace
This matches the behavior of the GL backend debug.
2024-05-11 12:47:23 +02:00
Pratik Borhade
05be3413a9 Fix: Warning due to lower case gpv3 menu identifier
Caused by 30e3f14bcd

Pull Request: https://projects.blender.org/blender/blender/pulls/121684
2024-05-11 12:44:26 +02:00
Jacques Lucke
c3fc905544 Fix: potentially missing initialization 2024-05-11 09:30:57 +02:00
Matthew Krueger
1953f3cd51 Fix #121605: MacOS Crashes on Desktop with shortcut to non-mounted (and non-mountable) drive
By adding NSURLBookmarkResolutionWithoutMounting to options to keep MacOS from attempting to mount shortcuts.

This addresses that blender hangs and crashes if there's a shortcut to a network drive that cannot be mounted at that time.

Pull Request: https://projects.blender.org/blender/blender/pulls/121673
2024-05-11 04:39:33 +02:00
Brecht Van Lommel
0d4e4e3f42 Cleanup: Remove unused scene argument from foreach_nodeclass 2024-05-10 21:58:43 +02:00
Brecht Van Lommel
33e8b12a43 Cleanup: Pass main expand callback directly to function 2024-05-10 21:58:43 +02:00
Aras Pranckevicius
c78e4d203c Fix linux build 2024-05-10 22:35:33 +03:00
Aras Pranckevicius
3582e52f9c UI: Improved overlay text contrast with new outline text decoration
Overlay texts were previously drawn with two sets of shadows:
- 3px blur,
- 5px blur, slightly offset

But since the shadow color was always set to black, it was still
causing legibility issues when the text itself was dark (set
via theme for example).

This PR adds a new "outline" BLF text decoration, and uses that
for the overlays. And it picks text/outline color depending
on the "background" color of the view.

Details:

- Instead of "shadow level" integer where the only valid options
  are 0, 3 or 5, have a FontShadowType enum.
- Add a new FontShadowType::Outline enum entry, that does a 1px
  outline by doing a 3x3 dilation in the font shader.
- BLF_draw_default_shadowed is changed to do outline, instead of
  drawing the shadow twice.
- In the font shader, instead of encoding shadow type in signs of
  the glyph_size, pass that as a "flags" vertex attribute. Put
  font texture channel count into the same flags, so that the
  vertex size stays the same.
- Well actually, vertex size becomes smaller by 4 bytes, since turns
  out glyph_mode vertex attribute was not used for anything at all.

Images in the PR.

Co-authored-by: Harley Acheson <harley.acheson@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/121383
2024-05-10 21:06:44 +02:00
Jeroen Bakker
b78875c675 Vulkan: Disable failing test
Result isn't consistent on Windows platform due to copying structs with arrays.
This is a quick fix and will be looked at next week. The code isn't used at this moment.

Pull Request: https://projects.blender.org/blender/blender/pulls/121670
2024-05-10 20:29:25 +02:00
Iliya Katueshenock
ba4c225737 Cleanup: Protect GValue template from Void pointer
Only typed pointer should go in default constructor with template.

Pull Request: https://projects.blender.org/blender/blender/pulls/121669
2024-05-10 20:28:01 +02:00
Richard Antalik
d1bad9ddfe Fix #120709: VSE retiming depends on Strip start frame
Caused by using timeline frame instead of frame index as argument for
`seq_retiming_evaluate()` in `claculate_speed_table_from_seq()`.
This bug only affected speed transitions in sound strips.

`RetimingRangeData` also incorrectly interpreted segment type after
transition end, which would not cause issues, but was incorrect.
2024-05-10 20:20:06 +02:00
Clément Foucault
bbde7cdcb6 EEVEE-Next: Limit cost of transmission evaluation
This uses specialization constants to compile
optimized deferred lighting shader for when
transmission is not needed.
2024-05-10 20:01:22 +02:00
Clément Foucault
5b903c8624 Cleanup: EEVEE-Next: Use shadow renderpass id instead of boolean
for specialization constant. This is supported by all backends
now.
2024-05-10 19:18:30 +02:00
Jason Fielder
aa994f3cba EEVEE Next: Optimize closure light stack array access
This PR ensures the ClosureLightStack is only accessed
with constant indices. This reduces compiler spill and allows
furhter constant folding, improving the deferred lighting
evaluation performance by 30%.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/121124
2024-05-10 19:13:46 +02:00
Aras Pranckevicius
008483fe8a Cleanup: Remove non-working channels parameter of BLF_buffer
BLF_buffer was trying to accept "how many colors channels in output
image?" argument and doing math with it, but in the lowest level code
was always writing out full 4 channels for each pixel.

All the call sites would ever call it with argument of 4 however, and
that is why no one noticed the issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/121630
2024-05-10 18:54:53 +02:00
Falk David
30e3f14bcd GPv3: Remove Groups
This implements removing of groups and adds an operator
`GREASE_PENCIL_OT_layer_group_remove`.

Groups can be removed in two ways:
 * Remove the group and keep the children.
 * Remove the group together with all its children.

Based on an earlier attempt by @PratikPB2123 here: !121611

Pull Request: https://projects.blender.org/blender/blender/pulls/121663
2024-05-10 18:39:51 +02:00
Pratik Borhade
9b5f0cb8a2 GPv3: Drag & drop for layer groups
New drag type `WM_DRAG_GREASE_PENCIL_GROUP` introduced for layer group nodes.
Replaced layer struct with `GreasePencilLayerTreeNode` in `wmDragGreasePencilLayer`
so group node can be stored while dragging in `wmdrag->poin`.

Using `can_drop()`, drop operation of layer group node returns `false`
if the target node is its child.

Part of #121390.

Pull Request: https://projects.blender.org/blender/blender/pulls/121654
2024-05-10 18:18:03 +02:00
Sergey Sharybin
7b4232e8aa Compositor: Move Execution Mode and Precision from bNodeTree to Scene
This allows to expose these settings in the Performance panel in the
render buttons. Also moves compositor-specific options away from the
generic node tree structure.

For the backwards-compatibility the options are still present in the
DNA for the bNodeTree. This is to minimize the impact on the Studio
which has used the GPU compositor for a while now. They can be
removed in a future release.

There is no functional changes expected.

Pull Request: https://projects.blender.org/blender/blender/pulls/121583
2024-05-10 18:08:33 +02:00
Aras Pranckevicius
52de90d06b Cleanup: redundant namespace, naming, span instead of array ref 2024-05-10 19:07:53 +03:00
Falk David
de037ce3b5 GPv3: Add API functions for active group
This adds the functions `has_active_group` and `get_active_group`,
similar to the `has_active_layer` and `get_active_layer` ones.

Also refactors some of the code to use these new functions instead.
2024-05-10 17:57:54 +02:00
Aras Pranckevicius
a17ce1a1b4 VSE: Optimize text shadow blur / outline options
PR #121478 added options for blurred shadows and text outline for text strips.
However since text strips produce an image that is size of the "whole screen",
applying large blurs or wide outline on that is quite costly.

Make both blur and outline calculations only be performed on the text bounds
(offset and expanded as needed to take into account blur/outline width).

On Windows/VS2022/Ryzen5950X machine, with 4K VSE resolution, and text strip
that takes about 900x400 pixels on screen, applying blur 0.4 and outline 0.25,
time to render the text strip goes from 470ms down to 35ms.

Pull Request: https://projects.blender.org/blender/blender/pulls/121644
2024-05-10 17:57:20 +02:00