Commit Graph

136294 Commits

Author SHA1 Message Date
Hans Goudey
ab7b4bc7d3 Cleanup: Sculpt: Return transform symmetry matrices by value 2024-05-21 10:20:45 -04:00
Hans Goudey
860c3b43cb Fix #121936: NaN position values with sculpt transform in some cases
Initialization of `pivot_rot` in `SculptSession` was missing. Initialize all
the pivot values just to be safe.
2024-05-21 10:10:07 -04:00
Jeroen Bakker
bce3d363a4 Vulkan: Shader Interface Lifetime
Previously the VKShaderInterface was constructed twice. This was
due to a limitation of the Shader api. Specialization constants
introduced an Shader::init function which allows to pre-initialize
the shader interface before a shader is finalized.

Pull Request: https://projects.blender.org/blender/blender/pulls/122049
2024-05-21 15:17:36 +02:00
Hans Goudey
5c44f9bddc Cleanup: Use references in mesh draw cache 2024-05-21 09:09:07 -04:00
Jeroen Bakker
cdd5fd4522 Cleanup: Make format 2024-05-21 14:36:50 +02:00
Hans Goudey
ff4948fc08 Fix #122036: Preview image crash with asset browser
I can't reproduce this on release or debug builds. But from the strack
traces provided in a couple reports, it looks like the runtime pointer
is null. This makes sense because BKE_previewimg_blend_read is not
called here which is what allocates the runtime struct on file read.
To maintain a "valid" PreviewImage in more code and avoid the
complexity of making the runtime pointer optional, just allocate
it in BLO_blendhandle_get_preview_for_id.
2024-05-21 08:31:10 -04:00
Falk David
125617dc82 GPv3: Replace uses of Layer::frame_key_at
There were multiple places in the GPv3 code that assumed that the
frame key is equivalent to the start frame of the frame with that key.
But this is not the case. The `FramesMapKeyT` is either the start frame
*or* the end frame (for frames with fixed duration).

This adds a new function `start_frame_at` that returns the start frame
number of the frame at `frame_number` or -1 if no such frame exists.

One place needed the index into sorted keys (for onion skinning) so
this was replaced with a new function `sorted_keys_index_at`.

With these changes, `Layer::frame_key_at` is now a private method.

Pull Request: https://projects.blender.org/blender/blender/pulls/122045
2024-05-21 14:25:41 +02:00
Sebastian Parborg
7ff8a7b173 Fix #100115: Show non "Relative" animation keys in the shapekey action editor
Because the shapekey editor is trying to have a more fancy UI with
sliders on each "Relative" shapekey value, all other animatible
properties were not drawn.

This patch now makes it possible to easily work with actions that have
non "Relative" keys. Before this was almost impossible as the user could
not see what action they had selected or which non relative keys were in
them as the UI would think that the action was empty.

While working on this I also noticed that there are some other
properties in relative mode that is not in the action editor either
(Range Min/Max). I added a TODO about that in the code as one would
probably want to group those together in a nice way with either
respective shapekey.

Pull Request: https://projects.blender.org/blender/blender/pulls/121829
2024-05-21 14:05:36 +02:00
Falk David
ba1356e339 Cleanup: GPv3: Rename FramesMapKey to FramesMapKeyT
Other code also uses the suffix `T` to indicate that this is a type.
Note that `FramesMapKeyT` is just an `int` but with a very specific
meaning. Hence the alias to avoid confusions.
2024-05-21 13:16:53 +02:00
Lukas Tönne
fe401aa5d6 GPv3: Allow re-filling an area by ignoring fill materials
Filling an area is typically done with a "Fill"-only material. It should
be possible to fill the same area again (paint "over" the fill stroke)
and get the exact same shape. The draw code for the fill tool, however,
was rendering all strokes with a "Stroke" material, creating a thick
boundary that shrinks the fill area with every iteration.

Image render code for the fill tool now ignores any strokes that don't
have a stroke material.

Pull Request: https://projects.blender.org/blender/blender/pulls/122034
2024-05-21 11:14:33 +02:00
Christoph Lendenfeld
3a40d2813f Anim: Pose Library - Allow blending flipped from the context menu
This adds the `Blend Pose Flipped` option to the
context menu of the pose library.
The operator already accepted a flipped property,
it was just missing a dedicated menu entry for that.

In order for this to work, the modal operator had to be modified.
Instead of setting the flipped state, pressing `Ctrl` now acts as a toggle.
That means that if the operator has been started in flipped mode,
pressing and holding `Ctrl` will unflip it.

This has been a point of discussion in the A&R module meeting
https://devtalk.blender.org/t/2024-05-14-animation-rigging-module-meeting/34614#ux-quirks-in-the-pose-library-shelf-5

Pull Request: https://projects.blender.org/blender/blender/pulls/121857
2024-05-21 11:08:22 +02:00
Philipp Oeser
58f5b128c9 Fix #102872: Custom Normals Average operator ui shows wrong properties
`Weight` & `Threshold` sliders should **not** show in case of `Type` :
`Custom Normal` and **should** show for both `Type` : `Face Area` &
`Type` : `Corner Angle`

