Commit Graph

120089 Commits

Author SHA1 Message Date
Bastien Montagne
155e540eb7 Fix (unreported) ID copied in libs making their depencies directly linked.
Not really critical in current main, since such 'copying in library'
behavior is fairly rare, but once it start being applied to e.g.
geometry IDs owning shape keys, it would make Blender unhappy because
unlinkable IDs (the shape keys) would be tagged as directly linked.
2025-05-27 18:34:51 +02:00
Jacques Lucke
1a4c16a784 Geometry Nodes: initialize String node when using link-drag-search
This is similar to how Value/Vector/Integer/... nodes are automatically
initialized when they are created using link-drag-search.

Strings require some special case handling here but that seems fine. The
`node_socket_move_default_value` function is already fairly specific for the
different value nodes.

Pull Request: https://projects.blender.org/blender/blender/pulls/139478
2025-05-27 17:05:32 +02:00
Jacques Lucke
43617743af Geometry Nodes: add error message when simulation is in loop or closure
This is not something we support currently. Before, the simulation would just
not do anything. Now there is an error message.

In theory, a limited version of that could be supported eventually but it does
not have high priority currently. The tricky aspect of supporting this is that
each simulation has a cache, can be baked etc and we need a persistent identify
for those. That's not possible if simulations can be added and removed
dynamically all the time.

Pull Request: https://projects.blender.org/blender/blender/pulls/139479
2025-05-27 15:03:06 +02:00
Habib Gahbiche
06d8cd74a7 Fix: compositor gizmos sometimes have no effect
After exposing options as inputs, the following gizmos may be drawn but
have no effect when tweaked:

- Sun beams
- Ellipse mask
- Box mask
- Split

This patch hides the gizmo when the relevant node inputs are linked

Pull Request: https://projects.blender.org/blender/blender/pulls/139491
2025-05-27 14:58:26 +02:00
Habib Gahbiche
5f6f5d28df Fix: Gizmo for Crop Node is broken
The wrong cursor is drawn and the gizmo is never shown.

Also fixes the warning `Gizmo .. has matrix that could not be inverted`
when using the crop node.

Pull Request: https://projects.blender.org/blender/blender/pulls/139394
2025-05-27 14:05:13 +02:00
YimingWu
16210c21e6 Fix: Win32 include error
Previous commit introduced an include which should only take
effect on windows, now put in the `#ifdef _WIN32` block
2025-05-27 19:00:30 +08:00
YimingWu
4b03d3cc21 Fix: Win32 compiling issue for readimage.cc
Needs to include "BLI_winstuff.h" for the SEH to work.

Caused by 34cd681a48
2025-05-27 18:38:27 +08:00
Omar Emara
aa657bab1d Compositor: Rename Suppress to Clamp in Glare node
This patch renames the Suppress input to Clamp, which was done after
feedback from users due to familiarity with Clamp from other places in
Blender.
2025-05-27 13:31:20 +03:00
Tom Martin
fd433a0a5c Python API: Grease Pencil: Add function set_vertex_weights on GreasePencilDrawing
This adds a new function `set_vertex_weights` to the `GreasePencilDrawing`.

Given an existing vertex group, this function writes the given weights to the
provided point indices.

Example code  for GP Stroke:
```Py
import bpy

ob = bpy.context.active_object

# Add a vertex group
ob.vertex_groups.new(name="Group")

# Get the drawing
frame = ob.data.layers.active.current_frame()
drawing = frame.drawing

# Set the vertex weights of points at index 0, 5, 10, and 15
drawing.set_vertex_weights("Group", [0, 5, 10, 15], [0.1, 0.2, 0.5, 1.0], assign_mode='ADD')
```

Pull Request: https://projects.blender.org/blender/blender/pulls/127216
2025-05-27 12:10:37 +02:00
Omar Emara
87f437eda6 Compositor: Hide value of Image Info node input
The Image Info node has no meaning when nothing is connected to the
input. So hide its value to make this more clear.
2025-05-27 11:46:50 +03:00
Anthony Roberts
32f7665673 Deps: Add support for ARM64 assembly in x264 and update FFmpeg version
It appears that previously, assembly was straight up disabled for all ARM64 platforms in x264 - this re-enables it.

