10034 Commits

Author SHA1 Message Date
Aras Pranckevicius
facb17b0e3 Cleanup: BLI ENUM_OPERATORS cleanup/robustness
BLI code for enums that are meant to be used as "bit flags" defined
an ENUM_OPERATORS macro in BLI_utildefines.h. This cleans up things
related to said macro:

- Move it out into a separate BLI_enum_flags.hh header, instead of
  "random bag of things" that is the current place,
- Update it to no longer need manual indication of highest individual
  bit value. This originally was added in a31a87f89 (2020 Oct), in
  order to silence some UBSan warnings that were coming
  from GPU related structures (looking at current GPU code, I don't
  think this is happening anymore). However, that caused actual
  user-visible bugs due to incorrectly specified max. enum bit value,
  and today 14% of all usages have incorrect highest individual
  bit value spelled out.
    - I have reviewed all usages of operator ~ and none of them are
      used for directly producing a DNA-serialized value; all the
      usages are for masking out other bits for which the new ~
      behavior that just flips all bits is fine.
- Make the macro define flag_is_set() function to ease check of bits
  that are set in C++ enum class cases; update existing cases to use
  that instead of three other ways that were used.

Pull Request: https://projects.blender.org/blender/blender/pulls/148230
2025-10-17 12:57:50 +02:00
Miguel Pozo
8abe501f2d Merge branch 'blender-v5.0-release' 2025-10-16 20:51:18 +02:00
Miguel Pozo
9d436aa31d Fix #147782: Workbench alpha imprecision
Regression from 1c41815c4d.

The log2/exp2 round-trip can cause imprecisions, which are especially
notable with the alpha channel.
This removes the round-trip conversion for the alpha channel.

Pull Request: https://projects.blender.org/blender/blender/pulls/148218
2025-10-16 20:50:20 +02:00
Clément Foucault
209605233a Merge branch 'blender-v5.0-release' 2025-10-16 19:26:09 +02:00
Clément Foucault
abdb682d37 Fix #141198: EEVEE: DOF is incorrect at low resolutions on AMD + Mesa
Caused by some driver synchronization bug.
Also fixes #147879.
2025-10-16 19:24:55 +02:00
Jacques Lucke
96d2f3430f Merge branch 'blender-v5.0-release' 2025-10-16 19:20:23 +02:00
Clément Foucault
6b0f57facf Fix #142285: 3D cursor placement ignores unselectable objects
This was caused by 3dfec1ff73
which introduce the new behavior. This was to fix workflows
using a lot of semi-transparent objects which made nagivation
difficult.

This patch first roll back to the previous behavior: The
unselectable object will affect depth-aware operators.

This patch introduces a new visibility property to remove
the influence of objects in all depth picking operations
and selection operations. However the object is still
selectable through non-drawing selection operators
(e.g. select by material) and through the outliner.
This is to adress the aforementionned navigation issues.

Pull Request: https://projects.blender.org/blender/blender/pulls/146706
2025-10-16 19:17:18 +02:00
Campbell Barton
c4b2c1c19e Cleanup: spelling (check_spelling_*), trailing spaces in comments 2025-10-12 12:12:46 +11:00
Harley Acheson
78029fa777 Merge branch 'blender-v5.0-release' 2025-10-10 11:06:36 -07:00
Christoph Neuhauser
abc2cb24c9 Fix: EEVEE: Write to vertex shader outputs to avoid Intel linking errors
eevee_geom_world_vert.glsl and eevee_geom_volume_vert.glsl do not
support shadows, but the shader validation pipeline still compiles the
shadow variant of these shaders. This results in the fragment shader
reading from inputs that are not written to as vertex shader outputs.
On the Intel Windows OpenGL driver, this leads to a shader linking
failure. This PR avoids the issue by writing zeros to the interface
variables when MAT_SHADOW is defined.

