Commit Graph

108987 Commits

Author SHA1 Message Date
Christoph Lendenfeld
08de3fa0b6 Anim: extract constant variables out of sorting loop
No functional changes expected.

This PR extracts the `IndexRange` of the `BeztMap` span and its `size()` call out
of the sorting loop. Doing this removes one `if` condition within the loop and gives a
small performance boost.
(Before: 0.93ms, After: 0.65ms average run of `sort_time_beztmaps`)

Pull Request: https://projects.blender.org/blender/blender/pulls/121267
2024-04-30 15:14:49 +02:00
Hans Goudey
a83e695c0a Cleanup: Use utility for safe division 2024-04-30 09:08:46 -04:00
Hans Goudey
ca924bf247 Fix #121217: Mouse position node size sockets ignore UI scale
Use winrct instead of sizex/y as recommended by its docstring.
The winrct accounts for UI scale, just like event->mval.
2024-04-30 08:55:47 -04:00
Christoph Lendenfeld
1cf193336a Refactor: Rename enum entries of BakeCurveRemove
No functional changes.

The enum entries of `BakeCurveRemove` used to
start with `REMOVE` which just doubled that word.

Removing that simplifies the enum entries.

This has been brought up by @dr.sybren in #120984

Pull Request: https://projects.blender.org/blender/blender/pulls/121258
2024-04-30 14:40:26 +02:00
Aaron Carlisle
f5157b00a9 Compositor: Remove left over code from tile based compositor
The compositor used to have a feature that would calculate tiles for the viewer based on a custom order. Since the removal of the tile based compositor, this code is unused.

Pull Request: https://projects.blender.org/blender/blender/pulls/121176
2024-04-30 13:47:45 +02:00
Falk David
5ebce2c72c Fix: GPv3: Division by zero for single point curves
Makes sure to map curves with a single point to 0.0f in the
custom curve mapping.
2024-04-30 13:17:36 +02:00
Christoph Lendenfeld
33c6e9f92c Refactor: move FCurve baking code to animrig
No functional changes.

This PR moves the following public functions to animrig:
* sample_fcurve_segment
* bake_fcurve
* bake_fcurve_segments

The `bake_fcurve_segments` also gets a docstring and its comments have been
updated to follow the style guide.

Pull Request: https://projects.blender.org/blender/blender/pulls/120984
2024-04-30 12:22:47 +02:00
Nathan Vegdahl
f099977923 Fix: add missing nullptr check in BKE_fcurve_find_by_rna_context_ui
The guard clauses elsewhere in the function clearly indicate that
`r_driven` should be passable as a nullptr if the caller doesn't need
it, but there is one place where the guard clause was missing.

Discovered while working on #120936.

Pull Request: https://projects.blender.org/blender/blender/pulls/121253
2024-04-30 12:05:20 +02:00
Pratik Borhade
3b0c23a1f2 GPv3: Wrong onion skinning icon in the dopesheet
`PROP_ICONS_CONSECUTIVE` is set for `use_onion_skinning` property with the
help of `RNA_def_property_ui_icon`. In this case, `but->iconadd` will
handle the other icon for "toggle" button types. So just use
`ICON_ONIONSKIN_OFF` when drawing the onion skinning button in dopesheet.

Resolves #121232

Pull Request: https://projects.blender.org/blender/blender/pulls/121254
2024-04-30 11:50:37 +02:00
Jacques Lucke
d550db1288 Cleanup: correct function name 2024-04-30 11:14:40 +02:00
Jason Fielder
7114c44c9b Fix #121020: Fix curve index buffer generation with Triangle prim
Resolves offset error when building index buffers on device for
cuves/hair strips using Triangles instead of TriangleStrips.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/121218
2024-04-30 10:49:09 +02:00
Christoph Lendenfeld
c6c7d3d8c4 Anim: Graph Editor - use Map to update TransInfo pointers instead of searching
This is a performance improvement when moving a bunch
of keys on the same `FCurve` in heavy scenes.

When moving keys in such a way that the `BezTriple` array of the FCurve
has to be sorted, the pointers of `TransInfo` also have to be  updated.
This used to happen by doing a nested loop over all `BeztMap` and all `TransData2D`.
There was a bit of optimization with the
`blender::Vector<bool> adjusted` which stored if a `TransData2D` has been fixed yet.
But in general the complexity was still `BeztMap.size() * TransData.size()`.

There are two optimizations that can be done here.
* Skip any BeztMap if `old_index == new_index`.
If the Key is not going to move any pointers to it will still be valid.
* Use a `Map<float *, int>` built beforehand to quickly get
the `TransData2D` that needs updating instead of searching.
The `int` in this case is the index to the `TransData2D` array.

Doing this reduces the complexity to `BeztMap.size() + TransData.size()`.

