Commit Graph

109034 Commits

Author SHA1 Message Date
Hans Goudey
c549c1b29c Brush: Add Main argument to BKE_paint_ensure
This is used by the brush assets branch. Though it is unused currently, the
argument is added now to reduce the trivial boilerplate changes in the diff.
2024-05-01 11:49:48 -04:00
Hans Goudey
722ad638c5 UI: Add optional icon argument to search visit params
Allows adding an icon to some search items, similar to what is done
manually for property search. Used for asset catalog search in the
brush assets branch, but more widely useful too.
2024-05-01 11:49:48 -04:00
Clément Foucault
9ff39b5fe9 Cleanup: EEVEE-Next: Fix warning and naming style 2024-05-01 17:45:15 +02:00
Harley Acheson
529b8786f8 UI: Custom Text and Confirmation Button Text for Props Confirm
For operators that use WM_operator_props_popup_confirm allow custom
title and confirmation button text.

Pull Request: https://projects.blender.org/blender/blender/pulls/121287
2024-05-01 16:29:19 +02:00
Clément Foucault
ab30784076 EEVEE-Next: Implement spherical harmonic deringing
This avoids negative color darkening caused by strong
directionnal lighting.

However, this reduce the contrast a lot since the
deringing is done on the unclampped spherical harmonics
which is itself extracted from unclamped values from
the world.

The solution to this is to add the parameter for
clamping the world light. This setting will be
reused for #68478.

Fix #116036

Pull Request: https://projects.blender.org/blender/blender/pulls/121303
2024-05-01 16:18:51 +02:00
Clément Foucault
3f1dbf2843 Fix: EEVEE-Next: Thickness versionning affecting startup.blend
This limits the thickness node addition to material using
screen space refraction.
2024-05-01 16:18:35 +02:00
Nathan Vegdahl
3b3364faf9 Fix: add missing depsgraph tag for anim Strip keyframe Python API
This caused a weird situation where after keys were inserted, the
animation of the affected object(s) wouldn't actually change in
the 3D viewport (even with scrubbing) until the keys were touched
in one of the animation editors.

Pull Request: https://projects.blender.org/blender/blender/pulls/121302
2024-05-01 16:08:20 +02:00
Iliya Katueshenock
5fa98aa0fd Cleanup: Camel case for node size enum items
Pull Request: https://projects.blender.org/blender/blender/pulls/121297
2024-05-01 15:27:34 +02:00
Pratik Borhade
a42e2a5a29 GPv3: Mask toggle in dopesheet channel
Add `use_mask` property in dopesheet layer channel.
Also add an icon to the `use_mask` property.

Pull Request: https://projects.blender.org/blender/blender/pulls/121259
2024-05-01 15:10:22 +02:00
Laurynas Duburas
d7b72b4979 Fix: Missing topology update setting curves handle type
If both segment handles are `Vector`, changing their type only changes
handle behavior, but doesn't add curvature to the segment. For `Vector`
segments only one step is designated in the evaluated offsets cache,
so  `all_bezier_offsets` has to be recalculated. As an optimization,
it would be possible to track if there was any `Vector` handle and
rebuild topology only when it is needed.

Pull Request: https://projects.blender.org/blender/blender/pulls/121292
2024-05-01 14:48:52 +02:00
Pratik Borhade
3c336c82cc Fix #121248: Crash executing node tool operator without active node
Calling `NODE_OT_select_same_type_step` when no node is active triggers
the crash.

Pull Request: https://projects.blender.org/blender/blender/pulls/121252
2024-05-01 14:48:12 +02:00
Clément Foucault
ff15d31bc1 EEVEE-Next: Forgot version bump
Sorry.
2024-05-01 14:47:18 +02:00
Clément Foucault
826d2ed4ec EEVEE-Next: Move shadow resolution scale to the sampling panel 2024-05-01 14:45:51 +02:00
Clément Foucault
b4be13ad8a EEVEE-Next: Clamp shadow_resolution_scale to 1
Scaling up the resolution is currently ill defined for
sun shadows. This might be reintroduced when #121293 lands.
Fix #121196
2024-05-01 14:44:30 +02:00
Habib Gahbiche
483c854612 Compositor: implement interpolation methods for Translate node
Compositor: Expose interpolation methods Nearest, Bilinear and Bicubic to the user for translate node