Pull Request: https://projects.blender.org/blender/blender/pulls/147821
2025-10-10 19:11:46 +02:00
Christoph Neuhauser
7b5dfdf759 Revert "Fix: EEVEE: Write to vertex shader outputs to avoid Intel linking errors"
This reverts commit 16ad7524a7.
The commit was accidentally pushed to the upstream branch instead of a
fork branch.
2025-10-10 17:23:05 +02:00
Christoph Neuhauser
16ad7524a7 Fix: EEVEE: Write to vertex shader outputs to avoid Intel linking errors
eevee_geom_world_vert.glsl and eevee_geom_volume_vert.glsl do not
support shadows, but the shader validation pipeline still compiles the
shadow variant of these shaders. This results in the fragment shader
reading from inputs that are not written to as vertex shader outputs.
On the Intel Windows OpenGL driver, this leads to a shader linking
failure. This PR avoids the issue by writing zeros to the interface
variables when MAT_SHADOW is defined.
2025-10-10 16:35:30 +02:00
Campbell Barton
45d184af44 Merge branch 'blender-v5.0-release' 2025-10-10 10:14:39 +11:00
tariqsulley
2f0d433592 Fix #125822: Armature X-ray prevents other objects from being selected
Armature X-ray overlay prevented selecting other objects even with
"Lock Object Modes" disabled.

Ref !146794
2025-10-09 23:13:35 +00:00
Clément Foucault
8b3b4cced6 Merge branch 'blender-v5.0-release' 2025-10-09 19:36:28 +02:00
Clément Foucault
73645a1047 Fix #147542: Overlay: Curve Sculpt Mode: Z-fighting with Cage overlay
The overlay just needed a bit of Z bias to avoid Z fighting.
2025-10-09 19:35:47 +02:00
Miguel Pozo
a267be0397 Merge branch 'blender-v5.0-release' 2025-10-09 17:00:34 +02:00
Miguel Pozo
f7ef7eff5e Fix: Overlay: Broken outline detection for faces perpedicular to the view
Apply the same fix used for Armatures.

Partially fixes #139555.
For correct flat object detection, #145227 is also needed.

(4.5 backport candidate)

Pull Request: https://projects.blender.org/blender/blender/pulls/147722
2025-10-09 16:58:58 +02:00
Miguel Pozo
83a1bd4e1d Fix #145750: Overlay: Attempt to index a handle range as a single handle
This fixes the resource indexing logic, but it looks like the flat
object outline workaround has been broken since 4.4.

Pull Request: https://projects.blender.org/blender/blender/pulls/147703
2025-10-09 16:58:25 +02:00
Falk David
87fb5aa303 Merge branch 'blender-v5.0-release' 2025-10-09 10:44:56 +02:00
Christoph Neuhauser
02e873537b Fix: GPU: Add DO_STATIC_COMPILATION() to overlay edit shaders
This PR fixes an assert by adding DO_STATIC_COMPILATION() to
overlay_edit_pointcloud, overlay_edit_lattice_wire and
overlay_edit_lattice_point.

Fixes issue introduced by:
https://projects.blender.org/blender/blender/pulls/147650

Pull Request: https://projects.blender.org/blender/blender/pulls/147682
2025-10-09 10:36:34 +02:00
Christoph Neuhauser
ab01f7254b Fix: GPU: Remove selectable variants for invalid overlay edit shaders
The Intel Windows driver generates an error when linking a vertex shader
and fragment shader where the vertex shader does not write to an output
used as an active input in the fragment shader.

This PR fixes failing "gpu" tests by removing the selectable shader
variants for overlay_edit_pointcloud, overlay_edit_lattice_wire and
overlay_edit_lattice_point.

Pull Request: https://projects.blender.org/blender/blender/pulls/147650
2025-10-09 09:18:25 +02:00
Hans Goudey
9a672cbe52 Mesh: Reference UV map and tangents by name in draw requests
Currently UV maps and tangents are referenced by custom data layer index
by the mesh extraction system that decides what attributes are needed on
the GPU for rendering. This system is closely tied to CustomData, and
adds a limit on 8 total UV maps on the mesh (crucially different than
a limit on the supported UV map count for rendering).