This also updates the version of FFmpeg to 7.1.1. I updated the patch files so that they would cleanly apply to 7.1.1.

For Windows ARM64, it also switches both of these libraries to use the copy of LLVM we build as part of the deps, instead of MSVC - this gives a small performance increase. To do this for x264, I added a small patch taken from VCPKG - this should be harmless to other platforms.

With all these changes, I was able to get a ~20-30% perf improvement in video transcoding in the sequence editor.

Pull Request: https://projects.blender.org/blender/blender/pulls/137670
2025-05-27 10:20:48 +02:00
YimingWu
34cd681a48 Fix #139387: Try to handle mmap exception on Win32
`IMB_load_image_from_file_descriptor` use mmap to read images, and mmap
sometimes can have erroreous state llike accessing a file from network
drives. This patch tries to handle these exceptions like `BLI_mmap_read`
on Win32 (On unix the `sigbus_handler` will be called instead).

Pull Request: https://projects.blender.org/blender/blender/pulls/139472
2025-05-27 10:01:41 +02:00
Jeroen Bakker
5d0d54cc81 Fix #139284: Vulkan: Garbage collection not always run when rendering
During rendering when main thread is blocked or all screens are minimized the
garbage collection will not happen resulting in crashes as resources are not freed.

A better solution would be to do garbage collection in a separate thread but that requires a
ref counting system. The specifics of such a system is still unclear.

A possible solution for a Vulkan specific ref counting is to store the ref counts in the
resource tracker. That would only handle images and buffers, but it would solve the most
resource hungry issues.

Pull Request: https://projects.blender.org/blender/blender/pulls/139475
2025-05-27 09:39:54 +02:00
Omar Emara
c54e96dac3 Compositor: Use 2D/4D sockets in relevant sockets
This patch uses 2D and 4D sockets for relevant node sockets in the
compositor. This only on the UI side, internally, some of the sockets
still store 3D data, which will be handled in a later patch in the 5.0
release.

Pull Request: https://projects.blender.org/blender/blender/pulls/139452
2025-05-27 09:39:26 +02:00
Omar Emara
0dd4bba732 Fix: Typo in compositor Invert node 2025-05-27 10:15:16 +03:00
Germain-Le-Chapelain
4d4b7ab632 Cleanup: Remove redundant return statement
This if() block is unnecessary as `new_geometry()` is called anyways after that.

Signed-off-by: Germain Le Chapelain <germain.lechapelain@lanvaux.fr>
Co-authored-by: Germain Le Chapelain <germain.lechapelain@lanvaux.fr>

Pull Request: https://projects.blender.org/blender/blender/pulls/118176
2025-05-27 09:03:19 +02:00
Campbell Barton
f9842107aa Fix #136737: Periodic freezes in edit-mode with high poly meshes
Meshes with millions of vertices could freeze when storing
edit-mode undo steps. This occurred when de-duplicating boolean arrays
(typically selection & hidden data).

This problem occurred after v3.3 because vert/edge/face flags were
moved into their own boolean custom-data layers.

Resolve using run-length encoding, used to encode all boolean
custom-data layers before adding them to the BArrayStore.

The overall speedup depends on the order of elements in the mesh
as well as the previous state of the mesh used for comparison.

Testing box selection with subdivided cubes (3.9 million vertices)
shows a speedup from an around between 8..16 seconds to ~0.025 seconds.

Even though this ran in a background thread, adding undo steps
waits for the previous step to finish which could freeze.

Tweaks to BLI_array_store such as increasing the block-size used by
edit-mesh undo and increasing length of hashed data helped but didn't
resolve the issue, see: !138975.

See code-comments for details.
2025-05-27 15:48:53 +10:00
Campbell Barton
79eea8208d BLI_array_store: support run-length encoding / decoding
Add RLE encoding/decoding functions for byte arrays for the purpose
of pre-processing arrays with large spans of (mostly) uniform values
before storing them in a BArrayState.

Part of a fix for #136737.
2025-05-27 15:48:53 +10:00
Jacques Lucke
ae6aeb3cc3 Spreadsheet: garbage collect long unavailable columns
Previously, it was possible for the number of stored columns per table to grow
unbounded. While this likely isn't a problem in practice in most cases, one can
imagine cases where people temporarily have thousands of attributes when are
then never used again. We shouldn't have to store any data for these columns
forever.

