If velocity attributes are the only thing being animated, we would fail
to add the cache modifier. This prevents velocity attribute data from
being updated as the timeline changes.
This is a rather rare case. Typically if velocity is changing that would
imply the positions of the mesh are also changing, and the positions
will add the modifier correctly in that case.
Pull Request: https://projects.blender.org/blender/blender/pulls/126105
We now deform the active shape key and other original data while deforming
the evaluated/deformed positions, rather than before, when we delayed that to
afterwards and affected the entire mesh no matter the area sculpted. This is all
handled by `write_translations` now.
When a curve instance did not have a "opacity" attribute, the default would be 0.
This meant that when creating Grease Pencil layers from scratch, the user
would need to manually write a "opacity" attribute.
Now the default value is 1, so that this step is no longer necessary.
This fixes two things:
* Pass the evaluated object into `BKE_object_as_kdtree` instead of the original
one. `BKE_object_as_kdtree` uses functions on the object which are only
expected to be executed on evaluated objects, such as
`BKE_object_get_mesh_deform_eval`. Note that this is the only place where
`BKE_object_as_kdtree` is used.
* Tag depsgraph at the end of setting parent. This way,
`BKE_object_get_evaluated_mesh` will return the correct mesh instead of null.
It was returning null because it the object is not in a fully evaluated state
if it just has been tagged as requiring an update.
Pull Request: https://projects.blender.org/blender/blender/pulls/126086
The GPU packed state is a static check from the Cycles core perspective,
and it is disabled for non-Apple Silicon GPUs. However, the Metal kernel
always used packed integrator.
This change makes it so the Host and Device side checks for the Host CPU
are aligned, and that Device-side packed state check does not differ from
the Host side.
Pull Request: https://projects.blender.org/blender/blender/pulls/126082
Part of #118145.
Structure the sampling code more like the brush code, processing the
distances for all vertices in a node at the same time. However, because
this is such a common code path, I compromised a bit on the code's
simplicity to improve performance, mostly by avoiding the use of more
local arrays like we often do for brushes, and also by skipping loop
iterations when the factor is zero. Avoiding the square root for filtered
vertices had a large performance impact of about 5-10% for example.
This is the last use of the sculpt brush test functions and structs which
allows removing them, completing a large part of the overall refactor.
The newly added `_sq` versions of the distance functions are deduplicated
from the non-square versions by separating the square roots to a separate
loop at the end. In my testing that had a ~1% performance cost, though
with variable timing results. I hope that smaller nodes will remove
that cost in the future.
Some rough numbers with the brush benchmark file:
Before: 0.471->0.476s
Without the filtered sqrt: ~0.5-0.53s
After: ~0.473-0.475s
Pull Request: https://projects.blender.org/blender/blender/pulls/126058
This patch introduces a new experimental option for the new CPU
compositor under development. This is to make development easier such
that it happens directly in main, but the compositor is not expected to
work and will probably crash.
Pull Request: https://projects.blender.org/blender/blender/pulls/125960
Curves selection didn't take cyclic into account, so when using box/
circle/lasso selections they won't trigger if only the "closing" segment
on a cyclic curve is touched. Now the code properly handles those
situations.
Pull Request: https://projects.blender.org/blender/blender/pulls/125900
Fixes#91369, where a pointer to a deleted btTypedConstraint instance
was being dereferenced, causing a crash.
What was happening was:
1. When the animation starts the first time, BKE_rigidbody_rebuild_sim
eventually calls btDiscreteDynamicsWorld::addConstraint, which in turn
will store a pointer to the btTypedConstraint in
btRigidBody::m_constraintRefs for each body in the constraint
2. When undoing, the btDynamicsWorld is deleted, then the Object
containing the btTypedConstraint (taking the btTypedConstraint with
it) - however, the pointer to the btTypedConstraint is still in the
btRigidBody!
3. When playing the animation a second time, rigidbody_update_simulation
will rebuild the simulation, which causes RB_body_delete to be called,
which iterates over all the body's m_constraintRefs and dereferences
the deleted pointer.
Co-authored-by: Eoin Mcloughlin <hkeoin@eoinrul.es>
Pull Request: https://projects.blender.org/blender/blender/pulls/126079
Blender crashes when adding any Color compositor node when both the
viewport and the interactive compositors are active at the same time.
This is caused by a threading issue where both threads try to compile
the same GPU material at the same time.
To fix this, we protects GPU material pass compilation using a mutex.
Pull Request: https://projects.blender.org/blender/blender/pulls/126084
The issue was caused by an attempt to write buffer pass which is
actually supposed to be calculated as compositing (either summing
direct/indirect lights, optionally diving by albedo).
The fact that the crash was only observed on Metal is a lucky
con-incident: it just happened to be so that writing at offset
-1 to the render buffer did not trigger obvious issues.
Pull Request: https://projects.blender.org/blender/blender/pulls/126057
Both the operator and the brush have an "invert" setting for the fill
tool. The operator property is toggled by both editor keymap and modal
keymap, while the brush setting is toggled from UI. Both settings are
combined (i.e. inverting both works like regular fill again).
Pull Request: https://projects.blender.org/blender/blender/pulls/126042
This issue occurred only on Mac which has to circumvent
geometry shaders lacking support for them.
This patch reverts the vertex shader for Mac devices to
how it was before f9ea64b0ba. (and uses the frag shader from before that commit)
In order to communicate that to the user I added a label
in the GUI when the platform is Mac.
Co-authored-by: Clément Foucault <foucault.clem@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/125967
These functions used the term `curves` when we try to use the
term `strokes` at the user level. Renaming the functions and
the descriptions to be more consistent.
This changes the behavior when deleting the last key of an FCurve on layered actions.
Previously the FCurve would continue to exist, whereas now it is deleted.
This makes it consistent with legacy actions.
I modified the "Clear Keyframes" operator in this PR as well to make it work with layered actions.
Pull Request: https://projects.blender.org/blender/blender/pulls/125327
This adds a Python file that can be loaded into GDB to improve the debugging
experience. This is similar to cfb60c98be which
contains a subset of the features provided here. While not being compatible with
other debuggers, specializing on just GDB allows us to use the GDB Python API
which is quite feature rich. Besides adding quite a few pretty-printers, this
also adds some frame filters which simplify backtraces. I've been using the
pretty-printers for quite some time myself already.
I added a basic guide on how to set it up in `blender_gdb_extension.py` but that
only covers the case when using `gdb` directly. If this is accepted, I can add
some more detailed guides on how to configure e.g. vscode to the developer docs.
The patch also contains some type hints for GDB which I wrote, which simplify
working with the GDB API.
Pull Request: https://projects.blender.org/blender/blender/pulls/126062
Support merging by distanced for UV's with shared underlying geometry.
This can be useful for welding seams & cleaning up holes without
merging nearby UV's from disconnected vertices.
Ref !124221
The preview is only supported with deform modifiers which are
only supported for Mesh sculpting, so just write that implementation.
Also remove SculptSession::vert_positions which is now unnecessary.
Part of #118145.
Remove some uses of the `SculptSession` array in favor of retrieving
positions as necessary. Because of implicit sharing, avoiding unnecessary
mutable references to data can avoid copies and increased memory usage.
There are still more places to change before sculpt mode recieves that
benefit though.
SCULPT_mesh_deformed_positions_get was equivalent to
BKE_pbvh_get_vert_positions which already contains the result
of any deform modifiers. Use the same function to access both
to make it easier to remove both `SculptSession::vert_positions`
and `pbvh::Tree::vert_positions_` in the future.
Previously some work for applying shape key positions was
repeated once per undo node which probably made undo/redo
in that case much slower than it should be.
When we use icons that are multi-color, like for Tool icons, we'll
still need the ability to change their alpha at runtime. We do this
for hover effects, and as a theme setting.
Pull Request: https://projects.blender.org/blender/blender/pulls/126063
The WM API has WM_window_pixels_{x,y,coords}` functions that returns the
window size/point coordinate in the host native pixel size.
As "pixels" in itself doesn't really mean anything the intent of
these functions wasn't really clear. To clarify this, this commit
renames their prefix from `WM_window_pixels_` to
`WM_window_native_pixel_`.
Pull Request: https://projects.blender.org/blender/blender/pulls/125994