The `_EXCEPTION_POINTERS` structure is valid only within the context of
the `UnhandledExceptionFilter` function.
After the function exits, the memory referenced by the pointer might no
longer be valid or the exception information.
The solution for this was to create `BLI_system_backtrace_with_os_info`
and passing a system-specific data as the second argument.
`BLI_system_backtrace` calls `BLI_system_backtrace_with_os_info` with a
null second argument internally.
Pull Request: https://projects.blender.org/blender/blender/pulls/129999
d2a802d3c6 got overzealous by removing the "tweak" property which was
actually necessary to differentiate box select on click-drag vs. box
select on B. Fix by restoring the tweak property for everything but
preview keymap items (where it doesn't actually do anything).
Main reason this happened is because the original description was a bit
too cryptic, so update it to be clearer.
Pull Request: https://projects.blender.org/blender/blender/pulls/130015
Printf buffer read needs to be inside render boundaries
to work. Since render boundaries can be nested, use a stack.
Fixes assert when quitting blender.
The crash was caused by the texture wrapper being out of date.
This happened after workbench finished rendering AntiAliasing and
going into blit-result-only mode. Doing so was causing a use after
free caught by ASAN.
But this only partially fix the bug as workbench render then becomes
uninitialized (black most likely) after dragging the window to the
second monitor. This is because the TAA texture gets recreated since
the new viewport resolution doesn't match the old one. But this
recreation does not tag as a viewport update so the TAA stays in
blit-result-only mode.
Detecting the viewport resolution change at the engine init level
seems the safest option for now, and it fixes the remaining issue.
To be backported to 4.2.
Pull Request: https://projects.blender.org/blender/blender/pulls/130043
10ef436c8f sets the tooltip callback for asset shelf buttons, causing a
code path to be executed that refreshes tooltips in `UI_block_end()`.
This relied on projection matrices being stored for blocks to position
the tooltips, which were incorrect. I think this would be a general
issue for dynamically sized regions, but keeping the fix minimal for now
to avoid further issues.
Layers and layer groups did not generate message bus callbacks.
This was a regression from 4.2. The fix adds
`WM_msg_publish_rna_prop` to (some) places where the layers/groups
change or the active one changes.
Also resolves#129539.
Note: This does not cover every possible scenario and only fixes
the regressions from 4.2. The message bus is still very unreliable
when it comes to detecting changes of properties.
Pull Request: https://projects.blender.org/blender/blender/pulls/130039
The merge layer operator did not copy the parameters of the original
Grease Pencil meaning that it would e.g. loose onion skinning settings.
This fixes the issue by making sure to copy the parameters.
This was caused by 9a03f283e8.
The change disregarded the `orig_layers_to_apply` mask and
introduced some issues regarding clearing keyframes of deleted layers.
The fix does two things:
* Add a `orig_layers_to_apply` set that contains the pointers of the
original layers that we want to apply.
* Add a `orig_layers_to_clear` set that contains the pointers of original
layers that need their keyframe cleared.
When a layer is removed during modifier execution, we don't want
the layer to be deleted in the original geometry. Instead we clear
the keyframes by deleting all the curves geometry. A layer
can be removed by e.g. using the `Grease Pencil to Curves` node to
get curve instances, then the `Delete Geometry` node to delete
some instances, and finally `Curves to Grease Pencil` to convert back
to Grease Pencil.
Pull Request: https://projects.blender.org/blender/blender/pulls/130028
The list of vulkan devices is empty. This regression was introduced by
91960b07db. Vulkan needs to initialize the
platform twice. Once when the backend starts, and the second time when
the device is selected. The device list is added when the backend
starts, but was cleared when the device was initialized, making the list
empty.
Pull Request: https://projects.blender.org/blender/blender/pulls/130020
When gl_FragDepth is defined in the fragment shader and the depth isn't
written to the driver would reset the value to 0. This PR fixes this by
not putting the gl_FragDepth in the shader when it uses the
`depth_unchanged` qualifier or doesn't find any usage in the GLSL.
Pull Request: https://projects.blender.org/blender/blender/pulls/130016
&subdiv_ccg and node span in fill_mask_grids becomes invalid after
`BKE_sculpt_mask_layers_ensure` call (`sculpt->subdiv_ccg` pointer updated
in `BKE_scene_graph_evaluated_ensure`). To avoid this, move multires
reference and GridNode array after that function.
Pull Request: https://projects.blender.org/blender/blender/pulls/130014
Always use the Brush.color setting in the Draw mode side bar.
Technically the "Color" panel in the sidebar can draw in other modes,
but it's polling for explicit tools that limit it to the Draw mode
implicitly.
Use the appropriate brush or unified color in other GP modes based on
the unified paint settings flag.
Worth noting this was technically broken for a long time:
The default was that unified paint is disabled, so the GP panels would
use the brush color as expected. Enabling unified paint would then break
the colors, probably wasn't done very frequently since GP files
and e.g. mesh sculpting don't mix often. The default was changed in
#129127 to enable unified paint by default, which now breaks GP colors
by default.
Pull Request: https://projects.blender.org/blender/blender/pulls/129790
Applying a modifier on Grease Pencil objects tries to maintain the
original layer order by inserting each layer after the previous. This
ignores layer groups and all layers get move to the root group.
This patch replaces the simple `previous_node` with a per-group pointer
map, which maintains order within each group only.
The code is also creating new layers when the original node of the same
name is a group. This was creating duplicate names which are not allowed
and break various things (layer editing buttons, panel open/close
toggles, etc.). Now these new layer names are made unique to avoid a
name conflict.
One remaining issue is that mixed layer/group ordering is lost: All the
layers get pushed to the bottom of the stack, due to the way
`geometry::merge_layers` ignores layer groups. The existing groups in
the orig data are not sorted along with the evaluated layers, so they
move to the top of the stack. This requires changes to `merge_layers`
and should be handled separately.
Pull Request: https://projects.blender.org/blender/blender/pulls/129943
Earlier in the brush assets project, for mesh sculpting, grease pencil,
and curves sculpting, the toolbar brush icon used was changed to a
version with a green highlight. This commit reverts that change to use
the monochrome grey icon instead in each of these modes.
For Sculpt mode specifically, the Paint tool icon is kept as this green
version to differentiate the usages. In future releases, further changes
are planned for sculpting related brushes to better represent their
functionality.
---
### Sculpt Mode Toolbar

Pull Request: https://projects.blender.org/blender/blender/pulls/129934
In `execute_realize_grease_pencil_tasks` we create a new `GreasePencil`
but don't copy the parameters of (one of) the source grease pencils.
The fix adds `BKE_grease_pencil_copy_parameters` to copy the parameters
of the last src grease pencil.
Note: `BKE_grease_pencil_copy_parameters` copies the materials array. We
might want to remove this and always do the copy of this using a separate
function because some callers need their own way of copying them.
Pull Request: https://projects.blender.org/blender/blender/pulls/129977
Delete sceens when their workspace is deleted.
Also remove `IDTYPE_FLAGS_NEVER_UNUSED` tag from bScreen ID type, there
is no more point to keep these IDs around if they are not used, there
are supposed to be mere sub-data of the Workspaces.
Pull Request: https://projects.blender.org/blender/blender/pulls/129975
For Metal we can change the texture usage flags to get more optimal
behaviour - one example is adding the attachment flag so we can utilise
renders to do texture clears. However these usage flags are used as the
part of the match-criteria when trying to reuse released textures in
the texture pool.
The modifications means a request for the same type of texture will
fail causing a cache miss. When we render to an
image-view the texture pool is not released until the final sample has
been rendered as we consider the entire render to be a single frame
(as opposed to normal viewport rendering when we are presenting the
intermediate results).
This causes the texture pool to grow and grow and grow hence the large
memory usage. This fix splits the usage flags
into two sets, the internal ones we use to create the MTLTexture (which
we may modify) and the originally requested ones. The originally requested
ones are used for the texture pool matching.
This fix also improves memory efficiency for normal viewport rendering.
Mr Elephant Scene
Before -> After
Load scene in viewport: 13.04Gb -> 9.15 Gb
Viewport Render Image: 78.69Gb -> 16.61Gb
Authored by Apple: James McCarthy
Pull Request: https://projects.blender.org/blender/blender/pulls/129951
Brushes and changes done to them are preserved now when loading
different files (until Blender closes). Unpin and clear the material
assigned to the brush when loading a different file, since this material
is local to the previous file.
Pull Request: https://projects.blender.org/blender/blender/pulls/128080
GPv3 Undo loading code would not clear the active node pointer, leaving
it to point to an invalid (freed) memory, in case there is no active
node in the loaded undo step.
Pull Request: https://projects.blender.org/blender/blender/pulls/129918
Code detecting unused drawings and swapping them with a used one would
fail in a most basic case, leading to invalid state down the line:
```
[used_drawing, unused_drawing]
```
`unused_drawing` was not properly removed, as it is expected.
NOTE: Added an extra assert on (presumably) expected conditions of the
drawing indices and drawings array at the end of the process.
Co-authored-by: Lukas Tönne <lukas@blender.org>
Catch any exception from the JSON parser and handle it by returning a
null value from the deserialization function. Let the asset indexer
regenerate the index file to handle the error.
At least for the asset index case we don't care about the exact parsing
error, so this simple error handling strategy is fine. Should more
precise error reporting be necessary for other use-cases this can be
added still, but I think these errors are usually a bit too low level to
expose to users.
Pull Request: https://projects.blender.org/blender/blender/pulls/129879