This patch adds some simple garbage collection mechanism that keeps the number
of stored unavailable columns  per spreadsheet table below a certain threshold
(50 currently). Least recently used columns are removed first.

Pull Request: https://projects.blender.org/blender/blender/pulls/139469
2025-05-27 06:29:06 +02:00
Jacques Lucke
6f83928c6b Refactor: Geometry Nodes: extract warning type to separate file
It should be possible to use this type without having to include the
entire logging system.
2025-05-27 05:50:44 +02:00
Jesse Yurkovich
1e18fab838 Fix #139162: Exclude invisible point instancers during USD import
It was intended that pointers instancers would be skipped if they were
marked as invisible. However, we didn't account for the case of an
instancer using the "inherits" visibility but one of its ancestors in
the hierarchy being invisible.

Now these instancers will also be excluded. This is done by checking for
purpose and visibility earlier and halting the recursive traversal as
soon as we find a prim which doesn't meet the criteria.

Pull Request: https://projects.blender.org/blender/blender/pulls/139241
2025-05-26 21:31:34 +02:00
Aras Pranckevicius
3cb52b0a01 ffmpeg: faster high-bpp/HDR video decoding
Videos that are higher bit depth than 8 bit are decoded into floating
point formats (so anything that uses 10/12 bits or HDR). Speedup:
- Multi-thread GBRA planar -> RGBA interleaved conversion.
- If video is rotated, do the rotation step while doing the above
  conversion directly, instead of a separate rotation afterwards. Cuts
  down on memory bandwidth usage.

Playing back two 1920x1080 video tracks, where both are rotated and
H.265 10 bit HDR, on my PC (Ryzen 5950X), average playback frame time
goes 47ms -> 32ms (so 21FPS -> 31FPS)

Pull Request: https://projects.blender.org/blender/blender/pulls/139439
2025-05-26 19:34:22 +02:00
Jacques Lucke
66a5469bcf Spreadsheet: support restoring temporarily unavailable data columns
Previously, columns were removed from a table in the spreadsheet if they are not
available anymore. This also meant that their position and width was lost. When
the same column became available again, it was inserted at the end.

This patch makes it so that each table also remembers the columns that are not
available currently (and flags them accordingly). This way, the position and
width can be restored once the data becomes available again.

Pull Request: https://projects.blender.org/blender/blender/pulls/139440
2025-05-26 19:16:20 +02:00
Jeroen Bakker
6b1ef63f4d Fix: Vulkan: Swapchain validation
On selected platforms there were some validation errors. It was caused by
platforms that returned a different number of swapchain images then were
requested. In that case the semaphores can get out of sync.

Current mechanism isn't future proof as the max number of images are
statically defined.

For this change the present semaphores is also separated from the frames
to better support out of order swapchain images.

Pull Request: https://projects.blender.org/blender/blender/pulls/139446
2025-05-26 16:31:02 +02:00
Omar Emara
bab308bfa2 Compositor: Turn Blur node options to inputs
This patch turns the Blur node options to inputs.

Size is now a 2D vector and replaces the Size X and Y option. Bokeh was
renamed to Separable to reflect its actual function. Relative was
removed in favor of the newly added Relative To Pixel node workflow.

There is a slight difference in variable size blurring due to float vs
integer computations, so two tests were updated.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/139329
2025-05-26 16:18:48 +02:00
Jacques Lucke
87c011f8bb Nodes: minify value input nodes
This removes redundant labels from various input nodes like the Value, Integer
and Object node.

Design wise, this is mostly straight forward except for two aspects:
* Some input nodes some have a gizmo icon. In this case I just added the gizmo
  icon on the same row.
* The checkbox in the Boolean input node should probably still have a label, so
  I kept that.

Implementation wise this adds a new function to socket declarations that allows
us to override the draw behavior of individual sockets per node.

Pull Request: https://projects.blender.org/blender/blender/pulls/139432
2025-05-26 15:47:54 +02:00
Jeroen Bakker
4f76c75da2 Vulkan: Add ghost.vulkan logging
GHOST backend didn't use logging. This PR adds an initial ghost.vulkan
logging and improves the reporting of logging in vulkan.

logging can be enabled by `blender --log "gpu.vulkan,ghost.vulkan" --log-level 2`
it shows the optional extensions that are enabled and information about swap chain
events.