This is part of #119592.

Pull Request: https://projects.blender.org/blender/blender/pulls/119603
2024-05-01 14:44:01 +02:00
Hans Goudey
e63c8bb3c2 UI: Add Modifiers submenu to 3D view header
Add a menu similar to the "Object > Constraints" menu that allows adding,
copying, and clearing modifiers. The "copy all modifiers to selected" and
"clear modifiers" operators are new, to mirror the functionality we already
have for constraints.

The "Add" menu is the same that's used in the property editor. In the 3D
view, modifiers are always added to all selected objects.

Part of #120230

Pull Request: https://projects.blender.org/blender/blender/pulls/121286
2024-05-01 14:15:53 +02:00
Sean Kim
d4a61647bf Sculpt: Add Line Trim tool
This PR adds the *Line Trim* tool to Sculpt mode. It is exposed via
the toolbar along with the other *Trim* tools and as an entry in the
*Sculpt* menu.

## Technical Approach
Line gestures are represented as two points in screen space: the `start`
and `end` of the gesture. Trim tools work by taking a set of screen
points as the top face of a volume, projecting a copy of the face into
the scene, then using that as the operand shape for boolean operations.
To behave as users would expect, the *Line Trim* tool does the following
steps to make the initial face:
1. Take the sculpted object's bounding box.
2. Project the bounding box into screen space
3. Take the magnitude of the diagonal line made from the bounding box
4. Use the magnitude multiplied by an arbitrary factor to ensure the
   initial line is long enough to fully divide the object.
5. Create two points by moving in a perpendicular direction from start
   and end points.
6. Use the resulting four points as vertices of the quad in screen space.

## Differences with Other Trim Tools
* Line Trim **only** supports the **Difference** mode. As such, the
corresponding tool options have been disabled in the header.

## Alternatives
* Instead of using a boolean operation, this could be achieved by using
a bisect operation when using the *Fixed* projection mode. While this
may result in a better performing tool, it is not guaranteed and
requires extra work to integrate this approach.

Pull Request: https://projects.blender.org/blender/blender/pulls/120845
2024-05-01 14:10:26 +02:00
Omar Emara
5bc8dd7d3b Cleanup: Make format 2024-05-01 15:03:14 +03:00
Omar Emara
74300f88a0 Cleanup: Missing include in recursive blur algorithm 2024-05-01 12:08:08 +03:00
Boltzmachine
c727bf3f76 Fix #120680: add node tree update operation after adding new views
The Switch View node cannot be automatically updated when new views are added.
This is because there is no tree update operation after adding new views. This
patch simply fix it by tag the node tree and update it.

Pull Request: https://projects.blender.org/blender/blender/pulls/120685
2024-05-01 10:24:03 +02:00
Omar Emara
382131fef2 Realtime Compositor: Implement Fast Gaussian blur
This patch implements the Fast Gaussian blur mode for the Realtime
Compositor. This is a faster but less accurate implementation of
Gaussian blur.

This is implemented as a recursive Gaussian blur algorithm based on the
general method outlined in the following paper:

 Hale, Dave. "Recursive gaussian filters." CWP-546 (2006).

In particular, based on the table in Section 5 Conclusion, for very low
radius blur, we use a direct separable Gaussian convolution. For medium
blur radius, we use the fourth order IIR Deriche filter based on the
following paper:

  Deriche, Rachid. Recursively implementating the Gaussian and its
  derivatives. Diss. INRIA, 1993.

For high radius blur, we use the fourth order IIR Van Vliet filter based
on the following paper:

  Van Vliet, Lucas J., Ian T. Young, and Piet W. Verbeek. "Recursive
  Gaussian derivative filters." Proceedings. Fourteenth International
  Conference on Pattern Recognition (Cat. No. 98EX170). Vol. 1. IEEE,
  1998.

