Mistake in 437cb33a73.
Found while investigating #129504. Personally I don't notice
a change in behavior, but the original code, as convoluted as it
was/is, clearly tried to iterate over neighbors of neighbors rather
than iterating over neighbors twice.
Pull Request: https://projects.blender.org/blender/blender/pulls/129557
For cases where a small fraction of a PBVH node is processed,
missing skipping of vertices outside of the brush radius causes
a noticeable regression. Typically we tried to avoid this sort of
filtering because it should be redundant with lowering the BVH
node size and it interferes with some other code simplicity goals.
But adding factor filtering back is a very small change.
Prior to this commit, there was an attempt to remove extra data stored
at the Sculpt Undo `Node` level, specifically an extra position array
used when a deform modifier was in the stack.
The prior commit attempted to perform the undo step by calculating a
translation between the current positions and the previous unode
position and using that as the input to the deformation process.
However, this resulted in the undo not being completely applied to the
mesh and the data remaining in a weird state.
To fix this, this commit reintroduces some previously removed functions
and constructs to perform this restore step by swapping data if
necessary. We choose to not simply revert the change that applied this
as we want to eventually reinvestigate this path, but for the imminent
4.3 release, it makes more sense to restore previous behavior.
Pull Request: https://projects.blender.org/blender/blender/pulls/129496
The topology island cache needs to be freed when changing multires
levels so that it can be recalculated and be valid for a given level. To
fix this, this commit adds the `invalidate` call to the
`BKE_sculptsession_free_pbvh` method, which consolidates similar
lifecycle behavior.
Pull Request: https://projects.blender.org/blender/blender/pulls/129549
`select_handle` operator did return passthrough when retiming key was
selected. This was incorrect behavior. To prevent translating retiming
keys, retiming selection must be cleared as well.
Reported in #126273
Pull Request: https://projects.blender.org/blender/blender/pulls/129289
Prior to this commit, the brush action was determined on a step by step
basis by peeking at the `StrokeCache` `bstrength` property and
determining which brush to use based on if the value was negative or
not. The sign of this value, however, was not static across the
entirety of a brush stroke, as it is calculated from three separate
fields, one of which could vary over the course of a stroke when using a
tablet, the `pen_flip` property.
To fix this issue, this commit ensures the `pen_flip` field is only
updated at the beginning of the stroke and also adds a new boolean to
store the initial direction of the stroke to reduce further ambiguity
when comparing the sign of the brush strength.
Pull Request: https://projects.blender.org/blender/blender/pulls/129184
With the introduction of brush assets, there are now two reasons that
motivate turning this setting on by default.
* More paint brushes - Previously, there was a single paint brush in
Sculpt mode, this made the setting for general usage less needed when
compared to the 10 brushes that are now included in the essentials
pack
* Brush settings are lost on reload - Unless the changes to a brush are
saved to the asset as a default, the color for a brush is now no
longer persisted between Blender sessions. It makes little sense to
save a specific color for a specific brush on the asset level unless
it is needed for the brush functionality.
This commit ensures that the appropriate Scene flag is set for the
unified color and defines the default primary and secondary colors as
000000 and FFFFFF, respectively.
Pull Request: https://projects.blender.org/blender/blender/pulls/129127
In volume segment, the minimal angle formed by the emitter bounding cone
axis and the vector pointing from the cluster centroid to any point on
the ray is computed via `dot(bcone.axis, point_to_centroid)`, see Fig.8.
in paper.
For distant light this angle is 0, but due to numerical issues this is
not always true. Therefore explicitly assign `-bcone.axis` to
`point_to_centroid` in this case.
Pull Request: https://projects.blender.org/blender/blender/pulls/129489
Introduced by 5fff95f519.
The issue was that the `edit_points_vflag` buffer is of size `total_points_num`
which is based on the number of control points not evaluated positions.
The fix is to use `points_by_curve` instead of `points_by_curve_eval`
to get the right start and end indices.
Pull Request: https://projects.blender.org/blender/blender/pulls/129526
Sorting assets by catalog was introduced for the asset shelf in
471378c666. Intention was to keep related/similar assets closer
together. But the sorting was based on the catalog name only, so
the catalog order didn't make much sense, and closer related assets
would still end up being separated by less related ones.
Instead the full catalog path should be compared, so that the hierarchy
is reflected better, and for example sibling catalogs follow each other.
This way related assets are actually placed in close proximity, as
initially intended.
Pull Request: https://projects.blender.org/blender/blender/pulls/129469
Looks like some recent changes in the driver broke an assumption
the OptiX denoiser code in Cycles made about being able to set it up
with a different input size than later used to invoke it, which caused
broken output on older GPU architectures. This commit fixes that by
ensuring the input image size passed to `optixDenoiserSetup` matches
that passed to `optixDenoiserInvoke`, even when no tiling is used
(which is the common case).
Pull Request: https://projects.blender.org/blender/blender/pulls/129398
When the modifier is disabled with level 0, the corner_vert array
wasn't properly created in the subdivided mesh. The simplest
solution is to just skip the subdiv processing for the unwrap when
the level is 0 and nothing would happen anyway.
Pull Request: https://projects.blender.org/blender/blender/pulls/129447
Unwrapping warned that a non 0/1 boolean value was being set.
Initialize all members of PVert since they would be accessed
when duplicating a PVert causing the uninitialized memory to be read.
This "update object for edit" call is incorrect because it retrieves the
evaluated state for the object that the undo itself invalidates. The
object/modifiers must reevaluate before we rebuild the deformation
matrix array (which is the operation causing the crash).
Pull Request: https://projects.blender.org/blender/blender/pulls/129474
All sculpt and paint modes should have the brush selector asset shelf
popup in the tool settings header. For curves sculpt mode this was
missing. There's no good reason for this, probably just an oversight.
All sculpt and paint modes should bring up the brush selector asset
shelf popup on Shift+Spacebar. For grease pencil vertex paint mode the
shortcut was missing. I think it was added earlier, but only for the
grease pencil v2 keymap, the v3 one got merged later only.
The Cryptomatte node produces a bad output when the viewport is in
camera view. That's because compositing is limited to the camera region
in that case, but the node assumes the full viewport size. To fix this,
only consider the compositing region instead of the full viewport.
Introduced in 853269aeb0
Prior to this commit, the PBVH partitioning process did not work
correctly for multires meshes with materials. Specifically, it failed
upon mapping the partitioned faces into their corresponding corners.
The rough process here is as follows:
* Flatten out the array of face indices into an array of corner indices.
* Sum up each `GridsNode` `prim_indices` corner count into an array.
* Create an `OffsetIndices` from these sums
* Use the `OffsetIndices` to slice the array created at the beginning
to assign to each node.
However, this process requires that the main PBVH array of corner
indices has the same order as iterating over the nodes, which the
partitioning algorithm does not do.
To solve this, this commit iterates over the Node `prim_indices` `Span`s
in the same order that the nodes are stored when flatting out the
corner data, ensuring a correct mapping.
Pull Request: https://projects.blender.org/blender/blender/pulls/129392
The length checking wasn't accounting for null bytes within multi-byte
sequences and could step over the null bytes.
For BLI_strlen_utf8 this could result in an out of bounds read.
In practice most UTF8 data is validated so the extra checks
are mainly to prevent errors on invalid or corrupt UTF8 text.