This happend for meshes without UVs.
The call to `texpaint_request_active_uv` in
`DRW_mesh_batch_cache_get_surface_edges` is from 9c010c44f4.
Looks like this is not needed (assumed to be copy paste error).
Pull Request: https://projects.blender.org/blender/blender/pulls/134856
In the Vertex Weights panel of the 3D Viewport sidebar, allow for
normalization of vertex groups when any number of vertex groups are
locked.
As with other normalization operators that handle locked vertex groups,
locked weights are summed, and whatever space is left between that sum
and 1.0 is used to normalize the unlocked weights.
Pull Request: https://projects.blender.org/blender/blender/pulls/134535
Make `action_channelbag_ensure()` and `action_fcurve_ensure()` return a
reference. Earlier it returned pointer that should never be `nullptr`,
but in certain cases (which would indicate a bug, as the function's
preconditions aren't met) could technically still be a `nullptr`.
Instead, the preconditions are checked with `BLI_assert()`, and a
release build will simply assume that they are met. This simplifies the
code of the functions themselves, as well as the callers.
For reference: this was discussed in !134866.
No functional changes.
Pull Request: https://projects.blender.org/blender/blender/pulls/134918
Over time the `FCurveDescriptor` class has grown, and some concern was
raised (!134866) about the performance impact of passing it by value.
It's now passed by const reference instead.
No functional changes. I did find some non-`const` uses that are now
also `const`.
Pull Request: https://projects.blender.org/blender/blender/pulls/134913
Subdiv shader library contains an optional part that shaders can include.
As we are migrating each shader at a time there are now multiple PRs doing
the same thing. Best to add the changes to main already so it doesn't add
confusion during review.
Pull Request: https://projects.blender.org/blender/blender/pulls/134906
This commit contains the following changes:
* Reduces scope of variables where possible, joining declaration and
assignment where necessary.
* Uses const for parameters and local variables where possible.
* Uses static_cast or reinterpret_cast where possible.
Pull Request: https://projects.blender.org/blender/blender/pulls/130487
* Reduces scope of variables
* Joins declaration and assignment where possible
* Uses static_cast and reinterpret_cast instead of C-style cast
* Uses const where possible
* Uses reference instead of pointer where possible
Pull Request: https://projects.blender.org/blender/blender/pulls/134816
The `BKE_fcurve_bezt_shrink()` function had an artificial limitation to
only allow shrinking the `bezt` array. That limitation is now removed,
and therefore the function renamed to `BKE_fcurve_bezt_resize()`.
A note was added to the documentation that newly added array elements
should be initialized by the caller.
Pull Request: https://projects.blender.org/blender/blender/pulls/134864
Split the majority of `animrig::action_fcurve_ensure()` into a new
function `action_channelbag_ensure()`. This ensures that the Action has
a layer, keyframe strip, action slot, and channelbag for the given ID.
`animrig::action_fcurve_ensure()` now just calls into that function, and
then ensures that there is an F-Curve in that channelbag.
No functional changes.
Pull Request: https://projects.blender.org/blender/blender/pulls/134864
Followup to 48e26c3afe, and discussions in !134771 about keeping
'C-style' and 'C++ template type-safe style' implementations of our
guardedalloc separated. And it makes `MEM_freeN<T>` code simpler.
Also skip type-checking in `MEM_freeN<T>` only with MSVC, as clang-cl on
windows-arm64 does work fine with DNA structs using
`DNA_DEFINE_CXX_METHODS`.
Pull Request: https://projects.blender.org/blender/blender/pulls/134861
Hydra's viewport and final engines conflict on whether the rendering loop
is internal or external. The old approach works for Hydra Delegates that
converge with a single sample (hdStorm) but causes engines relying on sample
accumulation (hdEmrbee) to become stuck.
This minimal change retains compatibility with delegates like Storm while
replicating the behavior of the viewport engine in the final engine.
Pull Request: https://projects.blender.org/blender/blender/pulls/134804
The Grease Pencil extrusion operator didn't transfer the vertex group names
from the old `CurvesGeometry` to the new one, resulting in the `gather_attributes`
function not transferring the vertex group weights correctly. This PR adds
`BKE_defgroup_copy_list` to the operator to remedy this.
Pull Request: https://projects.blender.org/blender/blender/pulls/134695
This patch adds support for vector outputs in the Image node.
Previously, only float and color outputs were supported, and vector
outputs were implicitly treated as color ones.
Pull Request: https://projects.blender.org/blender/blender/pulls/134501
The interpolation tool is using stroke length to map points between strokes with
uneven number of points. This fails when a source stroke has zero length (all points
in the same location).
Added a special case check to ensure uniform mapping by index is used in this case.
Segment mapping has been moved to a separate function for clarity.
Pull Request: https://projects.blender.org/blender/blender/pulls/134849
Previously, the vector type in the compositor had 4-components to
accommodated float4 types, while the last component was ignored for the
rest of the vector types. But now that we have a dedicated type for
float4 in #134486. We can reduce that vector type to 3-components.
Pull Request: https://projects.blender.org/blender/blender/pulls/134570
This change migrates the first 2 subdiv shaders to use the ShaderCreateInfo.
Other shaders will follow in separate PRs.
- Should compile when using `WITH_GPU_SHADER_CPP_COMPILATION`
- A `subdiv_` prefix is added only to the functions related to `PosNorLoop`.
But eventually the prefix should also be added to other lib functions.
- Due to Metal restrictions `subdiv_set_vertex_*` is implemented using a
functional paradigma. Our Metal backend only supports `inout` qualifier
on thead local data structures.
Pull Request: https://projects.blender.org/blender/blender/pulls/134218
Fix an issue where the versioning of Action & slot assignments did not
use RNA properties to do the slot assignment. This caused certain
on-update callbacks to be missed, which in turn meant that an Action
constraint could remain disabled even though its action slot assignment
had been corrected.
This is now resolved by actually using RNA to set the assigned slot in
the versioning code.
Unfortunately that does mean that any reporting done will be by the
generic RNA code as well, and won't be specific to versioning. This
shouldn't be much of an issue in practice, as any warning was only shown
in the rare case of mis-matched `action.idroot` properties.
Pull Request: https://projects.blender.org/blender/blender/pulls/134759
This avoids computing the bounding box later (if the positions are not changed).
Since the positions are are zero, the bounding box is just the origin point too.
EEVEE crashes when it is not able to allocate buffers. Previously we had a
message showing to the user that it tries to allocate a texture larger than
supported by the GPU. But was not implemented for EEVEE-next. This fix will
add back this error message.

Pull Request: https://projects.blender.org/blender/blender/pulls/134725
When compiling shaders using GCC there are warnings about functions
being declared twice. This PR will remove those warnings as they are
false positives. The warnings exists to identify typing errors.
Pull Request: https://projects.blender.org/blender/blender/pulls/134832
The position attribute was not initialized in parallel. Also there was an accidental
single threaded copy of each attribute because a `std::move` didn't work because
the variable was `const`.
The compositor previously overloaded the vector type to represent
multiple dimensions that are always stored in a 4D float vector. This
patch introduce a dedicated type for float4, leaving the vector type to
always represent a 3D vector, which will be done in a later commit.
This is not exposed to the user as a separate socket type with a
different color, it is only an internal type that uses the same vector
socket shape and color.
Since the vector socket represents both 4D and 3D vectors, code
generally assumes that such sockets represents 3D vectors, and the
developer is expected to set it to a 4D vector if needed in the node
operation constructor, or use the newly added skip_type_conversion flag
for nodes that do not care about types, like the File Output node.
Though this should be redundant once we add a dimension property for
vector sockets.
Pull Request: https://projects.blender.org/blender/blender/pulls/134486
The main goal of these changes are to improve static (i.e. build-time)
checks on whether a given data can be allocated and freed with `malloc`
and `free` (C-style), or requires proper C++-style construction and
destruction (`new` and `delete`).
* Add new `MEM_malloc_arrayN_aligned` API.
* Make `MEM_freeN` a template function in C++, which does static assert on
type triviality.
* Add `MEM_SAFE_DELETE`, similar to `MEM_SAFE_FREE` but calling
`MEM_delete`.
The changes to `MEM_freeN` was painful and useful, as it allowed to fix a bunch
of invalid calls in existing codebase already.
It also highlighted a fair amount of places where it is called to free incomplete
type pointers, which is likely a sign of badly designed code (there should
rather be an API to destroy and free these data then, if the data type is not fully
publicly exposed). For now, these are 'worked around' by explicitly casting the
freed pointers to `void *` in these cases - which also makes them easy to search for.
Some of these will be addressed separately (see blender/blender!134765).
Finally, MSVC seems to consider structs defining new/delete operators (e.g. by
using the `MEM_CXX_CLASS_ALLOC_FUNCS` macro) as non-trivial. This does not
seem to follow the definition of type triviality, so for now static type checking in
`MEM_freeN` has been disabled for Windows. We'll likely have to do the same
with type-safe `MEM_[cm]allocN` API being worked on in blender/blender!134771
Based on ideas from Brecht in blender/blender!134452
Pull Request: https://projects.blender.org/blender/blender/pulls/134463
The File Output node crashes when saving a 16-bit vector image in an
RGBA image. That's because the OIIO writer assumes 4-channel buffer
while the buffer provided by the node is only 3-channel. To fix this,
the OIIO writer is extended to support all possible combination of
source and target channels.
Pull Request: https://projects.blender.org/blender/blender/pulls/134789
In the past, around the time that 2.80 was released, 4a08b974f4
introduced the idea of filtering out certain editor changes inside
the paint modes and edit mode (e.g. changing brush sizes in the editor).
This commit is the first in a series to attempt to refine this behavior
so that only certain editor settings are filtered out from the undo
stack.
In total, it does the following:
* Adds the Brush datablock to the list of IDs that do not have undo
pushes.
* Adds support to filter out RNA structs that do not have the
`STRUCT_UNDO` property applied (currently, just the 3D Cursor).
This has the following effects:
* Changing brush settings inside the Image Editor no longer causes
undo pushes, becoming consistent with the other paint modes.
* Changing brush settings while in object mode in the outliner data
block view no longer causes undo pushes.
Co-authored-by: Campbell Barton <campbell@blender.org>