Currently node tools always adds a dependency graph update tag. In
sculpt mode this causes the paint BVH to be rebuilt, which causes a
complete rebuild of the sculpt mode draw data. Both are quite expensive
relative to most other operations. Also, node tools currenly always
uses the "geometry" sculpt undo type, which causes its own depsgraph
update tag.
Arguably a depsgraph geometry reevaluation shouldn't cause a rebuild of the
BVH and draw data, but that's a limitation that's out of scope for now.
Most tools in sculpt mode avoid adding a depsgraph tag when they don't
change mesh topology for this reason.
This PR gives node tools the ability to check if the output mesh has a
different topology than the input. When the topology is the same,
we can use one of the specialized sculpt undo types for positions,
masks, or face sets. Though when more than one of these attributes changes,
we're still forced to still use the geometry undo type because sculpt undo
steps can only handle a single type of change.
In the end this results in much better performance for most simple node
tools that just deform the mesh or change masks or face sets.
Pull Request: https://projects.blender.org/blender/blender/pulls/133842
When calling the `lookup_or_add` functions on `MutableAttributeAccessor`
we need to make sure that the writer is actually created and the call
did not fail.
This fixes many of the instances where we would use an unchecked
attribute writer and potentially crash.
Pull Request: https://projects.blender.org/blender/blender/pulls/134413
This changes the ui-blocks buttons storage from Listbase to Vector.
Major changes that might cause a performance considerations are
in `ui_but_update_from_old_block` that requires to track buttons when restoring
button state between block redraws or in `uiItemFullR` that may needs to insert
uiButs in the middle of the vector to add decorators. This might not be as fast as
removing or inserting elements in the middle of a listbase container. Also buttons currently
don't know its position in the container, so to get the previous and next
button its required to make a lookup of the button in the container.
`UI_block_update_from_old> ui_but_update_from_old_block` restores the state
of buttons between frames, this is done by sequentially testing if a button is the
same as an old button, however since UI can be created procedurally some old buttons
may not be drawn while editing other button data, this requires an extra track of what
buttons may not match to a new button while comparing for restoring state, but still
this buttons may be candidates to match to an new button.
Not functional changes expected.
Ref: #117604
Co-authored-by: Julian Eisel <julian@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/127128
This fixes the (unreported) issue where solo'ing an NLA track would only
play back animation when _any_ of the tracks were unmuted.
Some code considered a track to be muted when its `NLATRACK_MUTED` flag
was set regardless of the `NLATRACK_SOLO` flag, whereas other code did
consider the `NLATRACK_SOLO` flag.
Now all the code is consistent with what actual animation evaluation is
doing.
Pull Request: https://projects.blender.org/blender/blender/pulls/134500
The UI code assumed buttons had no more than 4 elements
however Python scripts may define larger array sizes.
Resolve the bug by adding functions for array access that take an
array size limit to prevent buffer overflows (read & write).
Note that this only adds the "float" versions of these functions,
for completeness int & boolean can be supported as a separate commit.
A bit less trivial than usual, since it was an 'array' of non-trivial
structs. Used a `blender::Array` instead.
NOTE: keeping changes to a minimum, there is much to refactor and
cleanup in this code.
Add a new callback `setting_post_update` to the `bAnimChannelType`
that gets called after that setting was altered via the channel list
buttons and via `ANIM_channel_setting_set()`.
This is used when changing the NLA track SOLO and MUTE options, to
ensure that the dependency graph relationships get rebuilt.
This fixes#134190.
Pull Request: https://projects.blender.org/blender/blender/pulls/134347
Caused by 81a63153d0.
Previously this was done by BKE_objects_materials_sync_length_all.
Now that function only adds a tag when it actually does something.
This implements the memorization of the previous state of a space's
subtype for those that have multiple modes. Introduces an optional
space_subtype_prev_get callback, implemented for SPACE_ACTION,
SPACE_FILE, SPACE_GRAPH, SPACE_IMAGE and SPACE_NODE. This means we
can always return to the previous mode.
Pull Request: https://projects.blender.org/blender/blender/pulls/133846
Collapsing curves to a single point when just resampling is unexpected. This
patch changes it so that non-zero-length curves keep at least one segment.
The fix is fairly straight forward, but a bunch of additional code is added to
support the legacy option to avoid breaking backward compatibility.
Pull Request: https://projects.blender.org/blender/blender/pulls/133659
There was a missing call to `BKE_main_ensure_invariants` to make sure that the
node tree is in the expected state. I'm passing the `newid` to the function so
that it can skip iterating over all of `Main` in the majority of cases.
Pull Request: https://projects.blender.org/blender/blender/pulls/134446
Selection mask is included in the stroke interpolation tool in
297b97f2df, however sometimes there will
be mismatches for when start/end curve count isn't the same. This fix
ensures that the interpolation operator only works on the max amount of
curves that can fit in both start and end side of the interpolation.
Pull Request: https://projects.blender.org/blender/blender/pulls/134484
Reading & restoring RNA "writable" state wasn't working reliably when
Python was called from multiple threads.
- Resolve by acquiring the GIL before calling `pyrna_write_*` functions.
- Assert `pyrna_write_*` has the GIL to prevent this happening again.
- Move duplicate checks from bpy_props.cc into utility functions.
- Use new blender::transform namespace, to reduce verbosity
- Move snap_data allocation upstream, and use unified logic:
No points? Free data.
- Snap points are stored in Vector instead of Array to avoid
incrementing index.
- Point counting functions are removed. Vector size is not reserved,
since adding 10K points takes less than 1ms (AMD 5950X)
- Functions are renamed to avoid overly long names and make them as
distinct as possible.
New function naming scheme is:
`<what is done>_<sources/targets>_<timeline/preview>_<subcategory>`
for example `points_build_sources_timeline_retiming`.
Pull Request: https://projects.blender.org/blender/blender/pulls/134308
Translating keys when speed transitions are present with media not
matching scene FPS causes incorrect behavior.
This was caused by multiple issues - in some places media vs scene FPS
mismatch was not accounted for and multiple instances of presision loss
due to casting float values to integer.
Pull Request: https://projects.blender.org/blender/blender/pulls/131911
Connected strip status is critical information, maybe more important
than strip name. Therefore it should be drawn unless all overlays are
disabled.
This commit makes the icon visible in strip "header" area even if text
overlays are disabled. Content is maximized in this case, and the icon
is drawn over the content.

Pull Request: https://projects.blender.org/blender/blender/pulls/134432
When registering a class, warn if it's base-classes or sub-classes
are already registered as this is bad practice.
Currently the check only runs when the `--debug-python` argument is used
to avoid overhead on startup.