Measurements of `beztmap_to_data`
| - | Before | After |
| - | - | - |
| Moving 1 key of 1 FCurve | ~24000 ns | ~5800ns |
| Moving ~1000 keys of 1 FCurve | 17ms | 0.02ms |

Measurements of `remake_graph_transdata`
| - | Before | After |
| - | - | - |
| Moving 1 key of 279 FCurves | 290ms | 22ms |
| Moving ~300 keys of 279 FCurves | 82 **SECONDS** | 80ms |

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

The deeper technical explanation.
`TransInfo` has an array of `TransData`.
`TransData` has pointers to the float arrays of a `BezTriple`.
The `BezTriple` array is sorted by swapping data,
meaning the `TransData` will now point to the wrong data in the array.
This has to be updated and we can do that by using the `BeztMap`.
This is all under the assumption that `BeztMap` is sorted in the exact
same way as `BezTriple` otherwise this method will fail.
But by doing it the same way, we can know at which
index the `BezTriple` is before and after sorting.
Now we just need to find the corresponding `TransData`.
That can be done by comparing pointers. The `BeztMap` stores the
`BezTriple` it represents and from it we can
get the pointers to its `vec` 0, 1 and 2. (key and handles)

Pull Request: https://projects.blender.org/blender/blender/pulls/120816
2024-04-30 10:46:48 +02:00
Jeroen Bakker
3d3dfb6518 Fix #120273: GPU: UHD630 on Windows reports buggy extension
On windows the OpenGL backend of the UHD630 driver (but could also be other
GPUs that use the same driver) reports of supporting `GL_ARB_multi_bind`.
But when enabling it can result in incorrect bindings and report errors
about unsupported internal texture formats. These are internal driver issues.

Might also fix #107642 as it shows the same error message. EEVEE-Next
relies more on using the same binding slot for the same texture in order
to reduce actual bindings which makes this more prominent.

Pull Request: https://projects.blender.org/blender/blender/pulls/121062
2024-04-30 10:38:07 +02:00
Jacques Lucke
176c6ef329 Geometry Nodes: unify menu switch with other nodes with dynamic sockets
This changes the menu switch socket to use the socket-items system
(`NOD_socket_items.hh`) that is already used by the simulation zone, repeat
zone, bake node and index switch node. By using this system, the per-node
boilerplate can be removed significantly. This is especially important as we
plan to have dynamic socket amounts in more nodes in the future.

There are some user visible changes which make the node more consistent with
others:
* Move the menu items list into the properties panel as in 0c585a1b8a.
* Add an extend socket.
* Duplicating a menu item keeps the name of the old one.

There is also a (backward compatible) change in the Python API: It's now
possible to directly access `node.enum_items` and `node.active_index` instead of
having to use `node.enum_definition.enum_items`. This is consistent with the
other nodes. For backward compatibility, `node.enum_definition` still exists,
but simply returns the node itself.

Many API functions from `NodeEnumDefinition` like
`NodeEnumDefinition::remove_item` have been removed. Those are not used anymore
and are unnecessary boilerplate. If ever necessary, they can be implemented back
in terms of the socket-items system.

The socket-items system had to be extended a little bit to support the case for
the menu switch node where each socket item has a name but no type. Previously,
there was the case without name and type in the index switch node, and the case
with both in the bake node and zones. The system was trivial to extend to this
case.

Pull Request: https://projects.blender.org/blender/blender/pulls/121234
2024-04-30 10:19:32 +02:00
Christoph Lendenfeld
5ba5fc8962 Anim: make Keyframing error messages translateable
This fixes an issue with the error messages that keying
can produce where they couldn't be translated.

To make translation possible, two things changed:
* use of `RPT_`
* simplified string formatting

Pull Request: https://projects.blender.org/blender/blender/pulls/121112
2024-04-30 09:59:51 +02:00
Aras Pranckevicius
0a911b42c6 Fix #121190: VSE AlphaUnder with opacity=1 does not work properly
Accidental logic change in PR #116089, restore previous behavior

Pull Request: https://projects.blender.org/blender/blender/pulls/121224
2024-04-30 08:32:25 +02:00
Campbell Barton
d06c34b2e5 Cleanup: note that XDG_* environment variables can't be relied on
This assumption caused #121241.

Also correct `endif` comment.
2024-04-30 15:02:29 +10:00
Campbell Barton
da4b81e980 Cleanup: move doc-strings into headers 2024-04-30 12:52:52 +10:00
Campbell Barton
9ee0912d1c Cleanup: pass a const Lattice to BKE_lattice_* functions
Also match arguments between function & declaration.
2024-04-30 12:13:25 +10:00
Campbell Barton
734a312004 Cleanup: remove unused argument 2024-04-30 12:13:23 +10:00
Campbell Barton
b93ddf30e9 Unbreak build WITH_TBB=OFF 2024-04-30 12:12:02 +10:00
Hans Goudey
2ac6321e88 Refactor: Remove corner triangle faces from PBVH storage
Part of an effort to reduce redundancy of storage for data used
by sculpt mode. See #118145.

