Commit Graph

120055 Commits

Author SHA1 Message Date
Campbell Barton
5d232486e6 Cleanup: minor clarifications in doc-strings for NDOF & OSKEY 2025-03-28 14:06:36 +11:00
Campbell Barton
38d9d971e5 WM: add a "Hyper" capability flag
Avoids the need to check against ghost backends.
2025-03-28 13:46:39 +11:00
Campbell Barton
894dca7f76 UI: correct the keymap editor to match the OSKEY label to the platform 2025-03-28 13:26:09 +11:00
Campbell Barton
46bfd3196d Cleanup: match wmEvent::modifier type for uiButHotkeyEvent::modifier_key 2025-03-28 01:58:11 +00:00
Pratik Borhade
28704a47a1 Fix #136157: UI: Eyedropper tooltip remains visible in non-active space
When mouse is moved from one area to other of same spacetype, previous
region is not redrawn. This results in tooltip being stuck at the edge of
previous area. In such case, send a redraw call to that region.

Pull Request: https://projects.blender.org/blender/blender/pulls/136168
2025-03-28 02:03:44 +01:00
Campbell Barton
b252a6c7fb Cleanup: various non-functional changes for C++ 2025-03-28 00:59:15 +00:00
Campbell Barton
69682c78f2 Cleanup: pass values by const reference 2025-03-28 00:59:13 +00:00
Campbell Barton
90287acff2 Cleanup: remove redundant null checks
Use references instead of pointers when assigning values from struct
members, then remove the null check.
2025-03-28 00:59:12 +00:00
Campbell Barton
12e17e2477 Cleanup: use const arguments, variables 2025-03-28 00:59:11 +00:00
Campbell Barton
460a05cbbc Cleanup: match declaration names 2025-03-28 00:59:09 +00:00
Sean Kim
25b6cecbb1 Cleanup: Consolidate symmetry iteration check
Removes the `SCULPT_` prefixed version and moves the function into
`paint_intern.hh` as it is shared across all mesh painting types
that support symmetry.

Pull Request: https://projects.blender.org/blender/blender/pulls/136638
2025-03-28 00:49:45 +01:00
Brecht Van Lommel
a02e0fa147 Refactor: Improve image buffer save/load function names and arguments 2025-03-27 22:07:51 +01:00
Brecht Van Lommel
124c0f1692 OpenColorIO: Support using file rules to detect colorspace
The Blender config.ocio does not have any rules, but custom ones can.

The default file rule is ignored if default_byte or default_float roles
exist. These roles are Blender specific, so would not be found in a typical
OCIO config. But when they are set appropriately, they help provide better
default guesses than what is possible with standard OCIO rules.

Pull Request: https://projects.blender.org/blender/blender/pulls/136516
2025-03-27 22:07:50 +01:00
Brecht Van Lommel
ccd7bc2078 Refactor: Modify colorspace handling for image buffer reading
The file formats now fill in ImColorSpaceInfo with the metadata colorspace
and a boolean saying if the pixels have HDR colors. And then the actual
colorspace is decided in imb_handle_colorspace_and_alpha.

This centralizes the logic in one place to make it possible to add
OpenColorIO file rules.

Pull Request: https://projects.blender.org/blender/blender/pulls/136516
2025-03-27 22:07:50 +01:00
Brecht Van Lommel
c225772735 Refactor: Initialize IMB module for image test
Needed for future changes, surprising that it worked without.

Pull Request: https://projects.blender.org/blender/blender/pulls/136516
2025-03-27 22:07:50 +01:00
Richard Antalik
972fda1a7d Cleanup: Refactor VSE effect input get function
Function `strip_effect_get_new_inputs` contained selection parsing and
error handling. It also returned values by setting 3 pointer addresses.

Split function to selection parsing which returns strips in container
and validation function, which returns error string if selection is not
valid. If selection is valid, empty string is returned

