Commit Graph

150077 Commits

Author SHA1 Message Date
Campbell Barton
e58574e1aa Cleanup: minor corrections to code-comments 2025-04-02 03:02:03 +00:00
Campbell Barton
90fd070c28 Cleanup: spelling in comments (make check_spelling_*) 2025-04-02 03:02:01 +00:00
Campbell Barton
f89cf19ba6 Cleanup: indentation for CMake files, strip trailing space 2025-04-02 03:01:59 +00:00
Richard Antalik
144b1a7d56 Fix: VSE crash when moving retiming key
Caused by not checking against key array size. The issue was introduced
in ee9e4ead8d. It looks like mistake done during refactoring, because
the code was supposed to fix previous transition segment, not only the
next one.

The previously code attempted to reduce levels of indentation, but it
was less readable and error prone. Now it should be more obvious what
the intent is.

Pull Request: https://projects.blender.org/blender/blender/pulls/136743
2025-04-02 03:20:51 +02:00
Jonas Holzman
b26f755c1f CMake: macOS: Disambiguate OpenMP compiler check between LLVM Clang and Apple Clang
Disambiguates between Apple Clang 17 (based off LLVM 19) and LLVM
Clang 17. Although an LLVM Clang 17 build is unlikely currently to
succeed on macOS, the subtle differences between the two compilers can
easily led to confusion. So clearly indicate this fix only targets Apple
Clang.
2025-04-02 01:47:09 +02:00
Harley Acheson
8325e7f5e4 UI: Use busyButClickableCursor for MacOS Wait Cursor
MacOS is currently using one of our custom "hourglass" cursors during
busy times. This PR changes it to an OS-supplied cursor, a pointer
arrow with an animated blue spinner, meant for this purpose. Although
undocumented it has been used by many applications for many years.
Including Firefox for 11 years now.

Pull Request: https://projects.blender.org/blender/blender/pulls/136735
2025-04-02 01:30:13 +02:00
John Kiril Swenson
a1c7f6d3e1 Fix #136513: Add cursor snapping in VSE Preview
The bug was partially caused by the fact that
`translate_snap_increment_ex` would interpret sequencer-specific
snapping bit `SEQ_SNAP_TO_FRAME_RANGE` as `SCE_SNAP_TO_INCREMENT`. Add a
check to fix this.

Technically, #122759 never added snapping for cursors in the preview,
but we can take this opportunity to also add the support, which is
relatively simple.

Pull Request: https://projects.blender.org/blender/blender/pulls/136579
2025-04-02 00:21:17 +02:00
Sean Kim
ee62207e01 Cleanup: Various non-functional changes for sculpt tilt related methods
* Replace #define with constexpr
* Use float3 instead of float[3]
* Use C++ math library
* Use return values instead of r_ prefixed arguments
* Use const where possible

Pull Request: https://projects.blender.org/blender/blender/pulls/136851
2025-04-01 22:02:22 +02:00
Sean Kim
e1d3538980 Vertex Paint: Allow editor actions to create undo steps
Part of #131825

Currently, no change to an RNA property invoked from the UI while inside
Vertex Paint mode creates an undo step. This includes both tool
properties (e.g. brush size, tool settings) as well as mesh properties
(symmetry, active vertex group, selection mode).

This behavior was initially introduced to avoid creating extra undo
steps when painting or sculpting and changing tool settings, however,
it applied to all property changes performed while in any paint mode,
including changes to mesh datablock properties.

To fix this behavior, this commit removes the usage of the sculpt undo
system from Vertex Paint and removes it from the list of modes that
are incompatible with memfile undo.

This switch from Sculpt Undo to Memfile Undo improves the performance of
the undo operator from 90ms to 9ms, representing a 10x speedup.

This speedup is possible because Vertex Paint is not fully integrated
with the Paint BVH drawing system, which normally has the benefit of
skipping depsgraph reevaluation and subsequent BVH rebuilding on each
stroke.

Anecdotally, when painting with large strokes on a mesh of 2 million
vertices, this change to using Memfile undo also uses anywhere from
half as much to a third as much memory compared to the Sculpt Undo
implementation (6 GB vs 2 GB).

