Commit Graph

152920 Commits

Author SHA1 Message Date
Campbell Barton
814eb05405 Tools: avoid redundant checks in code_clean for function-style-casts
Don't attempt to change `alignof(int)` or `(int);` to a function style
`int(...)` cast.

Avoid wasting time attempting edits that always fail.
2025-08-12 02:46:50 +00:00
Campbell Barton
6430d486cb Cleanup: quiet unused warning 2025-08-12 12:17:45 +10:00
Campbell Barton
eb57af250c Cleanup: consistent doc-string comment block style
Mixing different newline style with doc-strings is error prone.
2025-08-12 12:17:45 +10:00
Hans Goudey
d2cbb42937 Cleanup: Add null check in node tools eval log
Though this is always non-null currently AFAIK, there's no reason
not to add a null check for some safety in the rare case that no
logging evaluation happens before displaying the UI.
2025-08-11 21:57:51 -04:00
Namit Bhutani
4a8490f5bd Fix #144385: "Reorder Mesh Spatially" broken with loose vertices
Fixes missing isolated vertices in `mesh_apply_spatial_organization` by
ensuring non-added vertices (ones not forming a face) are appended to
new_vert_order, preserving correct vertex ordering for meshes with
disconnected geometry.

Pull Request: https://projects.blender.org/blender/blender/pulls/144388
2025-08-12 03:53:03 +02:00
Aaron Carlisle
0d8a19c790 PyDocs: Fix syntax formatting errors 2025-08-11 21:15:58 -04:00
Campbell Barton
1dd1073166 Cleanup: sort CMake file lists 2025-08-12 10:24:31 +10:00
Campbell Barton
729b76f454 Cleanup: use str.format to format strings in Python
Also replace redundant `{!s}` with `{:s}`.
2025-08-12 10:21:38 +10:00
Campbell Barton
c00dfded27 Cleanup: consistently hyphenate the term "swap-chain" 2025-08-12 10:12:19 +10:00
Campbell Barton
ab1027c777 Cleanup: capitalization of the term "VSync"
Follow the convention widely used by AMD/Intel/Nvidia.
2025-08-12 10:03:28 +10:00
Philipp Oeser
a5c402792d Fix #139182: Cannot remove material slot in certain case
One thing to keep in mind is that while `ob->actcol` is one-based (if
materials are assigned), `active_material_index` is zero-based so we
have a couple of places to make sure whenever materials are assigned,
we should always be in the range of `1..totcol` for `ob->actcol`.

In the particular case of the report, the last remaining material slot
was removed (`ob->actcol` gets rightfully zero then), but assigning a
material from the `template_ID` then calls `BKE_object_material_assign`
with zero as the active index.

The internal `act` number was corrected [ `std::max<int>(act, 1)` ],
but did not end up in `ob->actcol`.