Pull Request: https://projects.blender.org/blender/blender/pulls/136474
2025-03-27 22:02:38 +01:00
Jacques Lucke
8b1add3346 Refactor: Geometry Nodes: support retrieving geometry set without applying subdiv
This should ideally be used more in Geometry Nodes to avoid realizing subdiv
on the cpu if it's not really necessary. However, fully supporting it require more changes
in places that actually need the final subdivided mesh.

This also extends the "to string" conversion for `GeometrySet` to include information
about the subdivision level.
2025-03-27 20:40:58 +01:00
Jacques Lucke
94edc7e77a Geometry Nodes: add utility to ensure that no geometry components are shared 2025-03-27 20:40:58 +01:00
Leon Schittek
695acd83a6 Fix: UI: Missing node socket outline in properties editor
Set the proper outline color when drawing node sockets with
`node_socket_draw`.
This was a regression introduced by commit `13e0077c5c`.

Pull Request: https://projects.blender.org/blender/blender/pulls/136578
2025-03-27 20:33:59 +01:00
Jacques Lucke
ce4a152c64 Geometry: avoid invalidating caches when transforming by identity
Transforming e.g. a mesh can invalidate caches like bvh trees. Therefore,
if it can be skipped, it should be skipped.
2025-03-27 19:41:30 +01:00
Sean Kim
d3d776fd3c Sculpt: Improve smooth brush performance with small radius
When using a small brush size, if enough latency is encountered,
sculpting can become unresponsive. See #131334 for more in-depth
information on this issue.

In general, this is most apparent to users with the Smooth brush and
any brushes with auto-smoothing enabled. Much of the work for this
brush action is in retrieving and averaging the neighboring vertex
positions. This is wasted work for vertices outside of the brush radius,
as ultimately they will have no displacement applied to them.

To help mitigate this performance regression, this PR adds a variant
of functions that calculate neighboring vertices that takes in the
precalculated `factor` to skip further processing. Additionally, some
methods are restructured to take advantage of this.

This change represents a speedup of 4x, from `0.40ms` without this
patch to `0.10ms` with it on a cube with 400k vertices and a brush
radius of 10px. For most brush size to BVH Node / Mesh ratios, we see
improvements, as we can avoid processing most nodes that a brush only
affects a small number of vertices of. For cases where the entire mesh
is affected by a brush, this patch does introduce a small but
measurable slowdown of 0.31ms to 0.33ms.

Ref: #136006

Pull Request: https://projects.blender.org/blender/blender/pulls/136274
2025-03-27 18:57:06 +01:00
Hans Goudey
091df9ebcc Cleanup: Use unique_ptr for sculpt drawing buffers 2025-03-27 12:44:16 -04:00
Hans Goudey
9f0847018c Cleanup: Use simpler index buffer creation functions 2025-03-27 12:44:16 -04:00
Jeroen Bakker
3885a37541 Vulkan: Initial OpenXR support
The Blender's VkInstance cannot be shared with OpenXR VkInstance. The
reason is a chicken and egg problem where OpenXR needs to be started
before Vulkan. OpenXR can add special vulkan specific requirements
(instance&device) that are only available when the user starts an OpenXR
session.