In code, it looks like we are gathering `loop_weight` with `val`.
- this is always 1.0 for `EDBM_CLNOR_AVERAGE_LOOP`
- this is taken from `BM_face_calc_area` for
`EDBM_CLNOR_AVERAGE_FACE_AREA`
- this is taken from `BM_loop_calc_face_angle` for
`EDBM_CLNOR_AVERAGE_ANGLE`

Code then compares not equal those values with given threshold, but for
`EDBM_CLNOR_AVERAGE_LOOP` this will never trigger (since all values are
the same), thus `count` is always zero which makes the effective
`n_weight` always 1. So all loop split normals are averaged for a vertex
with the same weight (seems to make sense to me -- at is just plain
average)

Long story short: the condition to show `Weight` & `Threshold` sliders
is just flipped (these only apply for the methods that take neighbor
faces into account).

Pull Request: https://projects.blender.org/blender/blender/pulls/121864
2024-05-21 10:38:11 +02:00
Falk David
82f509a1a4 Cleanup: GPv3: Use Layer::is_empty()
Also adds a docstring for the `is_empty()` method.
2024-05-21 10:33:28 +02:00
Bastien Montagne
23425ea83e I18N: Updated UI translations from git/weblate repo (be132e4843f81). 2024-05-21 09:35:59 +02:00
Omar Emara
9fd37cf31b Fix #122005: Sun Beams node produces NaNs
The Sun Beams node produces NaNs when the ray length option is zero.
This is due to zero division in the code, which we avoid by skipping
computation altogether when the ray length is zero.
2024-05-21 09:53:15 +03:00
Campbell Barton
3fd05386fc Unbreak error in last commit 2024-05-21 13:20:36 +10:00
Campbell Barton
57707ca9ae Cleanup: const pointers for FCurves where possible 2024-05-21 13:17:35 +10:00
Campbell Barton
9fdd31d331 Cleanup: quiet redundant move warning 2024-05-21 13:17:35 +10:00
Hans Goudey
e5d3ee2b04 Cleanup: Allocate mesh batch cache subdiv cache as non-trivial struct
For future use of RAII types like `Array` and `Vector`.
2024-05-20 23:07:14 -04:00
Hans Goudey
81c4b7b23e Subdiv: Simplify loose edge subdivision neighbor retrieval
- Directly check for vertices with two edge neighbors instead of looping
- Use arrays of C++ types as return values
- Use lambda to avoid repetition for each edge vertex
- Use `edge_other_vert` utility
2024-05-20 23:07:14 -04:00
Hans Goudey
c5bec86e71 Cleanup: Use C++ types, return values for loose edge subdivision 2024-05-20 23:07:14 -04:00
Clément Foucault
8f9fa07cc1 Fix: EEVEE-Next: Fix compilation error in GLSL
`common` is reserved keyword apparently
2024-05-20 22:44:11 +02:00
Hans Goudey
1910bb1a95 Cleanup: Correct mesh draw cache struct names 2024-05-20 15:40:47 -04:00
Hans Goudey
44a647197e Cleanup: Avoid storage for active element geometry node
Recently we haven't been adding separate storage structs just to
store a single enum, partially with the hope these will be changed
to sockets in the future, but also because it isn't worth the boilerplate.
Missed in the review of #121333.
2024-05-20 15:12:15 -04:00
Colin Basnett
2fe92c63d3 Geometry Nodes: Add Active Element tool node
This pull request adds an "Active Element" node that exposes the active
vertex, edge, or face index to the geometry node tool context. The
presence of an active element is available as a boolean.

This node enables the creation of "active-to-selected" style operators.

Co-authored-by: Hans Goudey <hans@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/121333
2024-05-20 21:01:30 +02:00
Iliya Katueshenock
1904e2fc8d Geometry Nodes: treat rotation as vector data type in link-drag-search in some nodes
If there is implicit conversion between rotation and vector type, so these search items
make sense.

Pull Request: https://projects.blender.org/blender/blender/pulls/121754
2024-05-20 20:30:52 +02:00
Hans Goudey
f181027f6b Cleanup: Rename variable in mesh modifier evaluation
`mesh_final` isn't really the final mesh but the "current" mesh. Adding the
extra word here isn't helpful. This also helps to reduce the size of the diff
in #119968 where the mesh variables have much smaller scopes.
2024-05-20 13:37:15 -04:00
Clément Foucault
8d4576d165 Fix: EEVEE-Next: Discrepancy in GGX pdf and eval function 2024-05-20 19:32:05 +02:00
Hans Goudey
f9f7f25e8d Fix #121880: Node clipboard loses links for dynamic declarations
Some nodes like the simulation input have sockets that depend on
other nodes in the tree, via dynamic declarations. The first fix here
is remapping those inter-node references before adding links and
updating declarations. The second is storing link references with
socket identifiers instead of socket pointers. This is necessary
because the new sockets aren't added to the socket map when the
node is copied. Avoiding pointer storage is also less fragile in general.

