Commit Graph

134824 Commits

Author SHA1 Message Date
Omar Emara db13fc01ad Compositor: Unify Defocus node between CPU and GPU
This patch unifies the Defocus node between the CPU and GPU compositors.
Both nodes now use a variable sized bokeh kernel which is always odd
sized for a center pixel guarantee. Further the CPU implementation now
properly handles half pixel offsets when doing interpolation, and always
sets the threshold to zero similar to the GPU implementation.
2024-03-28 14:35:13 +02:00
Omar Emara b115557883 Fix: Compositor Defocus maximum size has no effect
The Defocus node maximum size option has no effect if Z Depth is not
enabled. That's because the code incorrectly uses the maximum CoC radius
even though it is not relevant if Z Depth is disabled. To fix this, use
the maximum size option directly in case of no Z Depth.
2024-03-28 14:11:51 +02:00
Campbell Barton 686605a6dd Cleanup: declare arrays as const where possible 2024-03-28 22:57:57 +11:00
Clément Foucault 28c53cccd3 EEVEE-Next: Split clipmap_base_offset into two int2
This avoid uneeded complexity since we have a lot of space
inside the sunlight struct.
2024-03-28 12:56:51 +01:00
Pratik Borhade b59059a518 Fix: GPv3: Crash removing all materials
This is due to wrong function used for obtaining grease pencil material.

Pull Request: https://projects.blender.org/blender/blender/pulls/119954
2024-03-28 12:48:15 +01:00
Falk David e17bb40941 UI: GPv3: Disable buttons for layer group in layer tree
We disable the button for a layers depending on the
state of the parent group. E.g. if the parent group is hidden
the layer button to toggle the visibility was disabled
to indicate that toggling it won't actually change the
visibility of the layer (since the whole group is hidden).
This wasn't the case for layer groups though and this
change fixes that.
2024-03-28 12:35:18 +01:00
Falk David 6f3e3a709f Cleanup: GPv3: Use `uiItemR` for layer rows in layer tree
This was previously ussing the more verbose `uiDefIconButR`
but for no good reason. This now uses the `uiItemR` API.
2024-03-28 12:35:18 +01:00
Omar Emara 042c50b65f Compositor: Unify Bokeh Image node between CPU and GPU
This patch unifies the CPU and GPU implementation for the Bokeh Image
node. The bokeh is now evaluated at the center of pixels and allows
different sizes for the output kernel.
2024-03-28 13:23:58 +02:00
Jeroen Bakker 1b797cc0c3 Fix: EEVEE-Next: Planar probe display depth bias
Detected when researching #119800.

Pull Request: https://projects.blender.org/blender/blender/pulls/120009
2024-03-28 12:20:13 +01:00
Jeroen Bakker aedd5f2837 EEVEE-Next: Lookdev Background Blur
This PR implements the background blurring for studiolight/lookdev HDRIs.
The visual appearance matches EEVEE-Classic closely.

**Technical details**

- LOD0 is skipped as the regular background color can be used. The
  regular background color is blended towards LOD1.
- Volume probe is mixed in to remove baked in artifacts in the higher LODs.

Pull Request: https://projects.blender.org/blender/blender/pulls/119872
2024-03-28 12:18:37 +01:00
Milan Davidović c056c58493 Fix #106641: Missing Annotation widgets
Annotation layer widget was missing on the Tool Settings bar and the
side bar for some of the editors, as well as both color and layer
widgets on the Tool tab of the Properties editor.

Also fixed the Tool Settings bar not updating when drawing annotations
on the Image editor viewport, and the Tool panel in Properties editor
not updating when drawing annotations on the 3D scene.

Pull Request: https://projects.blender.org/blender/blender/pulls/112688
2024-03-28 12:15:33 +01:00
Jeroen Bakker dc243ff06b Fix: EEVEE-Next: Crash division by zero
When no shadow views are needed Blender could signal a division by
zero. This change fixes this by safe guarding the division by zero
ensuring the there is always a view to update.
2024-03-28 11:47:21 +01:00
Sietse Brouwer 19fdec058e Fix: GPv3: Hitting an assert when changing vertex group order
Reordering vertex groups (move up/down or sort) wasn't handled yet for
GPv3, resulting in an assert in `BKE_object_defgroup_array_get()`.
This PR fixes that.

