Commit Graph

106780 Commits

Author SHA1 Message Date
Campbell Barton
cdc17751ae Cleanup: format 2024-02-14 13:53:36 +11:00
Campbell Barton
1111dff0a6 Tests: improvements to BLI_convexhull_2d_test
The convex hull tests included a reference AABB-fitting function for
comparison which was used to validate the optimized implementation.
This wasn't great as it depended on matching exact return values and
didn't test the logic of AABB-fitting worked usefully.

Replace this with a more general test that creates random polygons with
known bounds, apply a random rotation & translation, then use
AABB-fitting to un-rotate the points, passing when the bounds are no
larger than the size of the generated input.

Details:

- Make BLI_convexhull_aabb_fit_hull_2d a static function again as it was
  only exposed for tests. Use BLI_convexhull_aabb_fit_points_2d instead.
- Remove brute force reference implementation from tests,
  moving this to an assertion within convexhull_2d
  (disabled by default since it's quite slow).
2024-02-14 13:42:14 +11:00
Campbell Barton
3f8cd44485 Cleanup: move BLI_strict_flags.h last, not that it should be kept last
Also add a note in the header why it should be kept last.
2024-02-14 13:40:31 +11:00
Germano Cavalcante
e6e4e6c287 Optimization: avoid calculating the contraint plane when transforming
In most cases, we only need the normal of the plane.

It's a micro-optimization, the difference is very subtle.
2024-02-13 21:21:48 -03:00
Germano Cavalcante
1a74b80d42 Refactor: replace 'isect_ray_plane_v3' with 'isect_ray_plane_v3_factor'
By using `isect_ray_plane_v3_factor` we avoid calculating the v4 plane.
2024-02-13 21:08:49 -03:00
Germano Cavalcante
c9bd326255 Merge branch 'blender-v4.1-release' 2024-02-13 20:35:52 -03:00
Germano Cavalcante
c6e229d3e4 Fix #118221: Snap to Edge with Constraint Plane shifts out of plane
The intersection needs to be calculated with the plane passing through
the snap pivot.
2024-02-13 20:35:08 -03:00
Hans Goudey
5ba6f6d833 Cleanup: Replace typedef keyword in C++ headers 2024-02-13 15:34:32 -05:00
Hans Goudey
7b77c2ebd4 Cleanup: Remove unused 3D view function declaration 2024-02-13 15:00:01 -05:00
Miguel Pozo
2a2effc0c2 Workbench: Share shader cache across instances
Improve instance creation performance by sharing compiled shaders
across instances. (See #114990)

Pull Request: https://projects.blender.org/blender/blender/pulls/118062
2024-02-13 20:56:54 +01:00
Harley Acheson
8fee7c5fc7 UI: Line Under Title for Properties Dialogs
When a popup dialog includes properties, add a line under the title.

Pull Request: https://projects.blender.org/blender/blender/pulls/118051
2024-02-13 20:37:45 +01:00
Hans Goudey
9cf304160b BLI: Add missing overrides to some generic virtual array implementations
The lack of these functions in the "single trivial value" and "sliced
GVArray" implementations caused some code to call fack to the base
class functions. Those are much slower since they involve a virtual
function call per element. For example, this changed the runtime of
creating a new boolean attribute set to "true" on one million faces
from 3.4 ms to 0.35 ms.

Pull Request: https://projects.blender.org/blender/blender/pulls/118161
2024-02-13 19:59:58 +01:00
Clément Foucault
88228a84d1 Fix: EEVEE-Next: Another uninitialized variable in volume probe loading
The spherical_harmonics_triple_product was not working as
expected and produced NaNs.

Cleanup to avoid more confusion.
2024-02-13 19:05:15 +01:00
Clément Foucault
13f0d7bd47 Fix: EEVEE-Next: Uninitialized variable in volume probe loading
The spherical_harmonics_triple_product was not working as
expected and produced NaNs.
2024-02-13 18:59:53 +01:00
Clément Foucault
65d42af3e3 Fix: EEVEE-Next: Broken light capture on emission only materials
This was cause by uninitialized fragment output.
2024-02-13 18:59:53 +01:00
Clément Foucault
6802d87329 EEVEE-Next: Remove DeferredProbeLayer intermediate class
This class is redundant as it is never instanced more
than once.
2024-02-13 18:59:53 +01:00
Clément Foucault
ba6e6e96ed EEVEE-Next: Move ray type change out of view loop
Avoid needlessly pushing the uniform_data to the GPU.
2024-02-13 18:59:53 +01:00
Clément Foucault
0bab7b59a1 EEVEE-Next: Use same GBuffer binding logic for every pipeline 2024-02-13 18:59:53 +01:00
Hans Goudey
1cfe9dd08c Geometry Nodes: Matrix socket type, attribute type, and initial nodes
Implements the design from #116067.
The socket type is called "Matrix" but it is often referred to as "Transform"
when that's what it is semantically. The attribute type is "4x4 Matrix" since
that's a lower level choice. Currently matrix sockets are always passed
around internally as `float4x4`, but that can be optimized in the future
when smaller types would give the same behavior.

A new "Matrix" utilities category has the following set of initial nodes"
- **Combine Transform**
- **Separate Transform**
- **Multiply Matrices**
- **Transform Direction**
- **Transform Vector**
- **Invert Matrix**
- **Transpose Matrix**

The nodes and socket type are behind an experimental flag for now,
which will give us time to make sure it's the right set of initial nodes.
The viewer node overlay doesn't support matrices-- they aren't supported
for rendering in general. They also aren't supported in the modifier interface
currently. But they are supported in the spreadsheet, where the value is
displayed in a tooltip.

Pull Request: https://projects.blender.org/blender/blender/pulls/116166
2024-02-13 18:59:36 +01:00
Hans Goudey
21cea65ea6 WM: Add runtime struct
Currently most of the data stored in `wmWindowManager` is runtime
data not saved to files. It's confusing that it's declared in DNA then. That
also prevents us from using C++ features. This commit adds an initial
runtime struct. Moving data there can be done as a separate step.
Initially I wanted to look at moving the `ReportList` system to C++.

The runtime struct has to be defined in the blenkernel module because
the members are (will be) used there in a few places.

Pull Request: https://projects.blender.org/blender/blender/pulls/118157
2024-02-13 17:45:05 +01:00
Omar Emara
8b46fdeab8 Fix: Translate node crashes for single inputs
The Translate node crashed for single inputs in the Full Frame
compositor, that's because it always assumed image inputs. So fix this
by handling the single value case.
2024-02-13 17:45:28 +02:00
Miguel Pozo
9fb17c1ca4 Workbench: Skip per-sample sync in image renders
Use the same method as viewport image renders.
2024-02-13 16:31:06 +01:00
Clément Foucault
778945a2cd Fix: EEVEE-Next: NaN in surfel lighting with area lights
This fix broken lighting in volume probe baking if
any area light is present in the scene.
2024-02-13 16:29:06 +01:00
Bastien Montagne
5baef63a20 BKE ID remap: Refactor: Remove C API around CPP IDRemapper.
The ID remapper code was already largely defined in a CPP struct
(IDRemapper). Make this an actual class, and remove the C API wrapper
around.

This makes the code cleaner, easier to follow, and easier to extend or
modify in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/118146
2024-02-13 15:36:38 +01:00
Raul Fernandez
d284941e89 Fix #99172: Sculpt Paint Tool: Strength doesn't use unified paint settings.
Previously in the function brush_strenght , the SCULPT_TOOL_PAINT case didn't took into account the unified strength parameter.

Pull Request: https://projects.blender.org/blender/blender/pulls/118109
2024-02-13 15:22:00 +01:00
Germano Cavalcante
1dd163c2f7 Fix: build error with 'WITH_CXX_GUARDEDALLOC' 2024-02-13 10:59:56 -03:00
Campbell Barton
2119d271e0 Cleanup: remove "-noaudio" argument in background mode
This is no longer needed as background mode implies -noaudio.
2024-02-14 00:13:38 +11:00
Campbell Barton
7c90018f23 CLI: make "-noaudio" implicit with "-b/--background"
Running background mode now behaves as if the "-noaudio" was passed in.

The -setaudio command now has a "Default" option which can be used
in the rare cases audio playback is desired in background mode. e.g.

  blender --background -setaudio Default

Ref !118192
2024-02-14 00:13:37 +11:00
Pratik Borhade
2b02d6c1e2 GPv3: Include hide/reveal operators in layer menu
Similar to gpv2 layer panel, add these operators in gpv3 layer popup
menu.

Pull Request: https://projects.blender.org/blender/blender/pulls/118199
2024-02-13 13:48:36 +01:00
Omar Emara
749768db5b Merge branch 'blender-v4.1-release' 2024-02-13 14:34:13 +02:00
Omar Emara
0c9df3d470 Fix: Image does not update when file path changes
Images do not update in the compositor and other places when their file
path changes or their generated options change. This is because the
compositor relies on depsgraph updates, which weren't tagged in this
case. Fix this by tagging appropriately in RNA.

Pull Request: https://projects.blender.org/blender/blender/pulls/118187
2024-02-13 13:31:49 +01:00
Philipp Oeser
cb37fe751b Fix #118184: crash deleting a material output node
Caused by 7e8fd2cc2c

Code added in above commit didnt take into account that we might have no
output node in the tree.

Pull Request: https://projects.blender.org/blender/blender/pulls/118202
2024-02-13 13:07:27 +01:00
Bastien Montagne
d2fbfe0ec0 Merge branch 'blender-v4.1-release' 2024-02-13 12:57:50 +01:00
Bastien Montagne
711e4cdd94 Fix #118055: libOverride resync() RNA call crashes when view_layer is not specified.
Underlying `lib_override_library_resync` code lost the optional aspect
of its `view_layer` parameter at some point, trivial to restore it
luckily.
2024-02-13 12:48:50 +01:00
Bastien Montagne
d38824bc02 Fix #108407: Crash on deleting shape key from Blender File view.
`BKE_library_id_can_use_filter_id` was missing the ShapeKey type for
geometry IDs (meshes, legacy curves, and lattices), leading to the
remapping code to fail to do its job when deleting the ShapeKey only.
2024-02-13 12:34:09 +01:00
Jacques Lucke
cd0e41c73e BLI: improve printing of IndexMask
The new printed format is like this: `(Size: 503 | 0-499, 555, 699, 900)`.
2024-02-13 12:33:48 +01:00
Jacques Lucke
bce1edc2bd BLI: add IndexMask.shift method 2024-02-13 12:33:48 +01:00
Jacques Lucke
9a5de97c4c BLI: rename slice_and_offset to slice_and_shift on IndexMask 2024-02-13 12:33:48 +01:00
Falk David
2f42782fa8 Fix: GPv3: Memory leak after conversion
The `LayerMask` structs were allocated with just using `new`.
They should use the guarded allocator. This
fixes a memory leak reported by ASAN.
2024-02-13 12:20:37 +01:00
Sietse Brouwer
2f0b293da3 GPv3: Add function to retrieve falloff factor for multi frame editing
This PR prepares GPv3 for calculating falloff factors when working in  multi frame editing mode.

The falloff popover is added to the UI.
A `float multi_frame_falloff` is added to `MutableDrawingInfo`. This is a factor from 0.0 to 1.0f.
A `retrieve_editable_drawings_with_falloff()` is added to the utility functions, which retrieves the falloff factor for each drawing when
multi frame falloff is enabled.

To avoid a copy, the return type of  `retrieve_editable_drawings()` and friends is changed from
`Array<MutableDrawingInfo>` to `Vector<MutableDrawingInfo>`.

Pull Request: https://projects.blender.org/blender/blender/pulls/118108
2024-02-13 12:04:45 +01:00
Campbell Barton
888c4d0766 BLI_convexhull_2d: optimize AABB fitting method
Previously the bounding box was calculated for each rotation,
even though the loop would early exit if the area exceeded the best
known area, this meant the areas of the bounds was checked for
each point too. This scaled poorly, close to O(n^2).

Replace this with simple logic that keeps track of the indices
at the bounds, advancing them forward for each rotation.

This is around ~140x faster for a hull with 10k points on my system.

Note that there is potential for other improvements although
the cases where this new method doesn't perform well are quite specific
and faster than checking all points, see code-comments for details.
2024-02-13 21:29:46 +11:00
Sybren A. Stüvel
ff4a473ad4 RNA: update property flag descriptions
Add new descriptions to the `PROP_HIDDEN`, `PROP_SKIP_SAVE`, and
`PROP_LIB_EXCEPTION` flags. For the former two, these are more
explanatory than the previous descriptions. For the latter it's the
first ever description.

Personally I don't think "Do not use ghost values" was particularly
helpful, as the concept of "ghost values" isn't actually that well known
(compared to generally how many people use `bpy`). Granted, it's
described at [1], but IMO if the term "ghost values" is to be kept here,
it should include a link to that page.

[1]: https://docs.blender.org/api/current/bpy.types.bpy_struct.html

Pull Request: https://projects.blender.org/blender/blender/pulls/118036
2024-02-13 11:14:48 +01:00
Sybren A. Stüvel
f85538a56b RNA: unify property flag descriptions between enum and non-enum flags
These flags (like `'HIDDEN', 'SKIP_SAVE', etc.) mean the same thing when
used on enums and non-enum properties. Now they actually use the same
description definition in the source code, ensuring that any
improvements will apply to both.

No changes to the actual messages. Just using them for both enums and
non-enum property flags.

Pull Request: https://projects.blender.org/blender/blender/pulls/118036
2024-02-13 11:14:39 +01:00
Christoph Lendenfeld
7fddad529e Fix: keyframe values with additive NLA stack
The new keyframing functions introduced in #113504
didn't call the functions to decompose the NLA stack.

In practice this meant that when inserting keys into strip
that is under an additive strip, it would take the result of the additive Strip and
bake it back into the base. This would double the transform.

The fix is to call `BKE_animsys_nla_remap_keyframe_values`.
Unfortunately to do so, I had to pass through a few more
arguments to the keyframing functions.

Also adds unit tests to cover the caused bug.

Pull Request: https://projects.blender.org/blender/blender/pulls/118053
2024-02-13 11:10:18 +01:00
Campbell Barton
0e4f9104bc Cleanup: unused includes in source/blender/gpencil_modifiers_legacy
Remove 159 includes.
2024-02-13 19:59:14 +11:00
Campbell Barton
866974ae56 Cleanup: unused includes in source/blender/animrig
Remove 13 includes.
2024-02-13 19:21:03 +11:00
Campbell Barton
38023283ac Cleanup: unused includes in source/blender/bmesh
Remove 26 includes.
2024-02-13 19:21:03 +11:00
Campbell Barton
e6cb2ca380 Cleanup: unused includes in source/blender/compositor
Remove 5 inclues.
2024-02-13 19:21:03 +11:00
Campbell Barton
0933e21750 Cleanup: unused includes in source/blender/geometry
Remove 13 includes.
2024-02-13 19:21:03 +11:00
Campbell Barton
976c56e69c Cleanup: unused includes in source/blender/render
Remove 37 includes.
2024-02-13 19:20:59 +11:00