Pull Request: https://projects.blender.org/blender/blender/pulls/135830
2025-04-01 13:01:16 -07:00
Sean Kim
69f1e2e29d Revert "Vertex Paint: Allow editor actions to create undo steps"
This reverts commit 12bb22a130.
2025-04-01 13:00:11 -07:00
Sean Kim
12bb22a130 Vertex Paint: Allow editor actions to create undo steps
Part of #131825

Currently, no change to an RNA property invoked from the UI while inside
Vertex Paint mode creates an undo step. This includes both tool
properties (e.g. brush size, tool settings) as well as mesh properties
(symmetry, active vertex group, selection mode).

This behavior was initially introduced to avoid creating extra undo
steps when painting or sculpting and changing tool settings, however,
it applied to all property changes performed while in any paint mode,
including changes to mesh datablock properties.

To fix this behavior, this commit removes the usage of the sculpt undo
system from Vertex Paint and removes it from the list of modes that
are incompatible with memfile undo.

This switch from Sculpt Undo to Memfile Undo improves the performance of
the undo operator from 90ms to 9ms, representing a 10x speedup.

This speedup is possible because Vertex Paint is not fully integrated
with the Paint BVH drawing system, which normally has the benefit of
skipping depsgraph reevaluation and subsequent BVH rebuilding on each
stroke.

Anecdotally, when painting with large strokes on a mesh of 2 million
vertices, this change to using Memfile undo also uses anywhere from
half as much to a third as much memory compared to the Sculpt Undo
implementation (6 GB vs 2 GB).

---

Similar to !135758

### Implementation Notes / Thoughts
An alternate approach to getting similar if not better performance in Vertex Paint mode is to integrate it with  `BKE_sculptsession_use_pbvh_draw` and `flush_update_step`, however this represents an unknown amount of work and does not reduce the number of consumers of Sculpt Undo. Given that the general direction in the module right now is to reduce dependency upon this system and migrate more to using Memfile undo where possible, spending extra effort on integration does not seem like the correct decision to make.

### Testing
* Verified undo step is created when selection mode is changed
* Verified undo step is created when symmetry is changed
* Verified undo step is created when active color attribute is changed
* Verified undo step is created when color attribute underlying data is changed

Pull Request: https://projects.blender.org/blender/blender/pulls/135830
2025-04-01 21:58:36 +02:00
Hans Goudey
541002ad32 Cleanup: Resolve missing declaration in curves NURBS knots code
Also rename the functions to avoid an unnecessary prefix.
2025-04-01 15:10:00 -04:00
Hans Goudey
c7dd2131f6 Cleanup: Pass ReportList to shape key function instead of operator
The operator should be a separate abstraction level than this sort of function.
2025-04-01 15:05:41 -04:00
Hans Goudey
b811282fda Cleanup: Replace weird update tag in Join as Shape Keys implementation
The scene isn't being changed here, especially object selection. The mesh
is being changed though (or rather its shape key data-block, but that really
means the objects using it need to be reevaluated). For some reason this
doesn't make a functional difference currently though.
2025-04-01 15:05:41 -04:00
Hans Goudey
e818a52926 Refactor: Various cleanups to ED_mesh_shapes_join_objects_exec
- Remove useless wrapper function that checked redundant invariants
- Use Vector instead of looping over context variable twice
- Use references instead of pointers
- Make variable names non-cryptic
- Remove useless comment
- Use continue instead of indenting the rest of loops
- Fix grammar and improve text in comment
2025-04-01 15:05:41 -04:00
Sean Kim
bd99c2f7e9 Sculpt: Adjust list of brushes that can use tilt functionality
Part of #82877

* Removed 'Clay Thumb' brush, as it calculates the tilt on its own
* Added 'Plane' brush as the generic version of flatten, fill, and
  scrape

Pull Request: https://projects.blender.org/blender/blender/pulls/136849
2025-04-01 20:46:15 +02:00
Laurynas Duburas
8f6af72a3f Curves: Custom NURBS knots
Adds new NURBS knot mode NURBS_KNOT_MODE_FREE. Knots are stored in
`CurvesGeometry::custom_knots`. Knot offsets binding them to their
curves are calculated at runtime and held in a cache. This commit adds
custom knots support to OBJ import. It is the only way create such
curves for now. Legacy curve's tools don't support this knot mode,
thus on any modification knots get regenerated and whole shape changes.
If to convert imported legacy curve to new curves, point deletion,
duplicate and extrude preserve custom knots.