The goal implementation is to share memory between both instances using
[VK_KHR_external_memory](https://registry.khronos.org/vulkan/specs/latest/man/html/VK_KHR_external_memory.html) and related extensions. However this seems
to be a bridge to far as a initial step. Reason: There are not that many
samples/ guides and documentation to be found to handle the workflow that
we require. We want to do a smaller step by step approach to gain the needed
knowledge.

For that reason this PR does the most stupidest thing that can be done to
share memory between instances. Download the render result to CPU RAM share
the host pointer with the OpenXR instance which copies it to the swap chain.
Also the synchronization is done using wait idle commands.

<video src="attachments/32a0d69b-c3fa-4272-aea0-d207609afaaf" title="Screencast From 2025-03-18 11-16-17.webm" controls></video>

**Gaining knowledge**

- Experiment with `VK_KHR_external_memory_host` extension for uploading vertex buffers (not related to OpenXR).
- Import host pointer with `VK_KHR_external_memory_host`. This reduces the additional
  memcpy on OpenXR side.
- Export host pointer from Blender side from a mappable buffer.
- Replace host pointers with fd/dmabuf/winhandle
- Remove mappable buffer.

Ref #133718

Pull Request: https://projects.blender.org/blender/blender/pulls/133824
2025-03-27 16:57:51 +01:00
Hans Goudey
9b1a5a1c43 Refactor: Draw: Further changes to mesh buffer extraction
Followup to 9b70851d91.

Return buffers by value rather than creating an empty/uninitialized
buffer first, then initializing it in an extraction function. This generally
makes the code easier to follow. And avoiding these half-created buffers
is an essential step to adding some sort of more global cache.

Pull Request: https://projects.blender.org/blender/blender/pulls/136570
2025-03-27 16:52:55 +01:00
Ray Molenkamp
9a2597aae6 Fix #126782: Win: Install python3.dll into python bin folder
python3.dll was installed for blender, but not next to the
python binary, leading to issues with subprocesses. Given
it's only a small dll the duplication isn't that big of a deal.
2025-03-27 09:32:57 -06:00
Jeroen Bakker
d5bef6cb01 Cleanup: Remove unused code 2025-03-27 14:09:15 +01:00
Sybren A. Stüvel
06a69cfadf Anim: Allow Stash and Push Down on empty Action
Add support for using the Stash (to NLA) and Push Down operators on
empty Actions. In the past years, the NLA has seen stability updates
that ensure strips are at least a single frame long, and with that even
pushing down an empty Action will create a visible (albeit tiny) NLA
strip. There doesn't seem to be a practical reason to disallow this any
more.

Pull Request: https://projects.blender.org/blender/blender/pulls/136604
2025-03-27 12:53:24 +01:00
Sybren A. Stüvel
6d3c621958 Fix #136596: Keying slotless NLA strip does not update the strip's slot
It is possible to un-assign the action slot from an NLA strip. If then
you enter tweak mode on it and insert keys, a new slot is created on the
Action (so far so good). However, exiting tweak mode did not assign that
slot to the NLA strip, deactivating the animation. This is now solved.

The slot assignment is done when exiting tweak mode because that's
when the whole "sync from assigned Action back to the NLA strip"
happens. Also things like syncing the strip length is done at
tweak-exit, so that seemed like the right place to me to do this too.

Pull Request: https://projects.blender.org/blender/blender/pulls/136601
2025-03-27 12:30:09 +01:00
Sybren A. Stüvel
307147c99c Anim: versioning after #136347 fixed keyframe interpolation flags
Update all F-Curves so they have the correct flags (`FCURVE_INT_VALUES`,
`FCURVE_DISCRETE_VALUES`) for the RNA property type that they animate.
The bug that caused these flags to be incorrect (#136347) is already
fixed. This commit ensures that F-Curves that were created while the bug
was in a Blender release are updated to ensure they have the correct
flags.

This is quite important to fix, as otherwise enum properties will
actually be interpolated. Imagine the "fun" when a rig is going
through all the intermediate rotation modes when it was intended to
switch from "Quaternion" to "ZYX".

Even before this commit, these flags were already recomputed on key
insertion (at least the ones through the UI). The versioning code simply
runs this update on all existing F-Curves.

Since this may have some performance impact (doing an RNA path resolve
on all F-Curves on all Actions), the versioning code is only run when
the blend file is from 4.4 or newer, as the bug was introduced in that
release.

Pull Request: https://projects.blender.org/blender/blender/pulls/136512
2025-03-27 12:26:22 +01:00
Pratik Borhade
128920633a UI: Show Curves info in viewport statistics
Count total number of available and selected points for Curves object
and show them in viewport stats. Right now, they are displayed zero in
edit mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/136070
2025-03-27 12:03:30 +01:00
Jacques Lucke
1885c4c967 Fix #136564: Geometry Nodes: bake is not loaded with custom normals
The bake was written correctly, but loading did not handle the 2d int16 attribute.
2025-03-27 11:06:28 +01:00
Jorn Visser
3561b11851 Fix #136310: Crash when using both viewport and normal compositor with fog glow
The issue is caused by the fact that when both compositors are used,
`fftwf_plan_dft_r2c_2d` can end up being called in parallel, which is
only thread-safe if `fftwf_make_planner_thread_safe` is called before.
This is done by `fftw::initialize_float`, but only if the FFTW threading
support library is available. Said library was not detected correctly on
Windows because of a typo, which this change addresses. This should also
make the fog glow faster on Windows because it'll now use multithreaded
FFT as intended.

This change also moves the call to `initialize_float` to the main
function because the FFTW functions it calls are not thread-safe and
because FFTW is also used by Audaspace, which cannot call it.

Pull Request: https://projects.blender.org/blender/blender/pulls/136557
2025-03-27 10:20:15 +01:00
Omar Emara
cf25a34fe9 Compositor: Add Glare Suppress Highlights boolean input
The Glare node currently has a Maximum Highlights input, which has a
special value of 0.0, where the maximum is implicitly set to infinity,
that is, no suppression of highlights happen at that special value. Such
special values are hard to discover and make sliders non-continuous.

To fix this, we introduce a new panel toggle input called Suppress
Highlights, which the user can enable then control the maximum value.
This also have the advantage that the Maximum value is more clear, since
it is now under a panel more clearly named.

This is now possible since the introduction of boolean sockets and node
panel toggle inputs.

Pull Request: https://projects.blender.org/blender/blender/pulls/136309
2025-03-27 09:22:04 +01:00
Patrick Huang
8fd0a0e3f1 Fix #136361: Change empty size when applying scale transform.
Apply transform behavior for empties is now consistent.
Applying scale always changes empty size to keep apparent size.
Previously, empty size is only changed when applying scale only.

Pull Request: https://projects.blender.org/blender/blender/pulls/136534
2025-03-27 08:09:04 +01:00
Jesse Yurkovich
b6f432254c Cleanup: USD: Remove unused argument for create_object
The `motionSampleTime` argument to `create_object` has been unused since
the dawn of time, and it's not expected to be used in the future either.

Remove the clutter.

Pull Request: https://projects.blender.org/blender/blender/pulls/136587
2025-03-27 03:52:05 +01:00
Alaska
2e829ca4cf Fix #136303: Normalize the normals on the Ambient Occlusion node
This commit simply normalizes the normals of the Ambient occlusion
node before computing the output to avoid odd behaviour with
unnormalized normals.

Pull Request: https://projects.blender.org/blender/blender/pulls/136315
2025-03-27 02:58:19 +01:00
Sean Kim
fd2a187355 Cleanup: Remove StrokeCache rcti variables
Both values are unused.

* `current_r` is only ever set and never read from
* `previous_r` is only ever read from and is never set, because it is
  always empty, it is never unioned with the current `rcti`.

Pull Request: https://projects.blender.org/blender/blender/pulls/136586
2025-03-27 02:31:31 +01:00
Campbell Barton
42ad772a1f Cleanup: spelling & repeated terms (make check_spelling_*)
Also use comment blocks for English text.
2025-03-27 01:13:34 +00:00
Campbell Barton
6f95b7e9a4 Cleanup: de-duplicate modifier flag logic in key-map item creation 2025-03-27 01:13:32 +00:00
Nicola
5e873ee3ec Fix: Canceling sculpt transform tool leads to invalid display of mesh
Caused by bc3c6c4e7c

`cancel_modal_transform` restores the original positions, but it was
missing calls to update the vertex normals and the bounds of the BVH
nodes.

Pull Request: https://projects.blender.org/blender/blender/pulls/136580
2025-03-27 01:12:19 +01:00
Sean Kim
88ee723ed5 Fix: Potential divide by 0
This situation is unlikely to happen in practice, as it would require
there to be either no elements in the mesh, or every average translation
to be a 0-length vector.

Pull Request: https://projects.blender.org/blender/blender/pulls/136572
2025-03-27 01:02:47 +01:00
Campbell Barton
7b5428bfa7 Cleanup: remove KM_{MOD}_ANY flags
Even though the doc-string notes that they're only used for
function parameters, it looks as if they might be used for
`wmEvent::modifier` and are exposed in a prominent location.

Remove the flags & replace them with a macro that bit-shifts the
existing modifier values which is more clearly intended to be used
with `KeyMapItem_Params`.

Ref !136539
2025-03-26 23:29:33 +00:00
David Murmann
afee81753e OpenEXR: Preserve compression and depth settings when re-saving file
Set the flags on the image buffer when loading an EXR file, so they can be
used when saving.

This also removes IB_halffloat and replaces it by the file options flag.

Pull Request: https://projects.blender.org/blender/blender/pulls/135656
2025-03-26 21:35:20 +01:00
Jacques Lucke
202db40afb Refactor: move uvproject code from blenlib to blenkernel
I'm moving this for two (related) reasons:
* It depends a lot on the specifics of `Camera` and `Object` data-blocks.
* It links `Object::object_to_world()` which is not an inline function and thus
  easily leads to linker errors. It mostly seems like luck that this is not
  breaking our build due to early dead code elimination when linking binaries
  which use the blenlib static library such as `msgfmt`.

I found this while working on a compilation tool which would not be as lucky and
has a linker error because of the dependence on `Object::object_to_world`.

Pull Request: https://projects.blender.org/blender/blender/pulls/136547
2025-03-26 20:51:57 +01:00
Harley Acheson
3dc78529f2 Fix #136504: Clamp Scaling of Color Picker Value Handle
If you scale down the color pickers to very small sizes the calculation
of the handle size of the value slider will cause it to proportionally
increase as it all approaches zero. This PR just calculates the size in
a better way and clamps it as well. For both the round and square
versions.

Pull Request: https://projects.blender.org/blender/blender/pulls/136566
2025-03-26 18:32:29 +01:00
Omar Emara
c0fe2ef766 Compositor: Use input order for unset domain priority
This patch makes it such that the compositor fallback to using the
order of the inputs to infer the domain priority if no domain priority
is specified. This is more robust since some nodes do not declare their
domain priorities and indirectly rely on the order of insertions in some
containers and thus might fail in the future.

We opt for this as opposed to requiting all nodes to declare their
priorities for code brevity.
2025-03-26 16:14:05 +02:00
Hans Goudey
3bca04b172 Cleanup: Remove matrix copy from MeshRenderData 2025-03-26 09:49:54 -04:00
Weizhen Huang
1f12244f73 Fix: EEVEE bump height connecting to the wrong link after recent change
Pull Request: https://projects.blender.org/blender/blender/pulls/136546
2025-03-26 14:36:24 +01:00
Omar Emara
36154a1ab4 Compositor: Initial support for implicit inputs
This patch adds initial support for implicit inputs in pixel operations.
This is currently a non-functional change but will be used in the
future to support implicit inputs in texture nodes or so.

This works by exposing extra inputs to pixel operation for each of the
supported implicit input types if needed, and linking those inputs to
instances of the ImplicitInputOperation operation.

Only a single implicit input exist for now and we do not differentiate
between any of the implicit inputs type. In order to do that, we need to
refactor how input declarations for implicit inputs happen, since they
are now tied to the Geometry Nodes specifically.
2025-03-26 13:42:21 +02:00