Commit Graph

108116 Commits

Author SHA1 Message Date
Germano Cavalcante
f0479e915f Transform: Implement Snap to Grid mode
Addresses two improvements to `Snap to Grid` as suggested in #73993:
- Make 'Absolute Grid Snapping' a new Snap Mode
- Snap to Grid in Non-Side View performed at ground level

Implementation details:

- Snap to Grid has no cursor symbol, unless we are in `Set Snap Base`
  mode. Similar to the previous 'Absolute Grid Snap' behavior.
- In Non-Side view, Snap to Grid is performed at ground level.
- If `Snap Base` is `Closest`, Snap to Grid uses the transform pivot
  point instead. Similar to the previous 'Absolute Grid Snap' behavior.
- The "Absolute Grid Snap" option has been removed.

Pull Request: https://projects.blender.org/blender/blender/pulls/116109
2024-03-27 13:17:24 +01:00
Pratik Borhade
b3fe97414a Fix: Sculpt paint crash after converting active color attribute
Painting after converting active color attribute in sculpt mode causes crash.
Fix is same as 3641b4b884ab4b117cab3c800d16b2ac5263a7a1 with some cleanup

Pull Request: https://projects.blender.org/blender/blender/pulls/119780
2024-03-27 12:28:16 +01:00
Omar Emara
0709c07d04 Cleanup: Use actual class instead of base class
Use the TranslateCanvasOperation class in the declaration instead of its
TranslateOperation class. This is just to clarify the code when reading
it.
2024-03-27 12:54:42 +02:00
Omar Emara
4d9678c483 Fix: Sun Beams node is off by half a pixel
The Sun Beams node is off by half a pixel. That's because we add a half
pixel offset to the initial coordinates, but then sample the texture
with the half pixel. To fix thus, use the texture_bilinear_extend
utility to sample the image, which takes care of the half pixel offset.
2024-03-27 12:49:21 +02:00
Sergey Sharybin
e9dc9ef9a2 Fix #119936: Crash selecting in mask editor
Regression since 7a2d04a5c43.

Mask evaluation is part of parameters component, and there is no explicit
tags other than copy-on-eval for masks in a lot of cases.

Restore the previous graph topology for the link from copy-on-eval to the
parameters components of mask ID.

Potential candidate for 4.1.1.

Pull Request: https://projects.blender.org/blender/blender/pulls/119956
2024-03-27 11:00:55 +01:00
Omar Emara
5ae5614d1e Fix: Chroma Key differs from reference implementation
The GPU compositor Chroma Key node differs from the reference
implementation. This is caused by a typo, where the acceptance angle was
halved after computing tangent instead of before computing it.
2024-03-27 11:10:49 +02:00
Omar Emara
9aa63aa1e8 Fix: Lens Distortion node is off by half a pixel
The Lens Distortion node is off by half a pixel because their normalized
coordinates were at the pixel corners as opposed to their centers, where
this patch changes the behavior to the latter.
2024-03-27 09:04:34 +02:00
Omar Emara
aa208d3d18 Fix: Plane Deform nodes are off by half a pixel
The Plane Track and Corner Pin nodes are off by half a pixel because
their mask is computed at the pixel corners as opposed to their center,
where this patch changes the behavior to the latter.
2024-03-27 08:54:04 +02:00
Omar Emara
7113692206 Fix: Directional Blur node is off by half a pixel
The Directional Blur node is off by half a pixel because it transforms
the pixels at their corner as opposed to their center, where this patch
changes the behavior to the latter.
2024-03-27 08:50:44 +02:00
Omar Emara
6df333a3c7 Fix: Movie Distort node is off by half a pixel
The Movie Distort node is off by half a pixel because it evaluates the
distortion at the corner of pixels as opposed to their center, where
this patch changes the behavior to the latter.
2024-03-27 08:47:07 +02:00
Jonas Holzman
913acaf395 Fix #86325: tilted viewport orientation in default startup
Since v2.5 Blenders viewport view has been tilted by around ~0.8
degrees to the right, resolve this using a lookup table to update
the the defaults.

