Commit Graph

120055 Commits

Author SHA1 Message Date
Hans Goudey
0b891a68b1 Sculpt: Improve node tools performance for simpler changes
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
2025-02-14 16:45:50 +01:00
Falk David
2cc6f7bbb5 Fix #133339: Grease Pencil: Ensure span attribute writers are valid
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
2025-02-14 15:54:20 +01:00
Guillermo Venegas
7682258ff9 Refactor: UI: Use a Vector to store buttons in UI blocks
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
2025-02-14 15:29:26 +01:00
Sybren A. Stüvel
1feca529d8 Merge remote-tracking branch 'origin/blender-v4.4-release' 2025-02-14 14:00:16 +01:00
Sybren A. Stüvel
62c21a0800 Fix: NLA Track Solo flag handling, in depsgraph and F-Curve iteration
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
2025-02-14 13:55:44 +01:00
Campbell Barton
bc43b6be90 Merge branch 'blender-v4.4-release' 2025-02-14 23:37:41 +11:00
Campbell Barton
79627e353d Fix #134537: Crash accessing colors in the UI with more than 4 elements
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.
2025-02-14 23:33:54 +11:00
Bastien Montagne
8525c0a28b Merge branch 'blender-v4.4-release' 2025-02-14 13:00:24 +01:00
Bastien Montagne
248d858475 Fix (unreported) invalid C-style allocation of non-trivial C++ data.
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.
2025-02-14 12:59:54 +01:00
Sybren A. Stüvel
c74f9e65ec Fix #134190: NLA track not evaluating when toggling its 'mute' setting
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
2025-02-14 12:52:02 +01:00
Bastien Montagne
978f2d1caa Merge branch 'blender-v4.4-release' 2025-02-14 12:50:10 +01:00
Bastien Montagne
194e233d86 Fix (unreported) more invalid C-style allocation of non-trivial C++ data. 2025-02-14 12:23:38 +01:00
Ankit Meel
1a6800a11f Merge branch 'blender-v4.4-release' 2025-02-14 15:18:28 +05:30
Ankit Meel
13c3d95f52 Xcode/thumbnailer: rebuild error due to rpath
Fix duplicate rpath error on rebuild by using CMake target
property.

Pull Request: https://projects.blender.org/blender/blender/pulls/134527
2025-02-14 10:46:48 +01:00
Bastien Montagne
aaef10e99e Merge branch 'blender-v4.4-release' 2025-02-13 19:31:28 +01:00
Bastien Montagne
455d419f1e Fix (unreported) invalid C-style allocation of non-trivial C++ data. 2025-02-13 19:24:17 +01:00
Hans Goudey
8fed30aff2 Fix #134485: Missing depsgraph tag when assigning material
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.
2025-02-13 13:16:57 -05:00
Brecht Van Lommel
4786fbe774 Refactor: Remove extern "C" from most headers
The only remaining code in source/blender that must be compiled as C
is now datatoc generated code and the DNA defaults that use designated
initializers.