Pull Request: https://projects.blender.org/blender/blender/pulls/119979
2024-03-28 11:27:03 +01:00
Jeroen Bakker 6b2306ad71 Fix: EEVEE-Next: Incorrect Assert
When using EEVEE with asserts enabled would fail. The reason
is an incorrect assert check.
2024-03-28 11:09:04 +01:00
Campbell Barton b2e00d1285 Cleanup: use const pointer arguments 2024-03-28 20:57:50 +11:00
Campbell Barton 5685481fcb Cleanup: rename "name" to "filepath" for full paths 2024-03-28 20:57:50 +11:00
Philipp Oeser 7da9521c7c Fix #119925: Mask property keyframes missing when reload the file
Caused by 6a79a6a24a

`Mask` `AnimData` is read by `BKE_animdata_blend_read_data` since above
commit, so `BLO_read_data_address` on `AnimData` is already done there.
However, `mask_blend_read_data` does it again
Similar calls to `BLO_read_data_address` in `blend_read_data` callbacks
were usually removed in 6a79a6a24a, Masks being an exception.

Accoding to @mont29 the reason while a double remapping will fail is
because there can only be one remapping from old addresses to new ones.
Once the new address has been read, this new address cannot be used as
'key' again (it will likely map to nothing, or worse, remap to something
completely unrelated!)

Pull Request: https://projects.blender.org/blender/blender/pulls/119961
2024-03-28 10:50:14 +01:00
Campbell Barton 362d381a5a Cleanup: pass GPUStateMutable as a const reference 2024-03-28 18:10:49 +11:00
Bastien Montagne e7abad23e0 Fix #118696: Nested override libraries can cause persistent resync warning.
The root of the issue was checking against the wrong RNA type to decide
whether a collection's item resolution could use the stored ID pointers
or not, leading to always only relying on names in CollectionObjects
case, leading to a lot of false 'need resync' detections in case names
would get out of sync between liboverrides and linked reference data.

Note that this probably had no other effect than resyncing when not
needed, since actual liboverride apply and resync code would already
do the right thing here.
2024-03-28 15:36:07 +09:00
Campbell Barton b4517ca148 Cleanup: replace suspicious use of "&" with "&&"
"&" was used in some cases where "&&" is more typically used,
while "&" works when both values happen to be 1, this doesn't read well.
2024-03-28 17:26:16 +11:00
Campbell Barton 0ef033750f Cleanup: pass arguments by const reference 2024-03-28 17:16:33 +11:00
Bastien Montagne 4e650294e2 Fix #119184: Crash due to extremely broken liboverrides.
The validation code (`BKE_lib_override_library_main_validate` & co)
would not properly handle some extreme cases of data corruptions well.
2024-03-28 13:39:51 +09:00
Harley Acheson 6789a88107 UI: Open Folder of Recent Items
Add an item to the context menu when right-clicking on an item in the
"Open Recent" file list for "Open File Location" that opens that
location in an OS Explorer/Finder window.

Pull Request: https://projects.blender.org/blender/blender/pulls/119988
2024-03-28 04:37:08 +01:00
Harley Acheson 27c95da888 Refactor: Remove BLF _ex functions using default arguments
Remove all BLF "_ex" versions of functions by using default arguments.
These functions only differ by having an optional argument that can
return extra details about the result of the operation. This PR just
make these part of the main function as optional arguments with default
values - all nullptr.

Pull Request: https://projects.blender.org/blender/blender/pulls/119994
2024-03-28 04:02:13 +01:00
Campbell Barton b28861682e Fix 2D cage gizmo failing to refresh when Shift is pressed/released
Detecting when the Shift state "changed" wasn't working because
of a self-assignment.

Since cursor motion always refreshes,
this isn't an especially noticeable an issue.
2024-03-28 13:45:24 +11:00
Campbell Barton b0328f67a9 Fix invalid sizes when clearing gpu::Batch
For Batch::verts some values weren't cleared,
for Batch::inst values after the array would be cleared,
although as these were already zeroed this probably didn't cause
problems in practice.
2024-03-28 13:45:22 +11:00
Campbell Barton 115f8b0c59 Cleanup: clarify variable being iterated over, avoid shadowing 2024-03-28 13:45:20 +11:00
Hans Goudey 2d9f19c962 Cleanup: Use std::move for asset identifier construction
Pass strings by value and move their result. This gives the caller
the potential to move existing strings into the class. Moving the
std::shared_ptr should just avoid reference counting here.
2024-03-27 22:31:44 -04:00
Hans Goudey 94b985371d Cleanup: Use const in more places in mesh modifier evaluation 2024-03-27 22:25:09 -04:00
Hans Goudey b35831ad6c Mesh: Use shared cache for shrinkwrap boundary data
This is mainly to make the computation threadsafe, to allow computing
the cache on a const mesh, and also to decrease the cost of copying
meshes. Computing caches on const meshes generally makes it easier
to avoid copying meshes unnecessarily in other ways, which would be
useful for some pending fixes and cleanups to modifier evaluation.
2024-03-27 22:25:09 -04:00
Hans Goudey 278c5c9c7e Cleanup: Simplify shrinkwrap cache creation
- Use C++ Array type
- Move to blender::bke::shrinkwrap namespace
- Use edge_is_boundary instead of edge_mode in a few places
- Avoid writing to edge_mode unnecessarily
2024-03-27 22:25:09 -04:00
Hans Goudey 7c01355cad Cleanup: Use forward declaration headers in a few places 2024-03-27 22:25:08 -04:00
Hans Goudey 5d09b0d373 Cleanup: Move remaining curves editors functions to C++ namespace 2024-03-27 22:25:08 -04:00
Harley Acheson 9489173f07 Refactor: Move UI Templates and Regions into Sub-directories
Move interface_region-* files into regions/ folder, and
interface_template-* files into templates/ folder.