Ref !113751
2024-03-27 17:13:02 +11:00
Campbell Barton
e078112a53 Fix notifiers from window events using the wrong window
The active window in the context may not match the window where GHOST
events are generated. Notifiers for new windows would always be ignored
with the context's window set to null for example.

Noticed while investigating #119871.
2024-03-27 15:04:03 +11:00
Campbell Barton
2a25340da4 Cleanup: quiet missing-declarations warnings 2024-03-27 14:53:58 +11:00
Hans Goudey
7f25242089 Cleanup: Move object mode switching declarations to proper modules
Keep each function's declaration in the header file associated with its
module. Arguably mode switching should be more organized, but for now
it's better to just declare functions in more predictable places.
2024-03-26 23:45:43 -04:00
Hans Goudey
436c0a773e Cleanup: Remove object vgroup functions to proper header
These functions were declared in the editors/mesh module but
defined in the editors/object module. This commit moves them to
a separate header associated with the object editors module.
2024-03-26 23:45:43 -04:00
Hans Goudey
148940ad15 Cleanup: Remove unnecessary keywords from newly C++ headers
Pull Request: https://projects.blender.org/blender/blender/pulls/119943
2024-03-27 02:45:30 +01:00
Hans Goudey
b8b745ae1e Cleanup: Move remaining editors internal headers to C++ 2024-03-27 02:45:27 +01:00
Hans Goudey
acd1b0b7f9 Refactor: Use C++ Vector for RNA/context collection retrieval
Previously retrieving a collection from the context like "selected_ids"
would give a linked list of allocated items. Now it returns a vector of
RNA pointers. Though the number of items is typically fairly small,
using contiguous memory and avoiding many small allocations are
typical performance improvements that could still be beneficial
when there are many items. Iteration also becomes much simpler.

Pull Request: https://projects.blender.org/blender/blender/pulls/119939
2024-03-27 00:47:39 +01:00
Campbell Barton
3416fe6e1e License headers: add SPDX headers 2024-03-27 10:31:24 +11:00
Campbell Barton
40ab214c0a Cleanup: spelling in comments 2024-03-27 10:25:31 +11:00
Campbell Barton
d6c4433451 Cleanup: remove declarations for removed functions 2024-03-27 10:23:53 +11:00
Campbell Barton
3f594f7b2f Cleanup: consistent naming for EditMesh::looptris elements
Use the term `ltri` everywhere.
2024-03-27 10:09:12 +11:00
Campbell Barton
2220696d25 BMesh: avoid copying by value for BMLoop triangles
Caused by [0] which made BMLoop[3] variables & arguments copy by value.