Pull Request: https://projects.blender.org/blender/blender/pulls/139437
2025-05-26 12:55:00 +02:00
YimingWu
802e887a01 Fix: MSVC Type promotion errors
Looks like newer versions of c++ doesn't want to implicitely do type
promotions from int to float. The patch fixes them.

Also fixed a typo `outter` -> `outer`.

Pull Request: https://projects.blender.org/blender/blender/pulls/139435
2025-05-26 12:26:16 +02:00
Omar Emara
02a95d088e Nodes: Add support for 2D and 4D vector sockets
This patch adds support for 2D and 4D vector sockets. The default value
structure for vectors was extended to include a new dimensions input,
which can be 2, 3, or 4. The default value was also extended to be a
float4, but only some of its components might be used depending on the
dimensions members.

Each vector subtype now has three variants ending with 2D or 4D as a
prefix depending on its dimensions, and the 2D/4D prefix was taken into
account for the socket type RNA enum functions.

All node systems currently always treat the vectors as 3D, but support
for it in the compositor will shortly follow in another patch.

Depends on #138805.

Pull Request: https://projects.blender.org/blender/blender/pulls/138824
2025-05-26 11:41:54 +02:00
Clément Foucault
eb37d19b41 GPU: Python: Raise error when creating shaders without create info
This is adding a hard error for backends do that do not supports it.
Even without this, the backend would return a nullptr. But the error
message in this case was just "see console for more details" without
any additional detail. Which was confusing.
2025-05-26 11:09:49 +02:00
Clément Foucault
8bba1c8056 Fix #139191: GPU: Blender crashes on startup with addons that use pyGPU shader
This was caused by missing `shader->constants`.
Creating an empty `SpecializationConstants` fixes the issue.
2025-05-26 11:09:49 +02:00
Brecht Van Lommel
afad355060 Fix: Properly free Vulkan interop handle for Cycles
Unlike OpenGL and Metal, this handle is not shared, but rather Cycles
has to take ownership of it. This required a fair amount of refactoring
to ensure the handle is closed, ownership is properly transferred, and
the handle is recreated once when the pixel buffer is modified.
2025-05-26 10:59:49 +02:00
Brecht Van Lommel
d2f883d8bc Fix: Cycles Metal graphics interop not working
It needs an MTLBuffer instead of a raw pointer.
2025-05-26 10:59:49 +02:00
Jeroen Bakker
505dd9249c Fix: EEVEE: Incorrect binding cryptomatte textures
The cryptomatte textures where optimized for samplers, but could trigger
UB as they are also used with load/store. This PR will change the
dynamic data type of the cryptomatte to always use RGBA32F.

Detected with Vulkan validation layers.

Pull Request: https://projects.blender.org/blender/blender/pulls/139427
2025-05-26 10:48:02 +02:00
YimingWu
2ed21d7b90 Fix: Viewport: Assert when drawing fly navigation aim symbol.
The `immVertex2i` calls in `drawWalkPixel` will now cause an assert in
`immAttr2i` after 617858e453 because the component types are more
strictly enforced. Now switch to using floats to avoid asserts and
potentially drawing garbage in the viewport.

Pull Request: https://projects.blender.org/blender/blender/pulls/139429
2025-05-26 10:32:39 +02:00
Omar Emara
c9ed2c28f3 Compositor: Add Dimensions output to Image Info node
This patch adds a new Dimensions output to the Image Info node. Contrary
to the Resolution output, the Dimensions output takes transformations
into account. So an image of resolution 512x512 that is scaled up by 2
would have a Resolution of 512x512 but a Dimensions of 1024x1024.

Depends on #138935.

Pull Request: https://projects.blender.org/blender/blender/pulls/139211
2025-05-26 09:58:19 +02:00
Damien Picard
ba45498955 I18n: Use context for node panel translation in material properties
This is a follow-up to 9ce0a2d1d5 and uses the same logic. It allows
translation of node panel labels inside the material properties, using
their specified translation context. Not in use currently, but may be
needed in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/139367
2025-05-26 09:36:04 +02:00
Omar Emara
a4502f82c1 Compositor: Add Image Coordinates node
This patch adds a new Image Coordinates node for the compositor. The
Texture Coordinates and Pixel Coordinates outputs were removed from the
Image Info node and were added to the new node instead. Additionally, a
new Normalized Coordinates output was added.

