In GPv2 strokes could technically have zero points.
`CurvesGeometry` doesn't allow this, so we need to make
sure to explicitly skip over strokes with no points.
Pull Request: https://projects.blender.org/blender/blender/pulls/120536
Not all matrices are invertable (e.g. when a transformation matrix is has
a scale of zero), and it's sometimes important when a matrix is.
This also better specifies the behavior when the matrix is not invertable:
the identity matrix is returned.
Pull Request: https://projects.blender.org/blender/blender/pulls/120530
A small logic issue caused all write-only image resources
to be tagged as read-write in all cases. This caused
correctness issues on Intel and AMD GPUs which
are resolved through this change.
Change also yields a small performance uplift
due to enabling improved non-dependent workload
scheduling.
Authored by Apple: Michael Parkin-White
Co-authored-by: Michael Parkin-White <mparkinwhite@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/120528
This PR performs the following refactors in sculpt_trim.cc:
* Remove `depth_front` and `depth_back` as `struct` properties, as they
are only used for generating the Mesh
* Moves the `calculate_depth` call into the `generate_geometry` step as
the latter is dependent on data from the former already
* Reorganize the methods so the overall file reads better.
* Minor comment nits and additions
Pull Request: https://projects.blender.org/blender/blender/pulls/120331
Split code to separate functions depending on the source of info for
socket inspection. Each function retrieves some optional string.
Collecting of result string is just loop.
Pull Request: https://projects.blender.org/blender/blender/pulls/120496
The reverse uv sampling operation generally fails when there the sample position
is within more than one uv triangle. Unfortunately, the combination of limited
floating point accuracy and very small triangle areas caused this case
sometimes, even if the triangles don't actually overlap. This happens relatively
rarely, but if it does, it causes annoying artifacts. The solution is to only
detect these kinds of overlapping triangles if they have a certain minimum size
and to be more relaxed otherwise.
Pull Request: https://projects.blender.org/blender/blender/pulls/120408
Make it match behavior of the previous Python importer: it was
accepting such faces, and then always calling mesh validation function
that got rid of them. Instead of doing the whole validation cost,
just do not add such faces in the first place.
Historically makesdna/rna did not link bf_guardedalloc for
some reason, but during one of my cmake cleanups have picked up
this dependency anyhow. To prevent duplicate symbols, remove the
now duplicated translation units as linking bf_guardedalloc has
seemingly not caused any issues.
Pull Request: https://projects.blender.org/blender/blender/pulls/120490
Bone collections are drawn in the new tree view by accessing properties
from `armature.collections_all[...]`, which means that drivers and
fcurves also target those. This is now taken into account when updating
the bone collection name.
For context: in Blender 4.0 the UIList used `.collections[...]` instead,
for which renaming was already handled properly.
Pull Request: https://projects.blender.org/blender/blender/pulls/120517
Use versioning code to change Drivers & F-Curves targeting
`armature.collections[...` to target `armature.collections_all[...`
instead. The former contains the root collections only, whereas the
latter contains all of them in a flat list. Not only does this fix the
tree view (it binds to properties via the `.collections_all` RNA path),
but also this makes the drivers & animation of the properties work even
when the hierarchy changes.
Note that both `.collections` and `.collections_all` give access to all
bone collections. The former just requires iterating hierarchically,
that is, via `some_collection.children`.
Pull Request: https://projects.blender.org/blender/blender/pulls/120514
Adds support for subpass transition for AMD/Intel IMR
GPUs. This enables correct functioning of EEVEE Next
deferred lighting pass on AMD platforms.
The emulation is consistent with the OpenGL approach
of generating additional texture bindings in the shader
for subpass inputs, and splitting render passes across
sub-pass boundaries.
Authored by Apple: Michael Parkin-White
Pull Request: https://projects.blender.org/blender/blender/pulls/119784
`interpolate_curve_attributes()` did not transfer `cyclic` attribute to
target curves. This fixes the the problem and allows Interpolate
Curves node to interpolate cyclic curves and also work between a cyclic
curve and a non-cyclic curve.
Pull Request: https://projects.blender.org/blender/blender/pulls/120460
This adds operators to add a bezier and circle primitive in curves
edit mode. The operators support the same settings as in the
legacy curve edit mode. The `shift+A` shortcut is added as well.
Pull Request: https://projects.blender.org/blender/blender/pulls/120513
`BKE_animdata_fix_paths_rename` would tag the owner ID itself
(`ID_RECALC_SYNC_TO_EVAL`) upon renaming when a corresponding fcurve was
found/fixed, however the action itself wasnt tagged. "The action is an
own datablock, meaning, changes to f-curves need to copy those changes
to all evaluated versions of the action datablock" (wording from
4045730d58).
(this is also the reason the action would "fix" itself after entering
tweakmode on it in the NLA, since that ripples down to
`ANIM_list_elem_update` -- which does the tagging on the action then).
Part of #104055
Pull Request: https://projects.blender.org/blender/blender/pulls/120292
Collections which were pointed by a modifier used to follow visibility of the
current object, and this visibility is static throughout the lifetime of the
dependency graph.
Change the code so that collections pointed by modifiers rely on the visibility
flushing, allowing to be optimized out from evaluation.
Pull Request: https://projects.blender.org/blender/blender/pulls/120516
`editmesh_active` theme is used to for active mesh element.
`vertex_active` is unused here (only used in graph editor) so remove it
from the 3d viewport and UV editor theme.
Found this in #119640
Pull Request: https://projects.blender.org/blender/blender/pulls/119649
Instead of using `MEM_callocN` to create an array of `BeztMap`
use a `blender::Vector`. This has the advantage that we don't need to worry about
freeing the memory.
In addition to that it can be passed as a `Span`, removing the need to pass the
length as a separate argument.
Doing that also allows to use the C++ syntax for `for` loops.
This also gives a small performance boost
| Before | After |
| - | - |
| 288ms | 260ms |
Pull Request: https://projects.blender.org/blender/blender/pulls/120507
MoltenVK original intent was to let developers work on a mac system developing
for the vulkan eco-system. MoltenVK doesn't support all the features that we
require and would require additional workarounds to be actually supported.
It is not expected that we will release Blender with MoltenVK for this reason.
But it still has value for shader developers to validate shaders on metal and
vulkan on a single platform.