The process of detecting which attributes to upload is also directly
tied to CustomData. In particular, `mesh_cd_calc_used_gpu_layers` is
quite complicated.

This commit reimplements that function, and references used UV maps
and UV tangents by name rather than by index. The process is now mostly
separated from `CustomData`, which is important as Mesh moves to
`AttributeStorage` instead.

Overall I noticed this introduces some overhead (a few percent cost to
playback in some extreme cases). `DRW_MeshCDMask` is bigger than before
(it was just an integer), and the attribute API currently has some
overhead that can be removed when it's backed by `AttributeStorage`.
The change still feels worth it to me, given other opportunities for
optimization in this area.

Ref #122398

Pull Request: https://projects.blender.org/blender/blender/pulls/141467
2025-10-08 16:54:12 +02:00
Clément Foucault
e5f13a727a Refactor: EEVEE: Make surfel ray list stable and baking workload auto-adjust
This avoid putting too much work in only one thread for building very long surfel lists.

Instead of insertion sort, we use a prefix sum where all surfel scan the whole ray
list to know their position. Only the coplanar surfel patching is dispatched as
one thread per list.
This is currently a bruteforce approach and could be optimized further.

On top of this, we add a heuristic to scale the amount of work from the baking
depending on the scene complexity. Complex scene will have more overhead but
will remain responsive during baking, while simple scene will be faster to bake.
This avoids hitting TDR in most cases.

The update refresh is now limited to 1 per second to avoid the readback overhead.

Fix #142988

Pull Request: https://projects.blender.org/blender/blender/pulls/146848
2025-10-08 15:59:43 +02:00
Clément Foucault
ab4c245a7e Fix: EEVEE: Lightprobe Volume backfacing toggle is inverted
The UI property was changed 7b97bc48d8
to a negative boolean but the boolean conversion inside EEVEE was
not inverted.

This mean that since 4.2, the default behavior for Lightprobe
volume has been broken / inverted.

To make an existing scene bake the same as before, all material
needs to have their `BackFace Culling > Light Probe Volume` options
inverted. This is done automatically through the versioning code.

The only test cases broken are the ones using default materials which
do not have their property turned off.

Release Notes should contains the compatibility breakage.

Pull Request: https://projects.blender.org/blender/blender/pulls/147218
2025-10-08 14:55:14 +02:00
Campbell Barton
f4308aa2d0 UV: remove per-UV-map selection data
Replace per UV map selection with a single UV selection for all UV's.
This uses the same data as UV sync select, meaning that it's no longer
possible to keep a different selection when sync-select is disabled.

There is a minor improvement to functionality - previously not possible
to de-select a single face surrounding by selected faces.
Now this is possible because true face selection is supported.

The selection from the active UV-map is converted to use the shared
selection data.

Ref !147523

Co-authored-by: Hans Goudey <hans@blender.org>
2025-10-08 15:05:20 +11:00
Campbell Barton
377e3cfca5 Cleanup: use a define for BMUVOffsets that doesn't reference any layers
Reduce the number of places that need to be updated when struct members
change and reduces the binary size a little.
2025-10-08 14:56:43 +11:00
Christoph Lendenfeld
a09d0cfd8c Anim: Move pose bone selection state to bPoseChannel
Move the selection flag for pose bones, from the (edit)bone to the
pose bone.

Previously having multiple instances of armatures in pose mode at the
same time caused issues because selecting a pose bone on one armature
would automatically select it on all instances of it.

This is now fixed since the selection state is stored on the pose bone
(Object level) Doing so breaks API compatibility with 4.5 since the
RNA property on the Bone no longer affects the pose bone. Instead,
there is a new property on the pose bone for that.