That's because direct convolution is faster and more accurate for very
low radius, while the Deriche filter is more accurate for medium blur
radius, while Van Vliet is more accurate for high blur radius. The
criteria suggested by the paper is a sigma value threshold of 3 and 32
for the Deriche and Van Vliet filters respectively, which we apply on
the larger of the two dimensions.

Both the Deriche and Van Vliet filters are numerically unstable for high
blur radius. So we decompose the Van Vliet filter into a parallel bank
of smaller second order filters based on the method of partial fractions
discussed in the book:

  Oppenheim, Alan V. Discrete-time signal processing. Pearson Education
  India, 1999.

We leave the Deriche filter as is since it is only used for low radii
anyways.

Compared to the CPU implementation, this implementation is more
accurate, but less numerically stable, since CPU uses doubles, which is
not feasible for the GPU.

The only change of behavior between CPU and this implementation is that
this implementation uses the same radius, so Fast Gaussian will match
normal Gaussian, while the CPU implementation has a radius that is 1.5x
the size of normal Gaussian. A patch to change the CPU behavior #121211.

Pull Request: https://projects.blender.org/blender/blender/pulls/120431
2024-05-01 09:57:30 +02:00
Lukas Tönne
6c1bf7fc94 GPv3: Fix initialization of the DrawingPlacement struct from tool settings
The `DrawingPlacement` utility struct is initialized based on various
tool settings, including the `gpencil_v3d_align` flag. This flag was
used in a switch statement, but didn't handle all the potential flag
combinations, leaving placement variables like the origin vector
uninitialized and causing nan values when projecting.

Pull Request: https://projects.blender.org/blender/blender/pulls/121246
2024-05-01 09:03:10 +02:00
Omar Emara
f595345f52 Compositor: Match size of Fast Gaussian with Gaussian
This patch matches the size of the Fast Gaussian mode of blur with the
standard Gaussian mode. The sigma value was computed as half the radius,
while it should be third of the radius, since Blender's Gaussian
function is truncated at 3 of the standard deviation of the unit
Gaussian. The patch include versioning to adjust the size of existing
files.

Pull Request: https://projects.blender.org/blender/blender/pulls/121211
2024-05-01 09:01:53 +02:00
Aras Pranckevicius
13dcb30b79 Cleanup: Remove unused BLF_BLUR_ENABLE code path
Has been disabled since 2016 (a8dc3f4596)

Pull Request: https://projects.blender.org/blender/blender/pulls/121270
2024-05-01 07:17:06 +02:00
Hans Goudey
02f2d73b78 Refactor: Deduplicate modifier copy to selected functions
There were two functions copying modifiers. The modifier operator
exposed in the property editor reported for various failures. Outliner
drag and drop did not. This commit refactors code a bit to unify the
two. Outliner drag and drop should now report why it fails too.
2024-04-30 16:02:08 -04:00
Hans Goudey
5b6c776ef4 Cleanup: Rename modifier_clear function to add plural
Make it more obvious that the function removes all modifiers.
2024-04-30 16:02:08 -04:00
Hans Goudey
809ed077ac Cleanup: Use const in some modifier related functions 2024-04-30 16:02:08 -04:00
Clément Foucault
643f4eaedf Fix: EEVEE-Next: Compilation error
Caused by accidentally merging two comflicting
PRs that had no merge conflict.
2024-04-30 20:40:48 +02:00
Clément Foucault
303f91a09c EEVEE-Next: Add slab thickness and thickness from shadow options
Implement the design discussed in #120384.

This adds two parameters. One for changing the approximation
method, and another to use the thickness from shadow map.

We pack the former in the gbuffer by dividing the 16bits
used for thickness by two and use one bit to store the
method.