Pull Request: https://projects.blender.org/blender/blender/pulls/134469
2025-02-13 18:58:08 +01:00
Brecht Van Lommel
2fb6a30b23 Refactor: Build generated DNA files as C++
Pull Request: https://projects.blender.org/blender/blender/pulls/134469
2025-02-13 18:55:37 +01:00
Harley Acheson
83c94c6537 Merge branch 'blender-v4.4-release' 2025-02-13 09:46:08 -08:00
Fabricio Luis
afec64739a Fix #130372: Implements memory of the previous state of eSpace_Types.
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
2025-02-13 18:45:00 +01:00
Bastien Montagne
48636fcab4 Merge branch 'blender-v4.4-release' 2025-02-13 18:42:16 +01:00
Bastien Montagne
e30b78fec4 Fix (unreported) invalid usage of C-style allocation for non-trivial C++ data. 2025-02-13 18:41:41 +01:00
Jacques Lucke
1657545603 Merge branch 'blender-v4.4-release' 2025-02-13 16:48:12 +01:00
Jacques Lucke
808635e52a Fix #102598: Resample Curve node collapses curves to a single point
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
2025-02-13 16:47:10 +01:00
Jacques Lucke
39a5dc3edd Fix #134430: missing node tree update after copying data-block
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
2025-02-13 16:37:52 +01:00
Bastien Montagne
b6c06d13dc Merge branch 'blender-v4.4-release' 2025-02-13 13:48:51 +01:00
Bastien Montagne
343205a4da Fix (unreported) invalid mismatched usages of MEM_new/MEM_freeN. 2025-02-13 13:47:43 +01:00
Bastien Montagne
b94eefd283 Merge branch 'blender-v4.4-release' 2025-02-13 13:41:16 +01:00
Bastien Montagne
9ff4a52f8d Fix (unreported) invalid MEM_new/MEM_freeN mismatches. 2025-02-13 13:39:29 +01:00
Bastien Montagne
f3969bd1d2 Merge branch 'blender-v4.4-release' 2025-02-13 13:02:08 +01:00
Bastien Montagne
700db42976 Fix (unreported) invalid C-style allocation/freeing on non-trivial data.
`tGPsdata` embeds a `PointerRNA` member, which makes it non-trivial, and
requires it to use new/delete C++-style allocation handling.
2025-02-13 13:01:47 +01:00
YimingWu
ef844badd6 Fix #134482: Grease Pencil: Correct mask for stroke interpolation
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
2025-02-13 12:45:53 +01:00
Julian Eisel
cc8cc48a0a Cleanup: UI: Move related tree view functions closer together
These functions are closely related, keep them together.
2025-02-13 12:11:50 +01:00
Campbell Barton
8e8364f645 Merge branch 'blender-v4.4-release' 2025-02-13 20:48:23 +11:00
Campbell Barton
77eed053b2 Unbreak build WITH_PYTHON=ON & Python <= v3.12 2025-02-13 20:45:26 +11:00
Sergey Sharybin
0b369f0ff1 Fix compilation error on macOS after recent cleanup
Fixes the following error:
  error: must use 'struct' tag to refer to type 'timezone' in this scope
2025-02-13 10:28:39 +01:00
Campbell Barton
e52f85b33c Cleanup: move Python's GIL ensure/release to the function start/end
Avoid errors accessing state without the GIL (#127767) by moving
GIL ensure/release to the star/end of the function body.
2025-02-13 17:56:42 +11:00
Campbell Barton
886e40f136 Merge branch 'blender-v4.4-release' 2025-02-13 17:47:20 +11:00
Campbell Barton
39e23e29fe Cleanup: remove unnecessary call to PyGILState_Ensure
There is no need to aquire the GIL for Python methods.
2025-02-13 17:09:10 +11:00
Campbell Barton
516b39ad22 Merge branch 'blender-v4.4-release' 2025-02-13 16:57:40 +11:00
Campbell Barton
9222f157cb Fix #127767: bpy.app.handlers could run in a read-only state
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.
2025-02-13 16:53:27 +11:00
Campbell Barton
640e70b6e8 Cleanup: various non-functional changes for C++ 2025-02-13 13:33:09 +11:00
Richard Antalik
84358c5a3e Merge branch 'blender-v4.4-release' 2025-02-13 03:18:51 +01:00
Richard Antalik
789737c917 Cleanup: Refactor VSE snapping code
- 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
2025-02-13 03:17:49 +01:00
Richard Antalik
ee9e4ead8d Fix: VSE: Retiming key translation not working correctly
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
2025-02-13 03:16:29 +01:00
Richard Antalik
db2108dd89 Fix #134270: Connected icon hidden when text overlays are disabled
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.

![Screenshot_2025-02-12_04-50-14.png](/attachments/c2ad510b-388b-4e2f-b23c-3b494d559f38)

Pull Request: https://projects.blender.org/blender/blender/pulls/134432
2025-02-13 03:15:49 +01:00
Campbell Barton
e569417798 PyAPI: check registered classes don't depend on registered classes
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.
2025-02-13 13:04:50 +11:00
Campbell Barton
d0ac35eff4 Cleanup: add doxy-sections to bpy_rna.cc 2025-02-13 13:04:50 +11:00
Campbell Barton
c5a65ad9ed Merge branch 'blender-v4.4-release' 2025-02-13 12:01:00 +11:00