Due to this change, some runtime flags for the transform system also
had to be moved to the pose bone. This is due to the fact that these
flags are used by the transform system to pass information between
functions. If we keep the flag at the bone level, this wouldn't work
with armature instances. See `bPoseChannelRuntimeFlag`

Fixes #117892

Pull Request: https://projects.blender.org/blender/blender/pulls/146102
2025-10-07 19:59:36 +02:00
Jonas Holzman
043d9e77b0 UI: Slightly shorten 3D cursor colored axis tips
This commit slightly shorten the new 3D cursor colored axis tips,
allowing for a larger part of the dark part of the axis to show,
improving readability. Discussed during the last UI meeting.

Pull Request: https://projects.blender.org/blender/blender/pulls/147563
2025-10-07 19:44:12 +02:00
John Kiril Swenson
76c03744a8 VSE: Add render options for sequencer scene and active scene
Addresses #146305.

Ever since moving to the "sequencer scene" paradigm, attempting to
render an image or animation when a sequencer with strips is present
often seems to outright ignore the sequencer in most cases. This is
because the sequencer scene usually differs from the active scene (which
is the true render target), so one must first switch their active scene
to the sequencer scene before rendering.  This is confusing and
seems like a regression in behavior. To improve clarity, this patch does
the following:

When a sequencer scene with at least one strip (and the sequencer step
enabled in the pipeline) exists in the current workspace, new options
"Render Sequencer Image" and "Render Sequencer Animation" appear.  These
options may be invoked by alt-F12 and ctrl-alt-F12, respectively.

Additionally, if such a valid sequencer scene is the same as the active
scene, then only the regular render options are listed, since in this
case they are identical to the sequencer render operators, meaning F12
still works predictably.

To switch back and forth between sequencer and main scene render
outputs, a new toggle has been added to the image editor to "Show
Sequencer Scene" output. This button only appears for the render result
if there is a valid sequencer scene that differs from the active scene.

Pull Request: https://projects.blender.org/blender/blender/pulls/146934
2025-10-07 18:12:08 +02:00
Miguel Pozo
610555dbe3 Fix #147340: EEVEE: Crash on failed world material compilation
- Check for failed World materials.
- Remove invalid links (unsure about this one).

(4.5 LTS backport candidate)

Pull Request: https://projects.blender.org/blender/blender/pulls/147445
2025-10-07 15:28:46 +02:00
Campbell Barton
3b980419dd Fix: out of bounds write when reading color
Resolve regression in [0] which wrote into the 4th index of a float[3].