Pull Request: https://projects.blender.org/blender/blender/pulls/122013
2024-05-20 19:20:41 +02:00
Hans Goudey
c4fc19f064 Cleanup: Use reference argument for BKE_mesh_copy_for_eval 2024-05-20 13:18:24 -04:00
Hans Goudey
5025c57679 Cleanup: Use references in mesh_data_update.cc 2024-05-20 13:11:18 -04:00
Hans Goudey
a6ecfe2f79 Cleanup: Rename DerivedMesh.cc and header
After recent commits, the .cc file is only used for actual object data
evaluation in the depsgraph, and the header is only used for the old
DerivedMesh data structure that's still being phased out.
2024-05-20 13:11:18 -04:00
Hans Goudey
25b059549b Cleanup: Rename mesh_data_update to mesh_data_update
Mesh object evaluation is unrelated to DerivedMesh nowadays. Change the
name to something similar to the other evaluation functions called in
BKE_object_handle_data_update.
2024-05-20 13:11:18 -04:00
Hans Goudey
5733f6e906 Cleanup: Move mesh evaluation functions to C++ namespace
And move them out of the DerivedMesh header so that can just be used
for the actual DerivedMesh code.
2024-05-20 13:11:18 -04:00
Jacques Lucke
4e3f455f80 Cleanup: move PointerRNA_NULL closer to type definition
This simplifies zero-initializing `PointerRNA` in structs even when
just `RNA_types.hh` is included. Previously, one had to use
`RNA_access.h` to access it. It's also `constexpr` now which can
have small performance benefits in theory.
2024-05-20 18:49:52 +02:00
Clément Foucault
d4b4107d32 EEVEE-Next: Use PDF instead of BSDF for denoising
This adds PDF computation for eval functions as
well as using PDF for spatial denoising.

This seems to not do have any impact but at least
it seems more sounds than bsdf / pdf. Also
computing pdf is cheaper than whole bsdf.

Pull Request: https://projects.blender.org/blender/blender/pulls/121858
2024-05-20 18:13:09 +02:00
Hans Goudey
040bfcee12 Cleanup: Remove unused DerivedMesh code 2024-05-20 11:52:08 -04:00
Hans Goudey
ce104c33d6 Cleanup: Move CDDerivedMesh to new legacy file
Grouping the legacy DerivedMesh code in the same place helps keep
the actively maintained code clearer and clarifies what we are hoping
to remove in the future.
2024-05-20 11:45:57 -04:00
Hans Goudey
f73f3451d9 Cleanup: Move legacy DerivedMesh code to a separate file
Move to a file with the more consistent "mesh_legacy" naming, out of the
modifier evaluation code which has nothing to do with this anymore. That
file can be renamed in a separate step.
2024-05-20 11:40:09 -04:00
Hans Goudey
19aa5b793d Cleanup: Fix const correctness of node find socket function 2024-05-20 11:16:34 -04:00
Hans Goudey
907941309b Cleanup: Remove unused node function declaration 2024-05-20 11:08:27 -04:00
Hans Goudey
5a9a04a990 Cleanup: Use StringRef for node find socket function 2024-05-20 11:08:19 -04:00
Hans Goudey
9b1c6fb04b Cleanup: Use const for edit mesh deformation arguments 2024-05-20 10:14:41 -04:00
Hans Goudey
9e019c33fc Cleanup: Remove unused logger for USD point reader 2024-05-20 10:04:55 -04:00
Hans Goudey
1efbc78b0d Cleanup: Add comment about edit mesh BMesh ownership 2024-05-20 10:00:31 -04:00
Hans Goudey
4e622fbccd Revert "UI: Remove icon usage in brush tool RNA enums"
This reverts commit fd5a790f36.

Fixes #121700
2024-05-20 09:50:28 -04:00
Hans Goudey
cdf59b7355 Refactor: Move preview image runtime data to runtime struct
Follow up for 5445fae9cf

Pull Request: https://projects.blender.org/blender/blender/pulls/122009
2024-05-20 15:24:03 +02:00
Hans Goudey
5445fae9cf Refactor: Use more standard storage for PreviewImage runtime data
Using a non-virtual derived struct for polymorphism is error prone,
especially combined with the requirements of DNA. Instead, use a
separately allocated runtime struct as done for many other DNA structs.

In a followup commit, the remaining runtime members of `PreviewImage`
could be moved to the new runtime struct.

Pull Request: https://projects.blender.org/blender/blender/pulls/121509
2024-05-20 14:25:44 +02:00
Omar Emara
434ad164a8 Fix #121940: Viewport compositor works on part of render
The Viewport Compositor only operates on part of the render when doing
viewport rendering when in camera view. That's because the code wrongly
assumed camera offset even when doing viewport renders, which do not
exist in that case.
2024-05-20 14:27:31 +03:00
Habib Gahbiche
a241790e8f Fix image viewer sampler does not consider image offset
When viewer image is drawn with offset (because of translation in compositor), the sampler doesn't consider the offset, resulting in wrong sampled values

Pull Request: https://projects.blender.org/blender/blender/pulls/121992
2024-05-20 10:56:12 +02:00