Pull Request: https://projects.blender.org/blender/blender/pulls/121238
2024-04-30 04:02:59 +02:00
Hans Goudey
75e424563c Refactor: Remove vert to face map from PBVH storage
Part of an effort to reduce redundancy of storage for data used
by sculpt mode. See #118145.
2024-04-30 04:02:57 +02:00
Jacques Lucke
8d13a9608b BLI: generalize task size hints for parallel_for
This integrates the functionality for `parallel_for_weighted` from 9a3ceb79de
into `parallel_for`. This reduces the number of entry points to the threading
API and also makes it easier to build higher level threading primitives. For
example, `IndexMask.foreach_*` may use `parallel_for` if a `GrainSize` is
provided, but can't use `parallel_for_weighted` easily without duplicating a
fair amount of code.

The default behavior of `parallel_for` does not change. However, now one can
optionally pass in `TaskSizeHints` as the last parameter. This can be used to
specify the size of individual tasks relative to each other and relative to the
grain size. This helps scheduling more equally sized tasks which generally
improves performance because threads are used more effectively.

One generally does not construct `TaskSizeHints` manually, but calls either
`threading::individual_task_sizes` or `threading::accumulated_task_sizes`. Both
allow specifying individual task sizes, but the latter should be used when the
combined size of consecutive tasks can be computed in O(1) time. This allows
splitting up the work more efficiently. It can often be used in conjunction with
`OffsetIndices`.

Pull Request: https://projects.blender.org/blender/blender/pulls/121127
2024-04-29 23:55:22 +02:00
Jacques Lucke
d588bfdb5e Geometry Nodes: improve naming and code deduplication
On this level it makes sense to have a single `add_item` function
because the operator does not take any parameters. It's also
mostly the same for different kinds of socket items except
for one line.
2024-04-29 22:45:16 +02:00
Jacques Lucke
6bd1d5de54 Fix: assert when removing element from empty array 2024-04-29 22:45:15 +02:00
Hans Goudey
76a151b9d6 Refactor: Store PBVH in unique_ptr
This requires adding a destructor and deleting move and copy assignment
for SculptSession, because (for now at least) we want to keep the PBVH
as an opaque type (though with one exception for including pbvh_intern.hh
in paint.cc for the SculptSession destructor).

Pull Request: https://projects.blender.org/blender/blender/pulls/121227
2024-04-29 22:21:24 +02:00
Hans Goudey
7c56e16e44 Cleanup: Use references for sculpt PBVH variables 2024-04-29 22:21:23 +02:00
Jacques Lucke
9c153a58c0 Fix: missing null check 2024-04-29 22:15:31 +02:00
Jesse Yurkovich
ff8261ff6a USD: Small wording and layout changes for custom properties options
Make the recently added option descriptions a bit more consistent with
each other.

Small layout change to not have so much spacing between the 2 related
export options and move them under the existing options.

Pull Request: https://projects.blender.org/blender/blender/pulls/121198
2024-04-29 21:56:32 +02:00
Jacques Lucke
0c585a1b8a Geometry Nodes: move socket items ui and operators from Python to C++
This has some benefits:
* Nodes with dynamic socket amounts can remain more self-contained
  (2 fewer files to edit with this patch).
* It's easier to reuse existing C++ code, reducing redundancy.

One new thing I'm doing here is to define operators in node files. It seems
reasonable to register operators that belong to a node together with that
node. Without this, code spreads out further than necessary without any real benefit.

This patch affects the simulation zone, repeat zone, bake node and index switch node.

The UI is slightly affected too. Since we had the UI defined in Python before,
it wasn't possible to integrate it into the node properties panel. That is possible
now and looks better anyway. The previous UI was an artifact of technical limitations.

Pull Request: https://projects.blender.org/blender/blender/pulls/121178
2024-04-29 19:50:11 +02:00
Aras Pranckevicius
3847cf4dc1 VSE: Revert strip text color to white
PR #118581 changed strip text color to be the same as active strip
theme outline, which been widely regarded as a bad move. Revert
text color to white just like it was before.
2024-04-29 20:45:34 +03:00
Nathan Vegdahl
bd3518946e Anim: implement "Copy Driver to Selected" operator
This allows the user to copy the driver(s) of a property to other selected items (e.g. objects, nodes, etc.) via the right-click menu.  The implementation is based on the "Copy to Selected" operator, and generally behaves the same except for copying drivers instead of values.