Pull Request: https://projects.blender.org/blender/blender/pulls/117940
Specializing other frequently used film parameters
results in an additional ~20% uplift in film pass
performance. Measured on Apple Silicon.
Authored by Apple: Michael Parkin-White
Pull Request: https://projects.blender.org/blender/blender/pulls/119736
Removes the implicit USAGE_ATTACHMENT flag from
atomic fallback textures which are buffer-backed.
This usage flag results in a validation failure, and is
not required by these textures as they are cleared
via the backing buffer.
Authored by Apple: Michael Parkin-White
Pull Request: https://projects.blender.org/blender/blender/pulls/119785
It was mostly correct, except for the case where a user sets an
empty string as the export filename. What was happening is:
- STL exporter invocation adds ".stl" extension, so the path becomes
foo/.stl
- Code tries to replace extension with "ObjectName.stl", but
BLI_path_extension_replace sees that the filename part starts with
a dot and thinks the ".stl" part is the whole filename, not the
extension
- Resulting path thus becomes "foo/.stlObjectName.stl"
If the theme's name was changed, resetting the default theme did
nothing from a user perspective.
Internally it would add the Default theme to the end of the list where
it was ignored, then the default theme overwrote the data including the
next/prev links causing the ListBase to be invalid.
Resolve by ensuring the default theme is always first and use the
MEMCPY_STRUCT_AFTER macro to prevent links being overwritten.
Adds an (empty) sculpt mode for Grease Pencil v3 objects.
The object `SCULPT_GPENCIL` mode is re-used for Grease Pencil object
types. A `SCULPT_GREASE_PENCIL` context mode has been added, which is
specific to grease pencil objects. This is necessary for polling tools
and keymaps.
Pull Request: https://projects.blender.org/blender/blender/pulls/119338
When using Collection export skip drawing certain operator properties
which shouldn't apply for this style of export.
These suppressed properties were mentioned a few times while gathering
feedback for the feature and they are ignored internally when using
collection export anyhow.
This PR is another step in the refactor described by #116901.
This change applies to the triangle index buffer. The main improvement
is the ability to recognize when the mesh corner triangles index array
can be uploaded directly (when there is a single material and no hidden
faces). In that case the index data should be copied directly to the
GPU rather than to a temporary array owned by the IBO first. Though
that isn't implemented yet since it will be handled by the GPU module
later, the code is now structured to make that change simple from the
data extraction perspective.
Other than that, the main change is to not use the extractor iterator
framework anymore, and to set index data directly instead of using GPU
API functions. Though we're mainly bottlenecked by memory-bandwidth
anyway, it's nice to avoid function call overhead.
We also now avoid creating the array of sorted triangle indices when
there is a single material and no hidden faces. And we don't use
restart indices for the single-material case anymore. For Metal that's
nice because we can avoid `strip_restart_indices`.
I didn't notice significant performance improvements in my test files
beyond a few percent here and there. With a hacked implementation of
the copy-directly-to-the-gpu optimization, I did see more consistent
improvements though.
Pull Request: https://projects.blender.org/blender/blender/pulls/119130
Due to legacy reasons (`MEdge`), edge calculation was being done with
idea that edges cannot be temporarily copied. But today, edges are just
`int2`, so using `edge *` instead of `edge` actually made things worse.
And since `OrderedEdge` itself is the same thing as `int2`, it does not
make sense to use `Map` for edges. So, now edges are in a hash set.
To be able to take index of edges, `VectorSet` is used.
The only functional change now is that original edges will be reordered
as well. This should be okay just like an unintentional but stable
indices change.
For 2'000 x 2'000 x 2'000 cube edges calculation, change is around
`3703.47` -> `2911.18` ms.
In order to reduce memory usage, a template parameter is added to
`VectorSet` slots, so they can use a 32 instead of 64 bit index type.
Without that, the performance change is not consistent and might not be
better on a computer with more memory bandwidth.
Co-authored-by: Hans Goudey <hans@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/120224
Change Console and text editor cursor color to match that of
widget_text_cursor. Console cursor is currently red which we normally
use for error conditions.
Pull Request: https://projects.blender.org/blender/blender/pulls/120491