The thickness from shadow map is now decoupled from the
light evaluation shader. This makes it more performant and
compatible with ray-tracing. This commit also uses the
same biases as shadow mapping to avoid aliasing artifacts
(fix #119339).

This refactors the light evaluation quite a bit to
remove unused bits bits and make the whole transmission
light evaluation without too much complexity.

Pull Request: https://projects.blender.org/blender/blender/pulls/121171
2024-04-30 20:32:46 +02:00
Hans Goudey
bc5f5d9a6c Cleanup: Use reference and rename mesh buffer list variable 2024-04-30 14:23:13 -04:00
Hans Goudey
6c2593cc13 Fix: EEVEE render crash after recent mesh index buffer commit
Caused by 1b7e67a851.
The GPU subdivision extraction was missing the check for whether
neither lines nor lines_loose was requested.
2024-04-30 14:18:28 -04:00
Miguel Pozo
a8f8745dcb Draw: Add default material fallback detection
Detect passes that are functionally equivalent to the default Material
ones to skip their compilation.

Pull Request: https://projects.blender.org/blender/blender/pulls/121137
2024-04-30 19:44:06 +02:00
Clément Foucault
e581ba077d Fix: EEVEE-Next: Principled BSDF transmission color applied twice
This was caused by the 2 transmission event approximation we
do for object with non-null thickness. This follows cycles
by using the square root of the color.
2024-04-30 19:32:52 +02:00
Hans Goudey
f4bf30c224 Cleanup: Tweak comment and indentation in mesh IBO extraction 2024-04-30 13:03:26 -04:00
Hans Goudey
7799c04cf6 Cleanup: Use const BMesh pointer 2024-04-30 13:03:26 -04:00
Hans Goudey
19cdef03e2 BLI: Add IndexMask::from_bools_inverse utility 2024-04-30 13:03:26 -04:00
Hans Goudey
71df15de04 Fix #121265: Normals of faceless vertices are not displayed
Caused by bace4c9a29 which only
extracted normals at face corners. Solve by also extracting loose edge and
loose vertex normals. And change the BMesh extraction to not use the
face iteration of the MeshExtract system, just because that's simpler.
2024-04-30 13:03:26 -04:00
Sybren A. Stüvel
15cc446773 Cleanup: anim, rename 'out' to 'binding' in unit test
A unit test file was still using `out`, short for 'output', which was the
original name for what later became 'binding'. This is now updated, and
the variables are now named appropriately.

Pull Request: https://projects.blender.org/blender/blender/pulls/121273
2024-04-30 18:01:49 +02:00
Sybren A. Stüvel
10c00b6390 Anim: Add RNA enum for animation bindings + operator to un-assign
Add an RNA enum property `AnimData.animation_binding` that lists all the
bindings available in `AnimData.animation`.

The list of bindings is filtered to only contain the bindings suitable
for the animated ID. This prevents assigning a 'camera' binding to a
mesh.

Un-assigning is done via an operator, represented as an 'X' button in
the interface.

The enum property contains up to two special items:
- "New" to create a new binding for the ID.
- "(none/legacy)" to indicate that this ID doesn't have a binding
  assigned. This one is conditional, and only appears when it is
  necessary.

These two special items are experimental, and mostly exist because we're
still evaluating things and building a better UI. It is intended that
the binding selector will become as close to the ID selector as
possible.

-----------

Note that this PR also contains #121268 as it builds up from that one, and I didn't want to wait with testing on the buildbot until that one lands.

The new Baklava panel:

![image](/attachments/ac357f32-d50a-481b-8b3c-9c0be07424b6)

Pull Request: https://projects.blender.org/blender/blender/pulls/121269
2024-04-30 17:37:16 +02:00
Pablo Vazquez
e29676ac98 UI: Rename New Bone Collection confirmation button
Rename "Move" to "Create" to match object collections operator and
because it is the first action performed right after.
Plus it is arguably the action with the most impact of the two.
2024-04-30 17:09:31 +02:00
Omar Emara
98043d3fc3 Fix #121264: Crash when File Output has preview
Blender crashes when a File Output was created when the Use Preview
option of the render output settings was enabled. This is a regression
introduced in 931c188ce5, where the image format of the node was
initialized from the scene image settings, so the preview option was
carried over, yet it is not supported nor exposed to the user in the
File Output node. To fix this, ensure the file output code will ignore
previews.
2024-04-30 17:44:02 +03:00
Brecht Van Lommel
5e772390af Fix #119997: Multires bake wrong result with sharp edges or faces 2024-04-30 16:34:40 +02:00
Sybren A. Stüvel
c41f1be5b7 Anim: RNA, refuse to set AnimData.binding_handle when there is no animation
Refuse to set the RNA property `AnimData.animation_binding_handle` when
`AnimData.animation` is nil.

When in a hypothetical future `AnimData.animation` would be set, the
binding handle would be ignored anyway, as it's only meaningful within
the context of a known animation. Refusing to set the binding handle in
cases where it is known to be meaningless may help to find bugs in
Python scripts.

Pull Request: https://projects.blender.org/blender/blender/pulls/121268
2024-04-30 16:24:31 +02:00
Hans Goudey
1b7e67a851 Mesh: Lines index buffer creation improvement
Implements another phase of #116901, this time for the `lines` and
`lines_loose` index buffers that store indices for wireframe drawing.
The key improvement is removing loose edge's dependency on the main
edge index buffer. That means for the majority of meshes with no loose
edges, edge index extraction can be completely skipped. Even when there
are loose edges, only the loose edges need to be extracted with
wireframe turned off.

Besides that improvement, there are more changes to use data-oriented
code with visible hot loops instead of the virtual function call design
used for the existing mesh extractor system. For this step I completely
replaced the `extract_lines` object, which is in line with the general
plan for this area.

Additionally, hidden edge filtering is done ahead of time using several
`IndexMask` operations. This means only indices for visible edges need
to be uploaded to the GPU, and no restart index stripping needs to be
performed on macOS.

On my usual test file with 1.9 million vertices, I observed an
improvement from 26 to 33 FPS with wireframe off, and from 9.15 to 9.5
FPS with wireframe on.

Pull Request: https://projects.blender.org/blender/blender/pulls/120720
2024-04-30 15:54:50 +02:00
Hans Goudey
462e7aeedd Geometry Nodes: Add Align Rotation to Vector node
A version of "Align Euler to Vector" with the rotation socket
instead of the vector Euler socket. Other than that, and a few
cleanups to use newer math functions, the node is the same.

The old node is just "Deprecated" for now. We could remove
it with versioning, but we can also wait to do that.

In a simple test this node is about 1.7 times faster than the old one.

Pull Request: https://projects.blender.org/blender/blender/pulls/118565
2024-04-30 15:52:11 +02:00
Sybren A. Stüvel
0da53b5e62 Anim: Change how names of Bindings work, and how Bindings are created/assigned
This cleans up some of the Animation/Binding API, and adds a distinction
between a binding's "name" and its "display name".

`name`: internal name that is unique within the `Animation`. As such, it
        is also the key into the `anim.bindings` collection.
  - To ensure the uniqueness, `name` is always prefxed with the ID
    identifier, like `OBCube` and `CACamera`.
  - A binding that was not created to animate a specific ID will be
    called `XXBinding`.
`name_display`: display name that strips the first two characters, so in
        the above examples would be `Cube`, `Camera`, and `Binding`.

### RNA setter behaviour

`name`: always sets the name, emitting a warning when the name's prefix
doesn't match the ID type of the Binding. This implicitly changes the
display name (as they are two views into the same string).

`name_display`: sets `name = prefix_for_ID_type + name_display`. So even
when the old name was `QQSomethingWeird`, setting `binding.name_display
= "NewName"` would effectively set `binding.name = "OBNewName"`
(assuming it was already bound to some object earlier).

Bindings now also **always have a name**. Previously it was possible to
create bindings named `""`, but that's no longer possible.

Bindings used to be **renamed automatically** when they were first
assigned, for example from `XXBinding` to `OBCube`. This behaviour has
been removed, as it could potentially cause confusion.

Pull Request: https://projects.blender.org/blender/blender/pulls/120941
2024-04-30 15:51:47 +02:00
Nathan Vegdahl
d5a4b98323 Fix #115930: custom colored bones are invisible when drawn in stick mode
The fix here is simple: we ignore the alpha channel in the bone theme
colors, setting it unconditionally to fully opaque.  This is correct
because conceptually the bone theme colors are just RGB, not RGBA,
and the alpha channel doesn't always get set consistently.

Pull Request: https://projects.blender.org/blender/blender/pulls/121256
2024-04-30 15:25:21 +02:00
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