[0]: 3805974b6fa8e15ae4409f597747bc7beee51fa3
2024-03-27 10:09:10 +11:00
Hans Goudey
f2c5cae3d8 Cleanup: Remove unused RNA function call functions
These functions appear to have been unused for the last 15 years.
They are quite complex with the var_args handling, and may get in
the way of some other cleanups in the area.
2024-03-26 18:12:21 -04:00
Hans Goudey
e1c54d5a24 Fix: Windows build error after recent cleanup commit 2024-03-26 16:20:40 -04:00
Hans Goudey
cd76d06f95 Cleanup: Use boolean instead of int 2024-03-26 16:04:03 -04:00
Hans Goudey
c72d6100ba Cleanup: Remove unrelated change added in previous commit
WIP change unrelated to anything else. Sorry for the noise!
2024-03-26 16:00:00 -04:00
Hans Goudey
48e4576162 Cleanup: Remove unnecessary keywords from C++ headers 2024-03-26 15:58:39 -04:00
Hans Goudey
265bfdb019 Cleanup: Resolve allocation size warning in Hook modifier RNA
GCC seems to complain about a possible signed to unsigned conversion
in combination with allocation and copying here.
2024-03-26 15:43:12 -04:00
Hans Goudey
0cdd429b44 Cleanup: Use newer API for creating IDProperties in most places
There are still a few places that are more complicated where the replacement
to `IDP_New` isn't obvious, but this commit replaces most uses of the ugly
`IDPropertyTemplate` usage.
2024-03-26 15:39:39 -04:00
Hans Goudey
e0567eadbd Cleanup: Use FunctionRef for IDProperty iteration callback
Avoid the need for a seaprate user_data argument.
2024-03-26 15:39:39 -04:00
Clément Foucault
2a600b4a83 EEVEE-Next: Shadow: Limit view per shadow map projection
This limits the number of tilemaps per LOD that can be fed to avoid the
easy to hit "Too many shadow updates" (#119757).

This allows for a max 64 tilemaps to be updated at once at their lowest
requested LOD (so ~10.6667 point lights if every faces of the punctual
shadow map is needed, but likely more in practice).

Unfortunately this is still quite low and will surely be hit quite soon
with directional shadow added to it. One idea to workaround this would
be to time slice the update of some lights, but this opens a whole can
of worms that I'm not ready to open for now so I created #119890 for
future reference.

Some notes, most lights seems to request around 3 LODs. It might help
to allow requesting at least 2 LODs if we are rendering since volumes
might want lower LOD available for volumes.

I added a very simplistic heuristic that also lowers the max tilemaps
when transforming, animation playback or navigating the 3D view to
improve the responsiveness of the engine. Note that this doesn't
only lowers the resolution to the minimum requested one. So it should
be good enough in most cases.

Pull Request: https://projects.blender.org/blender/blender/pulls/119889
2024-03-26 20:33:31 +01:00
Sean Kim
627ec2666b Cleanup: Add doxygen and restructure paint_hide.cc
This PR restructures the flow of `paint_hide.cc` and groups the
existing functions into newly added doxygen blocks.

Pull Request: https://projects.blender.org/blender/blender/pulls/119929
2024-03-26 20:19:54 +01:00
Guillermo Venegas
8b6a21c122 IO: Use FileHandlers in the View 3d
Use File Handlers to handle file drag-n-drop in the View 3d. Drop-boxes
still remain since they handle Texture ID drag-n-drop.

This will add-ons to handle drag-n-drop for images and movies while
still providing access to Blender's native support since File Handlers
let users choose which to invoke if there's multiple configured.

Pull Request: https://projects.blender.org/blender/blender/pulls/117728
2024-03-26 20:01:08 +01:00
Sean Kim
5a1bab39d2 Cleanup: Remove modal definition for PAINT_OT_visibility_invert
This PR removes the modal callback for `PAINT_OT_visibility_invert`.
It does not use the provided data, nor is the `modal` function
invoked by a corresponding `invoke`.

Pull Request: https://projects.blender.org/blender/blender/pulls/119930
2024-03-26 19:43:06 +01:00
Hans Goudey
efee753e8f Cleanup: Move BKE_idprop.h to C++ 2024-03-26 13:07:04 -04:00
Hans Goudey
f41ab9abc1 Cleanup: Combine BKE_idprop C and C++ headers
In preparation for moving the whole BKE_idprop.h to C++.
To keep the git history intact we remove the newer smaller file.
2024-03-26 13:07:04 -04:00
Sean Kim
881178895b Sculpt: Add fast solver option for trim operations
This PR introduces the ability for users to switch between boolean
solvers while using the sculpt *Trim* tools (*Box Trim* & *Lasso Trim*)
much like the mesh boolean modifier and geometry node. Because the
*Exact* solver has performance issues with larger meshes, the *Fast*
solver is set to be the default.

In my very rough timing tests on my laptop on a mesh with **1.7m**
vertices, a *Trim* operation with the *Fast* solver finishes in roughly
20 seconds as opposed to still being in progress after five minutes
with the *Exact* solver.

Addresses part of #84229

Pull Request: https://projects.blender.org/blender/blender/pulls/119699
2024-03-26 17:25:06 +01:00
Hans Goudey
b4b74c8da6 Cleanup: Simplify object data iteration in shade smooth operator
Use a Set instead of the `LIB_TAG_DOIT` flag.
2024-03-26 11:37:05 -04:00
Falk David
f8ef2b3e78 Curves: Add simplify_curve_attribute function
Compute an index masks of points to remove to simplify the curve attribute using the Ramer-Douglas-Peucker algorithm.

The Ramer-Douglas-Peucker algorithm finds a set of points in a polyline to remove so that the overall shape of the polyline is similar. How similar can be controlled by the distance `epsilon`.

The function takes a `GSpan` so it can be used with any attribute (that has a type `float`, `float2`, or `float3`).

Pull Request: https://projects.blender.org/blender/blender/pulls/118560
2024-03-26 15:28:11 +01:00
Aras Pranckevicius
3663c8147c Vulkan: implement support for compressed textures
Textures that are GPU-compressed already (in practice: from DDS files
that are DXT1/DXT3/DXT5 compressed) now can stay GPU compressed
in Vulkan, similar to how that works on OpenGL.

Additionally, fixed lack of mipmaps in Vulkan textures. The textures
were created with mipmaps (good), the sampler too (good), but
the vulkan image view was always saying "yo, this is mip 0 only"
because mip range variables were never set to anything than zero.

Pull Request: https://projects.blender.org/blender/blender/pulls/119866
2024-03-26 14:49:53 +01:00
Jacques Lucke
4cdc62044e BLI: fix fixed-width-int to string conversion 2024-03-26 14:25:33 +01:00
Sergey Sharybin
d3504a6bab Fix #119907: Active curve vertex/spline not visualizing properly
A regression caused by 7a2d04a5c4.

The offending commit made it so selection tag does not imply parameters
update, which also avoids transitive re-evaluation of the curve geometry.
However, the active curve index is stored on a Curve, and curve modifier
stack creates a copy of the curve to hold the evaluation results, which
makes it so evaluated curve object does not intrinsically share the active
spline index.

This change makes it so changes in selection triggers geometry evaluation
on curves, matching the behavior prior to the offending commit.

AN ideal fix would somehow avoid such geometry re-evaluation, but it would
be a bigger change, not suitable for possible corrective release.

Potential candidate for 4.1.1.

Pull Request: https://projects.blender.org/blender/blender/pulls/119918
2024-03-26 13:58:55 +01:00
Campbell Barton
9c3eceb8c8 BKE_reports: only print a single newline after each report
Printing reports was printing 2x newlines afterwards.

This caused a blank line to be printed when any operator reported info.
2024-03-26 23:00:59 +11:00
Jeroen Bakker
e811785f37 Vulkan: to_string for used vulkan types
Every vulkan installation has a vk.xml file containing the vulkan specification
in a machine readable fasion.

This PR uses the vk.xml to generate to_string functions for data types blender uses.
When updating to a new specification or when changing features/extensions we
should re-generate the to_string functions.

The generator is implemented in `vk_to_string.py`.

Pull Request: https://projects.blender.org/blender/blender/pulls/119880
2024-03-26 11:35:16 +01:00
Omar Emara
df9b3d35a2 Fix: Compositor retains old images
The compositor does not correctly free, wrap, or allocate images. That's
because the resetting mechanism didn't reset all members. This patch
rests all members and only retains the important ones.
2024-03-26 12:32:36 +02:00
Sietse Brouwer
a02b429324 Fix: GPv3: Layer settings not copied when duplicating a layer
Pull Request: https://projects.blender.org/blender/blender/pulls/119821
2024-03-26 11:01:00 +01:00
Sietse Brouwer
ab84f9eaf0 Fix: GPv3: The 'Use Masks' switch is always enabled for new layers 2024-03-26 10:59:08 +01:00
Sietse Brouwer
76c164e0ad Fix: GPv3: Blend mode not initialized when adding a new layer 2024-03-26 10:59:08 +01:00
Philipp Oeser
b8bd762714 Fix #112618: many Outliner operators crash running without a region
This could happen when e.g. overriding context with just the area.

Now add poll functions that check for an active region when running
operators that require a region.

The fix is similar to 72688791dcb2

Alternatively, we could have a fix similar to a8892c726435 (getting the
correct region from the area), this would require less setup by
scripters, however for some operators the usage of the region is a
little further down the line, so implementation would be a bit more
involved. Also: for some of the operators, this would have to be done in
both `invoke` and `exec` (so would be more duplicate code changes).

Pull Request: https://projects.blender.org/blender/blender/pulls/119696
2024-03-26 09:30:47 +01:00