Make use of the struct and patterns from 005e02d008 to make
the view places that deform shape keys more similar. While they each are
slightly different for valid reasons, with this change they follow the
same structure and use the same helper struct.
Pull Request: https://projects.blender.org/blender/blender/pulls/129901
The Merge-Down operator for layers was inserting existing layers first,
then appending the 2 merged layers at the end (top of stack).
Now merged layers are inserted at the position of the layer below the
active, so the layer order remains unchanged.
Note that merging a layer group has a similar issue, with the new
layers getting appended at the top. This is a bit more difficult because
looping only over layers drops the relative ordering of groups and
layers. A separate fix is needed for that.
Pull Request: https://projects.blender.org/blender/blender/pulls/130146
When a layer group was active, new groups would be created at
the top of the layer tree which is inconsistent with how layers are
added.
This fixes the behavior. When a group is active, newly added groups
are moved into that group.
The code that was updating the active node after removing a layer/group
was not handling all cases correctly.
The fix updates the logic for setting the active node:
1. If the node is a non-empty group and we're keeping the children, then set
the active node to the top node in the group.
2. Otherwise, if the node has a node below it (in the same group), set it to be the active one.
3. Otherwise, if the node has a node above it (in the same group), set it to be the active one.
4. Otherwise, if the parent is not the root group, set the parent to be the active node.
5. Otherwise, clear the active node.
This behaves the same as in Krita.
Pull Request: https://projects.blender.org/blender/blender/pulls/130126
The code was relying on the layer cache through `groups_for_write`/`layers_for_write`.
The `group->runtime->layer_group_cache_` stores all the child groups instead
of groups on first level. This leads to crash when recursively deleting
group i.e. group at third level has been deleted but `layer_group_cache_`
of first level group will still point to address of freed memory.
The fix removes the use of the cache and iterates over the direct
children in `group.children` and deletes them recursively.
Pull Request: https://projects.blender.org/blender/blender/pulls/130082
The code was relying on the layer cache through `groups_for_write`/`layers_for_write`.
The `group->runtime->layer_group_cache_` stores all the child groups instead
of groups on first level. This leads to crash when recursively deleting
group i.e. group at third level has been deleted but `layer_group_cache_`
of first level group will still point to address of freed memory.
The fix removes the use of the cache and iterates over the direct
children in `group.children` and deletes them recursively.
Pull Request: https://projects.blender.org/blender/blender/pulls/130082
The PBVH vertex positions accessor functions have to match the logic in
`sculpt_update_object`. When there were topology changing modifiers
before deform modifiers it didn't. `BKE_crazyspace_build_sculpt` just
skips the topology changing modifiers, and the resulting positions
are stored in `ss.deform_cos`, which we need to access here.
Pull Request: https://projects.blender.org/blender/blender/pulls/130139
The Join operator for Grease Pencil was making a shallow copy of the drawings
array, with the assumption that the source object would no longer be needed.
This is not the case, the source object is still in the blend data and still
shares the same drawings pointer as the target object. This is invalid, the
drawings should owned by one object.
To fix this the patch makes a deep copy of the drawings so the source and target
have their own sets of drawings. Data is still shared at the CustomData level,
so these copies are not very expensive.
Pull Request: https://projects.blender.org/blender/blender/pulls/130140
Check the error status from the function that updates the active vertex.
Also add `PROP_HIDDEN` to the operator's properties so the redo panel
doesn't show; that seemed extra weird to display on failure.
Pull Request: https://projects.blender.org/blender/blender/pulls/130142
When the duration of a frame is shorter than the build time specified in
the modifier, build modifier should shorten the build time to allow the
frame to be fully built within the frame duration. This fix made the
timing behaviour the same as GPv2.
Pull Request: https://projects.blender.org/blender/blender/pulls/129894
This moves from `GHash` to the type-safe and better-performing `Map`.
It uses the construct on first use idiom to simplify creation and freeing
of the map, removing the need to register an at-exit callback.
The change was initially motivated by seeing the hash lookups in a profile
of drawing a large node tree. Though my testing wasn't exactly scientific,
I did observe a few percent performance improvement with this change.
Pull Request: https://projects.blender.org/blender/blender/pulls/129954
Essentially, any operator modifying Blender data should enable this
`UNDO` option, else bad things (corruption, crashes...) are likely to
happen.
* Added a new Operator example to explain this topic.
* Updated some existing Operator examples that were not correct anymore.
* Added a new small section in the gotchas page linking to it.
* Added also short reminder about this in the `UNDO` 'tooltip'
description itself.
Related to #77557.
This was added 7 years ago as 'safe' preservation of previous behavior,
when ID copying was refactored and more control was added over its
behavior.
However, it was never removed since then, even though `NO_PREVIEW` flag
has been part of the `LOCALIZE` copying behavior since many years.
So time to remove this enforced bahevior and use the API as designed. If
this causes new issues, they will have to be fixed in code calling the
ID copy API (most likely by simply adding the `NO_PREVIEW` flag to the
copy options).
The snap cursor internally snaps to the Face to define the occlusion of
the Grid or to calculate the "Surface" orientation set by the tool.
Even though this is not the snap point enabled by the user, this
internal Snap to Face takes precedence over the Snap to Grid that is
enabled by the user.
To solve this, the solution is to do a second snap test but now only to
Grid and using the hit point as a reference for the closest grid.
Also fixes Absolute Increment Snap not being detected as Grid by the
tool.
Pull Request: https://projects.blender.org/blender/blender/pulls/130092
This was caused by ba28469e, which subtracted the start of the
offsets array, so it can't be used for "max array size" any more.
Use the "last()" entry directly to correctly size the view
positions array.
Pull Request: https://projects.blender.org/blender/blender/pulls/130127
After applying fill tool, the `LEGACY_RADIUS_CONVERSION_FACTOR` was not
multiplied back so the value in the brush settings panel will become
smaller and smaller for each execution of the tool. Now fixed.
Pull Request: https://projects.blender.org/blender/blender/pulls/130120