The Pixel Coordinates output now no longer includes half pixel offsets.

Pull Request: https://projects.blender.org/blender/blender/pulls/138935
2025-05-26 08:25:06 +02:00
Habib Gahbiche
8485d8a33c Compositor: Rename default node tree to "Compositing Node Tree"
Currently only visible in the tree path, but will be more noticeable
when node trees are not embedded anymore (outline and node editor).

Pull Request: https://projects.blender.org/blender/blender/pulls/139358
2025-05-26 08:24:56 +02:00
Oscar Blumberg
aa413a05bf Fix: Vulkan: Threading issue when waiting for submission
Usage of conditional to fix threading and performance delays when
waiting for the submission fence to become valid. The previous
(faulty) implementation didn't work well on WoA devices.
2025-05-26 08:20:09 +02:00
Jacques Lucke
98b888c163 Cleanup: Geometry Nodes: simplify accessing socket usage 2025-05-26 08:04:54 +02:00
Jacques Lucke
024f8a9595 Fix #139388: Nodes: Frame node with text has wrong margins and line breaks
This was caused by an oversight in ae5b83e4ef.
It first removed the `aspect` and then brought it back later on, but forgot
to use it in all cases.
2025-05-26 06:01:53 +02:00
Jacques Lucke
f66aa6529a Geometry Nodes: support panels and attribute/layer search in node group operator
Previously, the node group operator only had fairly basic flat drawing for the
inputs. Due to previous refactors, it's now possible to reuse the drawing code
of the Geometry Nodes modifier. That way the redo panel now has all the features
that also exist in the modifier. Also, future improvements will benefit both
systems and potentially more in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/139389
2025-05-26 05:44:59 +02:00
John Kiril Swenson
6bd750bc01 Fix (unreported): VSE: Strips not deselected on press
With #128051, the default timeline tool changed to
a `sequencer.select` on press with no associated
properties (before, it had `deselect_all`).

This meant that retiming key selection broke (as
reported in #129892) and strips would only deselect
on release if clicking into empty space (due to a separate
keymap item in the global sequencer keymap).

This patch reverts 97e44901b4 while keeping its fix,
in favor of a more robust solution (just add `deselect_all`
to the keymap item properties in the box select tool).
2025-05-25 16:22:16 -05:00
Jacques Lucke
64a13f4be2 Refactor: BLI: simplify extending get_default_hash function
This simplifies extending `blender::get_default_hash` to more than 4 parameters
by just adding extra factors to the list. The behavior should be the same as
before.

Pull Request: https://projects.blender.org/blender/blender/pulls/139392
2025-05-24 21:01:05 +02:00
Bastien Montagne
4baf428e5b Fix (unreported) BLO: Missing some blendfile version info in some Library Mains.
Readfile code would not always properly set the main file version number
in 'split' Mains created for a library, and would also not detect
'future versions' blendfiles.

This info is currently not used by linking code, so this should be a
no-op change in current main.
2025-05-24 20:55:42 +02:00
Jacques Lucke
a6486d11c2 Cleanup: add missing include 2025-05-24 18:55:53 +02:00
Jacques Lucke
d35351fdc8 Fix #139364: FileHandler example for shader editor does not work 2025-05-24 18:46:42 +02:00
Jacques Lucke
8ea045d299 Refactor: Geometry Nodes: extract modifier dependency from UI code
The goal is to simplify reusing the same code to draw the inputs of the node
tool operator.

This patch simply extracted all the modifier-specific code into callbacks which
are passed in from a higher level. The operator drawing code would basically
just need to provide different callback functions. Although some more additional
cleanups may become necessary to make that fully work.

Pull Request: https://projects.blender.org/blender/blender/pulls/139384
2025-05-24 17:11:25 +02:00
Guillermo Venegas
eed8e10b91 Refactor: UI: Remove uiItemIntO API
This function has not python equivalent, using the
returned pointer to write properties seems enough
as equivalent as how is done in python.

Also, this removes the unused `uiItemFloatO` API.

Pull Request: https://projects.blender.org/blender/blender/pulls/139355
2025-05-24 16:15:51 +02:00