Rel #99891

Pull Request: https://projects.blender.org/blender/blender/pulls/130132
2025-04-01 20:22:47 +02:00
Brecht Van Lommel
15e88be3a5 Fix #136798: Crash with subdivision and shrinkwrap depsgraph evaluation
Missing double checked lock in subdivision wrapper access.

Pull Request: https://projects.blender.org/blender/blender/pulls/136841
2025-04-01 18:48:58 +02:00
Hans Goudey
7a4ce4184d Shape Keys: Add "Duplicate Shape Key" operator
Part of #135095.

This operator just adds a copy the active shape key, including its
data and settings.

Pull Request: https://projects.blender.org/blender/blender/pulls/136785
2025-04-01 18:24:00 +02:00
Sergey Sharybin
a7e78dccb9 macOS: Disable OpenMP when using Xcode 16.3 / LLVM 17
The precompiled library uses incompatible ABI with this version,
leading to linking errors.

There is no easy short-term solution: as per documentation the
OpenMP library must match LLVM version. It is hard to achieve in
a way that both older and newer LLVM versions are supported: it
would need to be multiple OpenMP libraries pre-compiled and chosen
at the build time.

There are not that many places left in Blender when OpenMP is
still used, so it seems better to invest in getting of those
remaining cases. The most challenging one would be Eigen, but
need to check whether the code-paths that are used from Eigen
even contain OpenMP.

Pull Request: https://projects.blender.org/blender/blender/pulls/136828
2025-04-01 18:22:25 +02:00
Sergey Sharybin
484c1b8cd1 Fix: Compilation error with XCode 16.3
Currently linking will fail if OpenMP is used. It will be addressed in a separate PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/136816
2025-04-01 18:13:42 +02:00
Clément Foucault
b06223d865 Fix #136831: GPU: Crash on Mac trying to draw an empty batch for shader
Cause by trying to deference a null batch.
In normal case, these calls never create a command
and are discarded early. 4.4 introduced the
polyline_draw_workaround to remove the use of geometry
shaders. These were not guarded against zero vertices
calls.

Adding an early out clause fixes the issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/136840
2025-04-01 18:11:37 +02:00
Sergey Sharybin
36559fd89f Fix #136811: HIP-RT performance regression in 4.5
Reduce the register pressure and branching in the switch() by using
subclass and cast from void* to the base class.

This ensures intersection functions are not inlined multiple times,
bringing performance back.

Alternative could be to avoid functions (they are quite large) but
that only partially resolves the performance regression.

Pull Request: https://projects.blender.org/blender/blender/pulls/136823
2025-04-01 17:59:44 +02:00
Miguel Pozo
4499ae4505 GPU: Use guarded alloc for backends 2025-04-01 17:34:35 +02:00
Hans Goudey
83325d1fd3 Refactor: Depsgraph: Use StringRef, inline some simple methods
While profiling a scene with many objects, I noticed some unexpected
functions taking a significant time of depsgraph creation/evaluation.
String length calculation and equality comparison was taking longer than
it should, and some simple methods were appearing in profiles that should
be inlined instead.

There are more places where this sort of change would be helpful, this
commit just changes places using `OperationIDKey` and `ComponentIDKey`.

Pull Request: https://projects.blender.org/blender/blender/pulls/136795
2025-04-01 17:30:39 +02:00
Thomas Dinges
3727c78bcf Build: Add new Manifold library
A geometry library for topological robustness, requested by the Modeling module to be used for Boolean operations.

Co-authored-by: Ray Molenkamp <github@lazydodo.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/135261
2025-04-01 17:17:49 +02:00
Jeroen Bakker
439a4e4687 Vulkan: Partial revert of swap chain refactor.
On Windows presenting mode mailbox would reduce lag. We might want to be
more selective on which mode to use when.
2025-04-01 16:33:31 +02:00
Sybren A. Stüvel
853640c063 Cleanup: clarify comment & variable in BKE_blender_cli_command_exec()
Just a little clarification. No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/136776
2025-04-01 16:30:01 +02:00
Clément Foucault
4b2cbf5d6f Fix #136810: UV: Wrong UV channel used for displaying UV edges
This was caused by the deinterleaved format being
incorrectly decoded by the `bind_attribute_as_ssbo`
function.