[0]: b9e1e2a8ee
2025-10-07 23:11:18 +11:00
Aras Pranckevicius
8a74f7c0b0 VSE: Execute modifiers in strip-local space (#145688)
Currently when a strip has a transform that does not fill the whole
render area, first the image of the strip is transformed, and then
any modifiers are applied on that. This is mostly in the new
Compositor modifier, where procedural textures, gradients, image
coordinates "stick to the screen" instead of following the transformed
strip.

This changes the behavior so that first the modifiers are applied
to the strip image, and then the strip is transformed. This is
potentially a visually breaking change:
- This can alter visual look of existing strip, especially if they are
  scaled. Previous behavior was first scale filtering, then modifier;
  now it is first modifier, then scale filtering.
- Most obvious change is Compositor modifier (which is new in 5.0).
- Compositor modifier can actually expand the input image (e.g. Blur
  node with "expand bounds" option set), and that works.
- Note that Masks continue to be applied in global/screen space. There
  can be small look differences with rotated/scaled strips that use
  masks, due to Mask application now needing to do filtered mask image
  lookups.
- If anyone needs previous behavior (modifier is applied on the
  "whole screen"), they can put transformed strip into a meta strip,
  and apply the modifier on the meta strip itself.

Compositor modifier examples with images in the PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/146181
2025-10-07 13:51:41 +02:00
Pablo Vazquez
b9e1e2a8ee UI: 3D Cursor style and contrast adjustments
Recent changes made the 3D Cursor hard to see in some situations,
according to user feedback.

Roll-back most changes to bring back the old style and improve
readability and contrast.

* Keep the same size as the old cursor.
* Keep the crosshair inside the circle.
* Use red-white for the circle as before.

See PR for details and screenshots.

Pull Request: https://projects.blender.org/blender/blender/pulls/147404
2025-10-07 12:56:37 +02:00
Campbell Barton
62d72bd0b5 UV: initial implementation of UV sync select
Support sync selection in the UV editor, with face-corner selection,
so it's possible to select individual UV vertices/edges in the UV editor
without UV's attached to the same underlying edge also becoming selected.

There is limited support for maintaining the UV selection when selecting
from the 3D viewport, common operations such as picking &
box/circle/lasso select support this, however other selection operations
such as "Select Random" or "Select Similar" will clear this data,
causing all UV's connected to selected mesh elements to become selected.
We may add support for additional operators as needed.

Details:

- UV Sync Selection is now enabled by default.
- In edit-mode the UV selection is stored in BMLoop/BMFace which are
  written to custom-data layers when converted to a Mesh.
- To avoid unnecessary overhead - this data is created on demand.
  Operators may clear this data - selecting all or none do so,
  as there is no reason to store this data for a uniform selection.
- The Python API includes functions to synchronize the selection to/from
  UV's as well as flushing based on the mode.
- Python scripts that manipulate the selection will either need to clear
  this synchronized state or maintain it.

See:
- Design task: #78393.
- Implementation task: #131642.

Ref !138197
2025-10-07 01:41:16 +00:00
Pablo Vazquez
5c8fb20f2d UI: Color Axes in 3D/2D Cursor
Since 2.80, the 3D Cursor is actually 3D, but it is still not clear
which way it points.

To improve this, the following style tweaks were done:

- Use theme axes colors for the 3D Cursor lines, a bit desaturated.
- Draw the negative axes a little darker, to tell at a glance its
  direction.
- Replace the red/white lines with black/white for improved contrast
  and to not conflict with X axis colors.
- Make it over all smaller in size, since it's already prominent by its
  colors.

See PR for details and screenshots.

Pull Request: https://projects.blender.org/blender/blender/pulls/146927
2025-10-03 19:11:39 +02:00
Clément Foucault
34ca3cb226 Fix: EEVEE: Irradiance validity loading
The loading step of the irradiance validity was
left unfinished for some reason. It was loading
the same validity for all 8 corners and copying
the same value for all 4 Z slices.

There is another bug, which is that the default
backface validity of surfels is wrong. This means
that the tests are passing because of this bug
as the validity is always 1 everywhere.

Pull Request: https://projects.blender.org/blender/blender/pulls/147200
2025-10-03 16:28:59 +02:00
hogan.mastanduno
64cb13b9ff Fix #147155: Crash opening a blend file
Pull Request: https://projects.blender.org/blender/blender/pulls/147160
2025-10-02 23:56:43 +02:00
Hans Goudey
a68d39e9d9 Cleanup: Formatting
Run `make format` after the library update in the previous commit.
2025-10-02 12:55:42 -04:00
Campbell Barton
b78c5fadf3 Cleanup: various non functional changes for C++ 2025-10-01 23:22:44 +00:00
Campbell Barton
b938800ba6 Cleanup: sort cmake file lists 2025-10-01 23:22:41 +00:00
Campbell Barton
60f8d625a4 Fix #147155: Crash opening a blend file
Workaround regression in [0] which crashed opening files & on startup
in some cases.

[0]: dde9d21b91
2025-10-02 09:17:52 +10:00
hogan.mastanduno
dde9d21b91 OpenXR: VR Advanced Locomotion Phase 1
Includes the following changes to the existing Locomotion system for VR Scene Inspection:
 * new VR Navigation Preferences and VR Session Settings
 * changes to XR raycast logic and its visualization
 * new XR vignette that appears when moving
 * snap turning

Pull Request: https://projects.blender.org/blender/blender/pulls/144241
2025-10-01 22:16:12 +02:00
Miguel Pozo
44c87179a9 Draw: Re-enable Handle Ranges optimizations
Re-enable the optimizations from #140378, which were reverted in
f8303efd57 until I could fix the
regressions.

Disable handle ranges for bounding boxes.
Take into account DupliObject and parent Object overrides in
`supports_handle_ranges`.

Fix #145446
Fix #145420

Pull Request: https://projects.blender.org/blender/blender/pulls/147069
2025-10-01 17:50:33 +02:00
Clément Foucault
723f4bc549 GPU: Remove support for matrices and arrays in shader interfaces
These are not supported in Metal. Removing these corner cases
avoid a lot of boiler plate code in the backend.
2025-09-30 21:03:31 +02:00
Clément Foucault
2bf86f840d Fix #146813: EEVEE: AO With Shader To RGB fails to compile
This is caused by the forward_lib including eevee_nodetree_lib
before eevee_ambient_occlusion_lib.

Fixed by splitting eevee_nodetree_lib into the part that is
needed for forward_lib so that eevee_nodetree_lib is only
included from eevee_nodetree_frag_lib and eevee_nodetree_vert_lib.

Pull Request: https://projects.blender.org/blender/blender/pulls/146987
2025-09-30 14:05:53 +02:00
Miguel Pozo
1d596082ce Fix #146194: Draw: Don't create duplis from temporary preview objects
Don't attempt to create duplilists from (preview) dupliobjects.
It may render the same instance multiple times, and leave dangling
pointers.

Pull Request: https://projects.blender.org/blender/blender/pulls/146988
2025-09-30 12:15:27 +02:00
Omar Emara
d75b8e5b6e Compositor: Make a distinction between inputs and passes
This patch makes a distinction between passes accessed through nodes
like the Render Layers node, and inputs accessed through nodes like the
Group Input node. Previously, the Group Input node returned the passes
of the active scene and view layer accordingly to the name, while now,
it only returns the Image (Combined) pass and the result will be zeros.

Pull Request: https://projects.blender.org/blender/blender/pulls/146831
2025-09-30 11:35:02 +02:00
Casey Bianco-Davis
d4f84619ea Grease Pencil: Add new Corner Types
This adds three corner types: `Round` `Sharp` and `Flat`.
These control how the corner of `Grease Pencil` line strokes are rendered.

- The `Round` type draws circular arcs, and is what `Grease Pencil`
   currently supports and is default.
- The `Flat` type cuts off the tip of the corner.
- The `Sharp` type allows for sharp corners to be created.
  If the angle is sharper than `Miter Limit` then the tip will be cut like `Flat`

These three types match the main types of `line joins` present in `SVG`
files.

This data is stored in one `Point` attribute called `miter_angle`.
This stores both the `Corner Type`, the `Miter Limit` and defaults to
the `Round` type.

This PR adds:
- Rendering of the corner types.
- An operator for setting the `Corner Type` and `Miter Angle` attribute.
- Corner types to the `Outline` operator and modifier.

Part of #145380.

Pull Request: https://projects.blender.org/blender/blender/pulls/143688
2025-09-29 18:19:05 +02:00
Nika Kutsniashvili
1067112c11 UI: Theme: Remove "Active Spline" theme property
In 3D Viewport theme settings there is "Active Spline" property, which behaves weirdly.
Color of that property is multiplied to color of curve handles. Even though it says active,
it's multiplied in selected and unselected states, for all curves all the time.

That doesn't make much sense, has no real value, and ends up only causing confusion.
Having this property on anything but pure black means that whatever colors you choose
for curve handles in Preferences isn't actually what you're getting them. If color is set to
high-saturation color it completely washes away all colors and makes it difficult to differentiate
between handle types.

I think there is no reason for this property to exist, so this PR just removes that property.

Pull Request: https://projects.blender.org/blender/blender/pulls/145360
2025-09-29 12:27:16 +02:00