`BKE_object_material_resize` [which all code assigning/removing/...
materials eventually comes down to] used to do the "sanitizing" actually
(but exited early when `totcol` didn't actually change).
There were other places to, clamping to a proper upper or lower bound.

So to resolve, move the code for sanitizing into its own function and
use it after `BKE_object_material_resize` (and from a couple of places).

Ref !143196
2025-08-12 09:48:49 +10:00
Sean Kim
8ee5fa0737 Cleanup: Use alphabetical order for _ui_tests_ category
Pull Request: https://projects.blender.org/blender/blender/pulls/144394
2025-08-12 00:56:45 +02:00
Jesse Yurkovich
5a5f768938 Tests: USD: Replace USDZ export test with another for better validation
Move the existing USDZ export test from C++ to Python for better
validation. The resulting file is now run through the `usdchecker`
system and we also check the contents of the resulting archive for the
expected texture file. This helped uncover a pathing issue in the
resulting archive where the 'textures' directory was misnamed on win32;
though it was still functional.

Pull Request: https://projects.blender.org/blender/blender/pulls/144176
2025-08-12 00:21:04 +02:00
Sean Kim
baf21e61f8 Fix: Use correct mode for pressure sensitivity in Vertex & Weight paint
Note, the previous state shouldn't have resulted in odd behavior, as
neither mode would be defined as a grab tool.

Pull Request: https://projects.blender.org/blender/blender/pulls/144379
2025-08-11 21:59:12 +02:00
Ramon Klauck
1a9817cdca VSE: add copy and paste operators to preview keymap
This feature allows the user to use `ctrl + C`, `ctrl + V` and
`ctrl + shift + V` directly in the sequencer preview. It adds these
operators also to the preview Strip menu.

It works the same as in the sequencer timeline.

Pull Request: https://projects.blender.org/blender/blender/pulls/143371
2025-08-11 21:40:04 +02:00
Brecht Van Lommel
402080f938 Tests: Remove broken image path in tests
This causes EEVEE tests to fail now that these are logged as errors and
`--debug-exit-on-error` is used when running tests.

Pull Request: https://projects.blender.org/blender/blender/pulls/144376
2025-08-11 21:18:38 +02:00
Jesse Yurkovich
225f6c8f94 Core: Don't get/set PWD env var for working directory functions
Depend only on `getcwd` and `chdir` rather than attempting to also
consider the `PWD` environment variable.

There's situations where these differ, and most easily seen when running
the Python tests. Calling `pathlib.Path.cwd()` will return something
like `/home/blender/git/blender-vexp/build_asserts/tests/python` while
PWD is `/home/blender/git/blender-vexp/build_asserts`. In this case,
calling `getcwd` will match what Python shows.

Additionally, this now matches what Windows and Mac do for these
affected APIs.

Pull Request: https://projects.blender.org/blender/blender/pulls/144235
2025-08-11 20:13:10 +02:00
Brecht Van Lommel
dce6269d1f Fix #143714: Cycles OptiX fails to render linear and ribbon curves together
This case was not accounted for previously, but is now possible when
the new curves object has curves with type poly.

Pull Request: https://projects.blender.org/blender/blender/pulls/144087
2025-08-11 19:36:26 +02:00
Namit Bhutani
91e081417c Fix #144309: Crash when using 'Reorder Mesh Spatially' on empty mesh
Pull Request: https://projects.blender.org/blender/blender/pulls/144372
2025-08-11 19:31:18 +02:00
Brecht Van Lommel
5afe338287 GHOST: Rename GHOST_VSYNC to BLENDER_VSYNC, change description
* GHOST is an implementation detail, Blender environment variables should
  have the BLENDER_ prefix.
* Don't put links in command line help output. We don't do this for other
  arguments either, and it's trivial to search for this online.
* Make description more straightforward and line wrap.
* Use CLOG for logging.

Ref #143049

Pull Request: https://projects.blender.org/blender/blender/pulls/144349
2025-08-11 19:03:58 +02:00
Brecht Van Lommel
f6c628e247 Refactor: Cycles: Compute shader usage of volumes earlier
This will be needed for volume null scattering.

Pull Request: https://projects.blender.org/blender/blender/pulls/144370
2025-08-11 18:57:51 +02:00
Aras Pranckevicius
961faca474 Cleanup: Cleanups in point cache code
- Make PTCACHE_COMPRESS_ an actual enum
- Clarify that while it looks like bitmask, it really is just an enum
- Make ptcache_file_compressed_write take similar arguments as
  ptcache_file_write (item count and item size)
- All callers of ptcache_file_compressed_write were doing compressed
  result memory allocation in exactly the same way; just make it happen
  inside the function itself. This also makes it no longer need
  the callers to do "is this zstd?" check around the call.
- The lzma "props" buffer was dynamically allocated for no good reason,
  just make it a simple array, and clarify the variable names.
- Remove BLI_assert_unreachable() from ptcache_file_compressed_read;
  asserts are for "impossible" situations; this one just happens any
  time one opens a 4.x file with caches in 5.0.

Pull Request: https://projects.blender.org/blender/blender/pulls/144193
2025-08-11 18:30:54 +02:00
Casey Bianco-Davis
aad88634b6 Fix #144307: Smooth brush uses selection even with mask is disabled.
The problem was that the function `smooth_curve_positions` would grab
the selection attribute instead of taking the current mask.

Pull Request: https://projects.blender.org/blender/blender/pulls/144316
2025-08-11 18:27:44 +02:00
Julian Eisel
6bbeac97fd Fix: RNA: Failing assert on console auto-complete
Looks like this was caused by 3de916ca25.

Steps to reproduce were:
- Switch to the Scripting workspace
- Paste:
  `C.screen.areas[5].spaces[0].rna_type.properties['show_region_asset_shelf'].`
- Press tab

The RNA property getter should always return a value, even when empty.
That's what other such getters do as well.
2025-08-11 18:27:22 +02:00
Hans Goudey
429dc0920c Fix #144362: Match string node crash after recent change
Caused by 76a861ab41
That commit used the wrong order internally for the "Operation" input.
2025-08-11 11:37:13 -04:00
Omar Emara
f1fb7171f1 Cleanup: Remove unused type handing in File Output node
The File Output node handles types that are not supported by the node,
so it is essentially dead code that can be removed.

Pull Request: https://projects.blender.org/blender/blender/pulls/144367
2025-08-11 17:34:27 +02:00
Omar Emara
c7b77b2b9f Compositor: Allow empty names in File Output node
The File Output node does now allow empty names for its sockets, so
doing things like flat RGBA pass in an unnamed layer is impossible,
which was possible before the recent redesign of the node. To allow
this, socket items accessors now have an option to allow empty names.

Implementation wise, the non-default variant of BLI_uniquename_cb was
used to make the empty name replacement optional. Incidentally, the new
function is more CPP friendly, so the MAX_NAME length limitation was
lifted.

Pull Request: https://projects.blender.org/blender/blender/pulls/144334
2025-08-11 16:49:24 +02:00
Miguel Pozo
f4dce7b4fa Fix: DrawTest.draw_pass_all_commands
The test expects `DRWState` to be a `uint32_t`,
but since the enum doesn't have an explicit type,
it can be compiled as an `int32_t`.

Pull Request: https://projects.blender.org/blender/blender/pulls/144219
2025-08-11 15:58:00 +02:00
Hans Goudey
62397597e8 Fix #144340: Potential deadlock in normals cache with no faces
The code path isn't well defined when there aren't any faces, causing
the vert, face, and corner normal caches to call each other, potentially
trying to lock the same mutex twice.
2025-08-11 09:37:21 -04:00
Falk David
6eea75e928 VSE: "Duplicate Strips" also duplicates referenced IDs
Duplicating a strip that references an ID like the scene strip would not
duplicate the scene. This is wanted in some workflows.

To align with the rest of Blender, this changes the behavior for how
strips are duplicated:
* `Shift + D` ("duplicate"): Duplicate the strip and also duplicate the
   IDs referenced by the strip. Currently this only affects `Scene`,
   `MovieClip`, and `Mask` strips.
* `Alt + D` ("duplicate linked"): Duplicate the strip, but reference the
  same IDs. This is the current behavior in `main`.

Part of #144063.

Pull Request: https://projects.blender.org/blender/blender/pulls/144138
2025-08-11 15:20:35 +02:00
Jacques Lucke
38f5e1f763 Refactor: Geometry Nodes: use SocketValueVariant for geometry sockets
This is similar to #144199. It needs a few more changes because more places
handle geometries in a special way compared to data-block sockets.

It might be that there are more usages of `GeometrySet` as value for geometry
sockets instead of `SocketValueVariant`. Unfortunately, there isn't really an
automated way to find these. So far I found all the places that needed fixing
through tests.

This is the last socket type that did not use `SocketValueVariant` yet. So
afterwards, it's likely possible to simplify a bunch of code to use
`SocketValueVariant` instead of `void *`.

Pull Request: https://projects.blender.org/blender/blender/pulls/144355
2025-08-11 15:18:08 +02:00
Bastien Montagne
307d0de26e Allocator: Add MEM_new_for_free to allow construction of almost-trivial types.
The data constructed by this call remains in the 'C-alloc' realm, i.e.
it can be `MEM_dupallocN`'ed, and `MEM_freeN`'ed.

This is intended as a temporary API only, to facilitate transition to
full C++ handling of data in Blender. It's primary target is to allow
pseudo-POD types to use default values for their members. See e.g.
!134531.

Unlike !143827 and !138829, it does not change the current rule (`new`
must be paired with `delete`, and `alloc` must be paired with `free`).

Instead, it defines an explicit and temporary API to allow a very
limited form of construction to happen on C-allocated data, provided
that the type is default-constructible, and remains trivial after
construction.

### Notes
* The new API is purposely as restrictive as possible, trying to
  only allow the current known needs (init with default member values).
  This can easily be extended if needed.
* To try to stay as close as malloc/calloc behavior as possible, and
  avoid the 'zero-initialization' gotcha, it does not use
  value-initialization, but instead default-initialization on zero-
  initialized memory.
  _Ideally it would even not allow any user-defined default constructor,
  but this does not seem simple to detect._

Pull Request: https://projects.blender.org/blender/blender/pulls/144141
2025-08-11 14:56:11 +02:00
Falk David
3c3615f3fb Fix #143720: Grease Pencil: Crash when loading file
During a short period (Blender 500 sub 33) the legacy custom data
struct was saved in an invalid state. This adds a check to
avoid crashing when loading a file that was saved during that time.

Pull Request: https://projects.blender.org/blender/blender/pulls/144337
2025-08-11 14:52:54 +02:00
Clément Foucault
ff09435496 Fix: GPU: Shader: Make shader parser less prone to out of bound issues
Use signed range and indices to avoid dereferencing tokens
before the start of the Token array.

# Conflicts:
#	source/blender/gpu/glsl_preprocess/shader_parser.hh
2025-08-11 14:32:27 +02:00
Clément Foucault
bbd2dcb02d GPU: Shader: Add support for full template specialization
As the title says.
The existing implementation did not support this.

Note that this doesn't support partial specialization.

See #137441 for the original implementation.

This is needed for #143582.

Pull Request: https://projects.blender.org/blender/blender/pulls/144212
2025-08-11 14:26:58 +02:00
Clément Foucault
ca57cf0750 Fix #144174: DRW: Base instance workaround not working
The part of the workaround that was inside the gpu module
was not updated.

Candidate for backporting to 4.5 LTS.

Pull Request: https://projects.blender.org/blender/blender/pulls/144346
2025-08-11 14:22:01 +02:00
Brecht Van Lommel
92b555452b Refactor: Logging: Replace more printf with CLOG
Mainly for images, and a few individual cases in animation, ply, UI, and WM.

Pull Request: https://projects.blender.org/blender/blender/pulls/143447
2025-08-11 14:07:45 +02:00
Brecht Van Lommel
1ebefb8252 Refactor: Logging: Use CLOG for video and ffmpeg
The --debug-ffmpeg flag now is the same as --log video, and only exists for
backwards compatibility. The ffmpeg verbosity can now be controlled with
--log-level.

Pull Request: https://projects.blender.org/blender/blender/pulls/143447
2025-08-11 14:07:45 +02:00
Brecht Van Lommel
af54152b45 Tests: Allow log errors from image loading tests
These include corrupt files, and with upcoming changes to use CLOG in more
places this would otherwise exit on such errors.

Pull Request: https://projects.blender.org/blender/blender/pulls/143447
2025-08-11 14:07:45 +02:00
Brecht Van Lommel
7acd5b3397 Fix: Image as planes add-on sets wrong alpha for OpenEXR files
This simply removes the operator property to set the alpha mode, so that
this can be automatically determined. The None case was already handled
by Use Transparency, and Channel Packed doesn't make sense here.

Ref #144009

Pull Request: https://projects.blender.org/blender/blender/pulls/144074
2025-08-11 13:58:47 +02:00
Clément Foucault
856a2a9f87 Fix: GHOST: Build error
Caused by aafef977fb
2025-08-11 12:39:37 +02:00
Christoph Neuhauser
aafef977fb GHOST: Add environment variable for enabling or disabling vsync
This PR proposes to add an environment variable for forcing vsync to
be on or off. My primary use case was to disable vsync for forcing
viewport rendering performance tests not to be capped at the display
refresh rate when #142984 is used for removing animation frame rate
limits.

I initially added the environment variable "GHOST_VSYNC_OFF", but
found "GHOST_VSYNC=0/1" to be more easily understandable.

Usage:
- GHOST_VSYNC=0 => Vsync is forced off
- GHOST_VSYNC=1 => Vsync is forced on

Pull Request: https://projects.blender.org/blender/blender/pulls/143049
2025-08-11 12:09:21 +02:00
Brecht Van Lommel
2193096106 Cycles: Change normal map node to work with undisplaced normal and tangent
This fits better with the way normal and displacement maps are typically
combined. Previously there was a mixing of displaced normal and undisplaced
tangent, which was broken behavior.

Additionally, to undisplaced_N and undisplaced_tangent attributes must now
always be used to get undisplaced coordinates. The regular N and tangent
attributes now always include displacement.

Ref #142022

Pull Request: https://projects.blender.org/blender/blender/pulls/143109
2025-08-11 12:08:12 +02:00
Christoph Neuhauser
d256cce766 Tests: Overwrite animation FPS limit in EEVEE performance tests
This PR overwrites the FPS limit in the EEVEE performance tests to 1000 FPS.

Background: I have been using the performance tests with, e.g., the Temple scene from the Blender demo files. However, it has configured an animation playback frame rate of 25 FPS. I think for the performance tests it would be more meaningful to render at an unlimited frame rate. Otherwise, one can just see that Temple renders at 25 FPS on pretty much any GPU and it is not possible to measure performance improvements or regressions.

Pull Request: https://projects.blender.org/blender/blender/pulls/142984
2025-08-11 12:07:29 +02:00
Clément Foucault
89d885d652 Fix #144054: EEVEE: Wrong Attribute loading caused by multiview
This was only affecting the shadow pass because it is the
only one to use multiview.

The `drw_ResourceID_iface.resource_index` was incorrectly
set up in the vertex shader to the already shifted index,
resulting in double shift which resulted in resource index
being 0 in fragment shader.

Candidate for backport to 4.5 LTS

Pull Request: https://projects.blender.org/blender/blender/pulls/144341
2025-08-11 12:05:18 +02:00
Brecht Van Lommel
809260885e Fix #143841: Cycles OptiX error adding AO shader with viewport render
Modify shader update so we simplify the graphs first to determine the
kernel features, then load the kernels, and only then update data on the
device. This avoids errors due to mismatched kernels and shaders.

Pull Request: https://projects.blender.org/blender/blender/pulls/144238
2025-08-11 12:05:16 +02:00
Sergey Sharybin
6993f445c6 Libx: Restore macOS libraries hash
It got accidentally changed in #144329.
2025-08-11 12:02:20 +02:00
Jeroen Bakker
1a958af106 Fix #142927: Sculpt artifact resizing dyntopo
When using the resize dyntopo operator the overlay helping to choose
the new size didn't work properly on AMD GPUs. The cause was that only 2
components of the line displacement was initialized.

Also fixes: #83623

Pull Request: https://projects.blender.org/blender/blender/pulls/144338
2025-08-11 11:12:59 +02:00
Bastien Montagne
601b7dbcbb I18N: Update UI translations from git/weblate repository (da8ebe3f8291a7). 2025-08-11 11:07:05 +02:00
Bastien Montagne
a1abf9a64e Fix #136020: Linking: Improve performances of many linked IDs relocation.
The remapping from old to new linked IDs was done one by one, with all
the related pre/post processing. In particular for objects, this could
easily lead to quadratic cost (need to loop over all objects for each
object)...

Solved by reworking the remapping logic in relocation code to process
all linked data in a single call.

From quick tests locally, it makes relocating a library with 10k object
got from 50s to about 5s.

A 40k linked objects case goes from 'way too long to measure' to about 4
minutes.

So there is likely still some things that could be improved here
(processing time still does not seem to be O(n)), but at least it's
usable now.

Pull Request: https://projects.blender.org/blender/blender/pulls/144207
2025-08-11 10:54:03 +02:00