Accumulating the offset should be done for all attributes
and not only the one being used. Furthermore, this needs
to happen only once per attribute and not once per name.

Moving the offset computation out of the name loop
fixes the issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/136821
2025-04-01 16:16:20 +02:00
Philipp Oeser
f13bf270c6 Fix #136479: missing Image preview icons for certain render engines
If render engines dont specify `RE_USE_PREVIEW` / `bl_use_preview`, they
wont pass the `ED_check_engine_supports_preview` test.
That is mostly meant to tell blender this engine is capable of
generating (Material) previews and if it isnt, they will skip generating
button previews in `icon_preview_startjob_all_sizes`.

There are already exceptions for type of IDs that can still generate
previews (think Asset previews for Objects or Actions), so the same
exception can be made for Images and Brushes  as well (these previews
will just befulled from the Image buffer, that should not rely on the engine
whatsoever). We can also be permissive on Groups (they are treated
similar to Objects).

NOTE: this was reported for the Workbench engine, in another (future)
commit, we might even consider flagging that engine `RE_USE_PREVIEW` as
well (see comments in the PR)?

Pull Request: https://projects.blender.org/blender/blender/pulls/136824
2025-04-01 16:06:22 +02:00
Jeroen Bakker
aed9f22233 Refactor: Vulkan: swapchain
This PR refactors the way how swapchains are used.

Allow scaling of the swapchain content to the actual resolution of the swapchain.
can reduce artefacts when resizing windows when supported.

When frame rate is to fast the previous implementation could use a semaphore
that were still in use, leading to unwanted stuttering on certain platforms. Waiting
when the rendering has finished (GHOST_Frame.submission_fence), before the
next image is acquired from the swap chain.

Mailbox has been disabled as it can calculate more frames then actually been
presented, leading to a lag and increased  power usage on others.

Pull Request: https://projects.blender.org/blender/blender/pulls/136603
2025-04-01 16:01:22 +02:00
Jeroen Bakker
b3c4190cf7 Fix #134928: Vulkan: Out of bounds framebuffer region
When making a minimized window larger Blender can have negative regions.
This leads to out of bound writes when blitting to the framebuffer.

Easy reproducable on NVIDIA/Windows.

Pull Request: https://projects.blender.org/blender/blender/pulls/136832
2025-04-01 15:06:13 +02:00
Jacques Lucke
46fc5cb2cf Python: flush stdout and stderr after running Python script
When debugging with gdb in vscode, the stuff I print when executing a script in
the text editor does not show up in the terminal. It does work when I flush
explicitly though using `print(..., flush=True)`. This is quite annoying.

The solution is to always flush `stdout` and `stderr` automatically when running
a script. This is done using the CPython API, as just using
`fflush(stdout/stderr)` did not solve the issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/136632
2025-04-01 12:41:38 +02:00
Pratik Borhade
e6b89924a0 Fix: UI: Remove tree view padding on right
Extra padding is visible on right when scroll bar button is not
required. To fix this, add the new column along with scroll bar button.

Pull Request: https://projects.blender.org/blender/blender/pulls/136746
2025-04-01 12:27:48 +02:00
Campbell Barton
d60bbbbe63 Fix #136280: Select shortest path crashes in the UV editor 2025-04-01 21:16:08 +11:00
Philipp Oeser
92c777576c Fix #136312: Grease Pencil: SVG export wrong resolution in camera view
Also affected PDF export.

From 4.3 onwards, we were always exporting with a rect representing the
camera in screespace (just as drawn on the screen).
In 4.2, this was remapped to the camera resolution specified in the
Output Properties.
This also affected pixel aspect being ignored in 4.3.

To resolve, get both the render resolution and the camera rectangle in
screenspace and remap them accodingly.

Behavior when not in camera wasnt changed (this was the same in 4.3 and
4.2 in that it would take the framing rect of the object(s) in the
viewport as document size.

NOTE: this was already reported in #134309 (which ended up being closed
by a fix that wasnt really fixing the issue originally reported I think)