Pull Request: https://projects.blender.org/blender/blender/pulls/119991
2024-03-28 03:06:49 +01:00
Campbell Barton d8c69c84e3 Cleanup: correct the vector copy size in ViewOpsData::state_backup
In practice this didn't cause problems as the correct value was
written afterwards.
2024-03-28 13:01:41 +11:00
Campbell Barton a2fa743364 Cleanup: pass std::string by reference instead of value 2024-03-28 13:01:39 +11:00
Campbell Barton 8f88487768 Cleanup: pass LogImageElement by reference or pointer instead of value 2024-03-28 13:01:38 +11:00
Campbell Barton 872c997c8f Cleanup: remove redundant break & return statements 2024-03-28 13:01:37 +11:00
Campbell Barton 939e076fdc Cleanup: remove redundant assignment & null check 2024-03-28 13:01:36 +11:00
Campbell Barton 3ad1a2eb62 Cleanup: remove redundant null check 2024-03-28 13:01:34 +11:00
Campbell Barton 49dd5fae40 Cleanup: remove redundant variable & check 2024-03-28 13:01:34 +11:00
Campbell Barton 868d6eb5e8 Cleanup: quiet signed integer overflow warning from cppcheck 2024-03-28 13:01:32 +11:00
Campbell Barton 481bcc14d7 Cleanup: quiet enum conversion warning 2024-03-28 13:01:31 +11:00
Campbell Barton 618788aa7a Cleanup: remove redundant std::string / c_str conversion 2024-03-28 12:23:46 +11:00
Campbell Barton 2a892012be Render: correct buffer sizes for render cache paths
FILE_CACHE_MAX was meant to be larger than FILE_MAX to make room
for additional layers in the path. An error in the define used
`FILE_MAXFILE + FILE_MAXFILE` instead of `FILE_MAXDIR + FILE_MAXFILE`
causing the value to be smaller allowing a buffer overflow when passing
the string into BLI_path_abs.

Correct the define and call on the directory component before
the file is added so it doesn't clamp the string length unnecessarily.

Note that some values weren't correct since the original commit [0],
although [1] moved them to a shared incorrect define.

[0]: 78cdc707ab
[1]: cef1b9c30f
2024-03-28 12:12:05 +11:00
Campbell Barton db466e9578 Fix buffer overflow from passing undersized buffers to BLI_path_abs 2024-03-28 11:40:50 +11:00
Campbell Barton da49873e89 Fix buffer overflow with BLI_str_format_uint64_grouped
Caused by cd4328dd82.
2024-03-28 11:40:23 +11:00
Campbell Barton 0d3ea69daa Fix sizeof(sizeof(...)) passed to BLI_path_slash_ensure
Regression in [0] which would cause ensuring the slash to do nothing
in most cases. Note that the slash may not be needed, but that should
be handled separately.

[0]: d66f24cfe3
2024-03-28 11:40:21 +11:00
Hans Goudey c28db1f0a0 Cleanup: Use C++ namespace for object editors module
Move the public functions from the editors/object (`ED_object.hh`)
header to the `blender::ed::object` namespace, and move all of the
implementation files to the namespace too. This provides better code
completion, makes it easier to use other C++ code, removes unnecessary
redundancy and verbosity from local uses of public functions, and more
cleanly separates different modules.

See the diff in `ED_object.hh` for the main renaming changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/119947
2024-03-28 01:30:38 +01:00
Hans Goudey 35c6c11c7e Cleanup: Make format 2024-03-27 20:20:07 -04:00