When working with the Paint BVH, we mostly want to operate on the
existing set of nodes stored in the Tree, even when parititioning and
creating new nodes. Adding `NonCopyable` to the base `Node` class
prevents a subtle class of errors early where a copy is made instead of
acquiring a reference.
Pull Request: https://projects.blender.org/blender/blender/pulls/135547
The main issue of 'type-less' standard C allocations is that there is no check on
allocated type possible.
This is a serious source of annoyance (and crashes) when making some
low-level structs non-trivial, as tracking down all usages of these
structs in higher-level other structs and their allocation is... really
painful.
MEM_[cm]allocN<T> templates on the other hand do check that the
given type is trivial, at build time (static assert), which makes such issue...
trivial to catch.
NOTE: New code should strive to use MEM_new (i.e. allocation and
construction) as much as possible, even for trivial PoD types.
Pull Request: https://projects.blender.org/blender/blender/pulls/135747
Rather new code to build the asset library reference from a library
didn't cover the case where the current file library is saved to disk,
and as such implemented as on-disk library.
Possibly broken by acd1b0b7f9.
Though returning a collection property from an RNA function doesn't
seem to have been used before. The mistakes are relatively obvious.
The RNA parameter list data isn't initialized so placement new and
calling the CollectionVector destructor manually are necessary.
This fix is necessary for #135734 which is targeted at 4.4.
Pull Request: https://projects.blender.org/blender/blender/pulls/135746
The main issue of 'type-less' standard C allocations is that there is no check on
allocated type possible.
This is a serious source of annoyance (and crashes) when making some
low-level structs non-trivial, as tracking down all usages of these
structs in higher-level other structs and their allocation is... really
painful.
MEM_[cm]allocN<T> templates on the other hand do check that the
given type is trivial, at build time (static assert), which makes such issue...
trivial to catch.
NOTE: New code should strive to use MEM_new (i.e. allocation and
construction) as much as possible, even for trivial PoD types.
Pull Request: https://projects.blender.org/blender/blender/pulls/135744
Incorrectly changed in 9e8c037375.
The Grease Pencil `eraser_brush` property is still accessed and set
directly from Python, we cannot remove setting access to the property in
favor of the `AssetWeakReference` without first making other changes.
For now, this patch re-adds the RNA definitions for the property to make
it editable again.
Pull Request: https://projects.blender.org/blender/blender/pulls/135743
When setting these materials, then removing the modifier, usercount
would be decreased, resulting in possible dataloss on reload
Affected were:
- all Grease Pencil modifiers material influence materials
- `LineartModifier` `target_material`
- `OutlineModifier` `outline_material`
These were all using `IDWALK_CB_USER` which ends up decrementing
usercount in `modifier_free_data_id_us_cb` when the modifier is removed
So to resolve, decrement/increment material usercount in
`rna_GreasePencilModifier_material_set` appropriately
NOTE: previously, it was also doing `id_lib_extern` on the object?!
(should be on the material, no?)
NOTE: still not 100% sure where we actually use refcounting (esp. in
modifiers) and where we dont, another alternative is to just drop it and
use IDWALK_CB_NOP` (instead of `IDWALK_CB_USER`) for these materials.
Pull Request: https://projects.blender.org/blender/blender/pulls/135729
Crash occurs due to channeltype ANIMTYPE_GREASE_PENCIL_DATABLOCK added
to the filtered list when rearranging nla strips. This channel seems
unnecessary, it has caused crashes in past as well (d943c9f128). Animation data
on object other than drawing-keys are already handled by `animfilter_block_data`.
Pull Request: https://projects.blender.org/blender/blender/pulls/135375
In Grease Pencil length modifier, if a stroke is not filtered, it
may not have a valid point count/offset. This fix ensures that we
get valid point count by copying it beforehand.
Pull Request: https://projects.blender.org/blender/blender/pulls/135733
When duplicating a scene in any way other than Full Copy, the VSE data
is (apparently) not copied along. To prevent dangling F-Curves, any
animation of sequencer strips is removed. This is now done correctly for
slotted Actions, instead of looping over the legacy `action->curves`
field.
Also the F-Curve RNA path that's being tested for is updated. Instead of
deleting all F-Curves with `sequences` in the name, the code now
correctly looks for `sequence_editor.strips_all`.
Pull Request: https://projects.blender.org/blender/blender/pulls/135576
Fix a crash when the Scene's Action has F-Curves targeting the VSE
sequencer strips, but the scene has no VSE data at all.
This issue occurs in the following way:
- Scene uses VSE, with an animated strip.
- Duplicate the scene using Linked Copy. This does _not_ copy the VSE
into the duplicate scene, but does include its animation (due to a bug
for which a fix is coming).
- Ensure the Dope Sheet is visible & showing the scene animation.
Pull Request: https://projects.blender.org/blender/blender/pulls/135576
Caused by 4bf34d9591.
Nodes within frames were ignored because previously their location was
relative to the frame, so moving both the frame and the node would cause
"double" movement. Now each node location is independent.
Grease Pencil dash modifier wasn't merging strokes from strokes that are
unfiltered, resulted in only filtered strokes being shown afterwards.
This fix joins generated strokes with what's left behind so there's no
stroke missing.
Pull Request: https://projects.blender.org/blender/blender/pulls/135705
Grease Pencil dash modifier wasn't merging strokes from strokes that are
unfiltered, resulted in only filtered strokes being shown afterwards.
This fix joins generated strokes with what's left behind so there's no
stroke missing.
Pull Request: https://projects.blender.org/blender/blender/pulls/135705
Reduce size of last endpoint gizmo on line primitives `size_primary` 8.0f
to be the same size of `size_tertiary` 3.0f. Circle and Box primitives are
unchanged as they don't have endpoints and a bigger gizmo doesn't affect
visibility. Motivation for this change is to increase visibility of the endpoint
while drawing since the default is too big for these type of lines and it
blocks the view of it.
Pull Request: https://projects.blender.org/blender/blender/pulls/135658
The curve widget in the redo popup would sent an undo push which it
shouldn't really. Since 1bde901bf2 such undo pushes will lead to
clearing of the last operation data, which is exactly what the redo
popup displays.
Buttons in operator redo UIs shouldn't send undo pushes. 179169d6c7
disabled them for the "Adjust Last Operation" panel, but not for this
redo popup. In fact there was other code to disable undo for these
buttons, but 2d2f23de10 put this into a wrongly scoped conditional
branch, so it was only executed on the first full redraw.
We can revert 179169d6c7 too now (confirmed already), but I'll do that
separately and not in the release branch.
Confirmed that the following related issues are all (still) fixed with
this:
- #55348
- #134505
- #135655
Pull Request: https://projects.blender.org/blender/blender/pulls/135730
Since the introduction of e53ac805af, viewer and previews were not
computed when rendering, because we assumed those would only be useful
during interactive compositing. But we received multiple reports that
this is broken. So users generally expect rendering to compute viewers
and previews.
This patch makes a distinction between background rendering and F12
renders, where the latter computes viewer and previews. This should not
have significant effect on the render time, because typically viewer
results are already computed as part of computing composite results.
Pull Request: https://projects.blender.org/blender/blender/pulls/135723
Use anonymous namespace to prevent naming collision allocating
structs of the same name.
Should resolve#134419 although I was unable to redo this bug.
Ref !135726
In the case of interpolating from a single-point curve to a larger curve
the interpolation tool did not fill the destination indices and factors
arrays, because the "segments" count is zero.
Handle this as a special case to avoid breaking assumptions in the rest
of the sampling code.
Pull Request: https://projects.blender.org/blender/blender/pulls/135720
The issue was that the multiframe editing toggle is a tool setting and not
stored in the object data anymore (which was changed in 4.3 so that users
don't have to toggle it in every object).
The batch caches of all Grease Pencils will include the multiframes even
when they are not active.
This leads to the issue that inactive objects don't rebuild their batch cache
when the setting is toggled and we access memory that is out of bounds.
To fix this (for now), toggling the multiframe setting tags all the Grease Pencil
IDs for an update. Obviously this is less than ideal, but the safest option as
of right now.
In the future, we should create a batch cache for each frame.
Then the render engine can request each frame when it's needed,
and we no longer need to tag all the objects for an update when
the setting changes.
Pull Request: https://projects.blender.org/blender/blender/pulls/135636
This was cause by the legacy undo recreating the depsgraph for
every update.
Depsgraph is recreated for each undo step which make the update
counter stay at 1. The fix is to protect for this case using a
global atomic counter.
The Mix Color shader node does not retain the alpha channel of the first
input in both the Linear Light and Soft Light modes, while it is retain
for other modes. Further, result clamping also ignores the alpha due to
using the vector clamp function, which introduces implicit conversion
that removes the alpha.
This does not matter for EEVEE because it does nothing with the alpha
channel. But the code will now be shared with the compositor, which does
care about the alpha channel. So adjust the code accordingly to retain
the alpha in those cases.
Pull Request: https://projects.blender.org/blender/blender/pulls/135632
Blender already had its own copy of OpenSubDiv containing some local fixes
and code-style. This code still used gl-calls. This PR updates the calls
to use GPU module. This allows us to use OpenSubDiv to be usable on other
backends as well.
This PR was tested on OpenGL, Vulkan and Metal. Metal can be enabled,
but Vulkan requires some API changes to work with loose geometry.

# Considerations
**ShaderCreateInfo**
intern/opensubdiv now requires access to GPU module. This to create buffers
in the correct context and trigger correct dispatches. ShaderCreateInfo is used
to construct the shader for cross compilation to Metal/Vulkan. However opensubdiv
shader caching structures are still used.
**Vertex buffers vs storage buffers**
Implementation tries to keep as close to the original OSD implementation. If
they used storage buffers for data, we will use GPUStorageBuf. If it uses vertex
buffers, we will use gpu::VertBuf.
**Evaluator const**
The evaluator cannot be const anymore as the GPU module API only allows
updating SSBOs when constructing. API could be improved to support updating
SSBOs.
Current implementation has a change to use reads out of bounds when constructing
SSBOs. An API change is in the planning to remove this issue. This will be fixed in
an upcoming PR. We wanted to land this PR as the visibility of the issue is not
common and multiple other changes rely on this PR to land.
Pull Request: https://projects.blender.org/blender/blender/pulls/135296