Resolves #120518
2024-04-29 18:34:57 +02:00
Clément Foucault
760a641023 EEVEE-Next: Remove slope and quantization biases
This avoid self intersection during tracing which expect
unbiased depth. We compensate by adding a 1.5 shadow pixel
offset in the normal direction which is enough to fix
most remaining self shadowing. But another bias parameter
will likely need to be added anyway.

Fixes #121194
2024-04-29 17:05:07 +02:00
Clément Foucault
387df16755 Fix: EEVEE-Next: Missing factor for PCF radius size
Oversight inside #121167
2024-04-29 17:05:07 +02:00
Hans Goudey
a63e32fabf Fix #121187: Sculpt dynamic topology crash with empty mesh
Mistake in b3aca5b28f. Some sculpt PBVH code has null checks
so I must have assumed a null PBVH was an expected situation. It turns
out those null checks are very inconsistent. We would probably be better
off removing them and ensuring the PBVH always exists.
2024-04-29 10:57:00 -04:00
Hans Goudey
d97f4493dc Cleanup: Remove unnecessary template specification in Color class
This gave a very noisy warning in GCC 14.
2024-04-29 10:57:00 -04:00
Bastien Montagne
9e94ff0d2d Fix (unreported) broken wavefront IO test in debug builds.
`face_verts` parameter of `fixup_invalid_face()` was shadowed by a local
variable, leading to asserting on the wrong data.
2024-04-29 16:54:14 +02:00
Pablo Vazquez
6d435570de UI: Add missing icon to Move to Bone Collection
Add the "plus" icon to the "New Bone Collection" operator,
and the separator line before the list of bone collections.

It now matches the object's "Move to Collection" operator, and
Grease Pencil's "Move to Layer" operator.
2024-04-29 15:22:37 +02:00
Clément Foucault
e401d996aa Fix: EEVEE-Next: Wrong LOD tagging for punctual shadow maps
The root issue is that `shadow_punctual_footprint_ratio` was not
fed with Z distance but by radial distances to camera and
light.

This commit cleans up this computation by only precomputing the
film pixel radius on CPU. This allow the LOD computation to be
more local and easier to read.

Fix #119725

Pull Request: https://projects.blender.org/blender/blender/pulls/121167
2024-04-29 15:19:49 +02:00
Bastien Montagne
9041eef0b8 Cleanup: Remove unused variable. 2024-04-29 14:49:50 +02:00
Bartosz Kosiorek
d655e63044 UI: Add tooltips with description of compositing nodes
As already existed for shader and geometry nodes.

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/121038
2024-04-29 14:48:43 +02:00
Hans Goudey
205683477f Fix #121209: Menu switch missing matrix socket 2024-04-29 08:36:25 -04:00
Omar Emara
0eacf3cfef Cleanup: Clarify variable names in Fast Gaussian 2024-04-29 15:15:37 +03:00
Sean Kim
55fc1066ac Sculpt: Polyline hide operator
This PR adds a polyline hide operator for sculpt mode as well as the
necessary generic callback code to allow using this gesture in other
selection tools.

Added features include:
* *Polyline Hide* operator
* `WM_gesture_polyline_*` callback functions for other operators
* Status bar text while using the polyline modal
* Common *Gesture Polyline* keymap for usage with the modal

Unlike the *Box Hide* and *Lasso Hide* operators, the *Polyline Hide*
operator does not provide a simple shortcut to click and show all
hidden elements in a mesh. This is because the existing operators
operate on a click-drag action while the new operator is invoked by
just a click.

Design Task: #119353

Pull Request: https://projects.blender.org/blender/blender/pulls/119483
2024-04-29 14:04:16 +02:00
Omar Emara
3d2a2a9bd2 Cleanup: Remove unused FastGaussianBlurValueOperation 2024-04-29 14:52:18 +03:00
Pratik Borhade
69ae834ce8 Cleanup: Use existing function to check region-space types
Use existing function `screen_animation_region_supports_time_follow` in
`areas_do_frame_follow` to check region-space types in case of: follow current
frame is enabled and playback is moved with arrow keys

Noticed this while checking #110620

Pull Request: https://projects.blender.org/blender/blender/pulls/120056
2024-04-29 13:26:22 +02:00
Brecht Van Lommel
d174d63866 Cleanup: make format 2024-04-29 12:43:09 +02:00
David Murmann
ee51f643b0 Cycles: Ray Portal BSDF
Transport rays that enter to another location in the scene, with
specified ray position and normal. This may be used to render portals
for visual effects, and other production rendering tricks.

This acts much like a Transparent BSDF. Render passes are passed
through, and this is affected by light path max transparent bounces.

Pull Request: https://projects.blender.org/blender/blender/pulls/114386
2024-04-29 12:37:51 +02:00
Bastien Montagne
12f0f56350 Fix clang warning: a class with a final destructor should also be final. 2024-04-29 12:20:10 +02:00