Pull Request: https://projects.blender.org/blender/blender/pulls/136770
2025-04-01 11:54:49 +02:00
Philipp Oeser
e348b46307 Fix #136784: Missing default for "wireframe_color_type" in a new window
Was missing a default since its implementation in 1f4c7a36df

Now added as a DNA default.

Pull Request: https://projects.blender.org/blender/blender/pulls/136813
2025-04-01 11:53:51 +02:00
Jörg Müller
57117497fe Audaspace: Synchronizer API change
Removes the playback handle from the synchronizer API and integrates it
into the device, removing the ISynchronizer interface completely.

This has been discussed in more detail in #126047 and its main purpose is to unify the handling of synchronizer events, especially seek which needed different logic for jack vs other backends.

OpenAL now needs a silence playback handle for synchronization but all
other backends are pretty straightforward just counting the mixed
samples in the SoftwareDevice with some specializations for specific
backends that had their own synchronizers before.

Note: CoreAudio changes are untested as I don't have a Mac.

Pull Request: https://projects.blender.org/blender/blender/pulls/133191
2025-04-01 11:28:08 +02:00
Xavier Hallade
17e0d88c05 Cycles: oneAPI: Avoid returning 0 from get_max_num_threads_per_multiprocessor
Instead of relying on the Intel extensions that may not be implemented,
we can use max_work_group_size until there is a better alternative.
Thanks to Codeplay for this proposal.

Co-authored-by: Georgi Mirazchiyski <georgi.mirazchiyski@codeplay.com>
2025-04-01 11:10:08 +02:00
Alaska
8e7640df6a Tests: Update reference images for stereo cameras
Due to changes in the bump mapping system, various tests had to be
updated.

It seems like the reference images for the stereo camera tests
weren't properly updated. So this commit fixes that.

Ref: blender/blender-test-data!79
2025-04-01 10:50:29 +02:00
Thomas Dinges
80db24671b Tools: Update platforms module ID in issues script 2025-04-01 10:36:50 +02:00
Campbell Barton
c8ff5f5c42 Cleanup: clarify naming for snap_selected_to_location_rotation
- Now snapping supports both location & rotation, rename variables and
  arguments to clarify which they apply to.
- Remove references to in variable names "cursor",
  a hangover from when this has hard-coded to use the 3D cursor.

Also use blender::float3 in more places.
2025-04-01 14:31:47 +11:00
Padraig O Cinneide
c8ab27c573 Modeling: "Snap to Cursor" now supports "Rotation"
Adds an operator setting to allow matching the rotation of the snapped
object to the rotation of the 3d cursor.

When the operators "Rotation" option is enabled, it will rotate selected
objects to match the current rotation of the 3d cursor.
Rotation modes and axis locking are respected.

If multiple objects are selected, they will all be set to the rotation
of the 3d cursor. There's an opportunity for future work on this for
the case where "offset" is toggled on as well, so that the location and
rotation of offset objects would be determined by rotating around the
pivot point.

Addresses #134863.

Ref: !134963
2025-04-01 14:04:27 +11:00
Richard Antalik
2f79f7987b Fix #136724: Retiming keys are covered by waveform
Issue was caused by d0cf4a4a8b, where retiming keys are covered by
waveform overlays, because their drawing is cached.

Move retiming key and continuity drawing after drawing quads.

Pull Request: https://projects.blender.org/blender/blender/pulls/136742
2025-04-01 04:37:27 +02:00
Campbell Barton
281cf7ff6d Cleanup: remove dead code from BLI_str_partition_ex
The check for `from_right` was always false.
2025-04-01 13:14:28 +11:00
Campbell Barton
8de112efc5 Cleanup: remove unused variables in mataflow 2025-04-01 13:11:17 +11:00
Campbell Barton
00deec7c66 Cleanup: spelling in comments 2025-04-01 12:37:36 +11:00
Campbell Barton
3e496a5dfe Cleanup: add missing doxygen file headers 2025-04-01 12:35:01 +11:00
Campbell Barton
7ae020ecd1 Cleanup: use our utility function to create a PyUnicode from a std:str 2025-04-01 12:33:56 +11:00
Campbell Barton
e3d6051181 Cleanup: suppress cast-function-type warnings for CLANG
Extend the existing GCC pragma's and add the warning suppression
for Cycles & Freestyle.
2025-04-01 12:06:03 +11:00