Commit Graph

117289 Commits

Author SHA1 Message Date
Jeroen Bakker
efff379ea5 Metal: Add support to force workarounds.
Recently it came to out attention that macOs13 doesn't always work due
to texture atomics not supported by that version of the OS.

Development happens most of the time on newer versions of the OS without
ability to check if it still works on the older versions.

This PR enables to disable some Metal capabilities to better check how
Blender works on those OS's. The capabilities that will be disabled
are texture gathering and texture atomics. It doesn't disable the
capabilities that are required to start Blender, which are still
part of the `MTLCapabilities` struct.

This allows us to reproduce issues like #129571

Pull Request: https://projects.blender.org/blender/blender/pulls/133636
2025-01-27 11:07:20 +01:00
Nathan Vegdahl
94b916a3ba Fix #133362: crash when autokeying object with motion path but no action
When moving an object with a motion path and animdata but no assigned
action, and with certain auto-key settings enabled, Blender would crash.

The cause was code that tried to access an action's fcurves without
proper guarding: the guard checked whether an object had animdata, but
not whether it had an action assigned or not, and would happily try to
access that non-existent action's fcurves.

This fixes the crash by also checking if an action is assigned.

Pull Request: https://projects.blender.org/blender/blender/pulls/133552
2025-01-27 09:52:32 +01:00
Omar Emara
4b3ad6ff23 Compositor: UI: Clarify warning in Render Layers node
Passes are supported in EEVEE, but not other engines, so exclude EEVEE
from the warning through wording.
2025-01-27 10:33:12 +02:00
Jeroen Bakker
e6b3cc8983 Vulkan: Device command builder
This PR implements a new the threading model for building render graphs
based on tests performed last month. For out workload multithreaded
command building will block in the driver or device. So better to use a
single thread for command building.

Details of the internal working is documented at https://developer.blender.org/docs/features/gpu/vulkan/render_graph/

- When a context is activated on a thread the context asks for a
  render graph it can use by calling `VKDevice::render_graph_new`.
- Parts of the GPU backend that requires GPU commands will add a
  specific render graph node to the render graph. The nodes also
  contains a reference to all resources it needs including the
  access it needs and the image layout.
- When the context is flushed the render graph is submitted to the
  device by calling `VKDevice::render_graph_submit`.
- The device puts the render graph in `VKDevice::submission_pool`.
- There is a single background thread that gets the next render
  graph to send to the GPU (`VKDevice::submission_runner`).
  - Reorder the commands of the render graph to comply with Vulkan
    specific command order rules and reducing possible bottlenecks.
    (`VKScheduler`)
  - Generate the required barriers `VKCommandBuilder::groups_extract_barriers`.
    This is a separate step to reduce resource locking giving other
    threads access to the resource states when they are building
    the render graph nodes.
  - GPU commands and pipeline barriers are recorded to a VkCommandBuffer.
    (`VKCommandBuilder::record_commands`)
  - When completed the command buffer can be submitted to the device
    queue. `vkQueueSubmit`
  - Render graphs that have been submitted can be reused by a next
    thread. This is done by pushing the render graph to the
    `VKDevice::unused_render_graphs` queue.

Pull Request: https://projects.blender.org/blender/blender/pulls/132681
2025-01-27 08:55:23 +01:00
Harley Acheson
b34c135c30 UI: Status Bar Display Improvements For Regions
PR #133601 exposes some holes in the Status Bar display. Currently you
can see keymap entries for other areas, like 3D View, when hovering in
the Top Bar.  Or see the wrong items when hovering in a non-region
portions of an area. Or see keymap entries for window regions while
hovering headers. This PR fixes all these things.

Pull Request: https://projects.blender.org/blender/blender/pulls/133620
2025-01-26 21:26:44 +01:00
Alaska
3e11cfb1d0 Fix #133591: Bevel profile shape name did not match between redo and status bar
Update the name of the Profile shape variable for the bevel tool
in edit mode to be `Profile Shape` in both the redo panel and
status bar.

Pull Request: https://projects.blender.org/blender/blender/pulls/133598
2025-01-26 04:29:30 +01:00
Harley Acheson
b58ff3484f Fix #133550: Status Bar Display at Window Edges
When your mouse is hovering in the gaps between editors the Status Bar
indicates that you can resize and bring up context options. This same
gap is also along the outside window edges even though not visible and
so shows these options when not applicable. This PR carefully shows the
actual area options right up to the edge instead. And also does not
show "Resize" for the gap between global areas and the rest.

Pull Request: https://projects.blender.org/blender/blender/pulls/133601
2025-01-26 03:45:44 +01:00
Richard Antalik
bf732e4237 Fix: Possibly incorrect return value in VSE text editing operators
Paste and text insert could delete selected text, but then cancel
operator execution due to buffer being too small. Ensure, that operator
returns value based on state being actually changed or not.

Pull Request: https://projects.blender.org/blender/blender/pulls/133569
2025-01-26 01:35:48 +01:00
luzpaz-2
974ac39044 Cleanup: Typo
Pull Request: https://projects.blender.org/blender/blender/pulls/133541
2025-01-26 00:39:59 +01:00
Pratik Borhade
2a85a27609 Fix #115697: Allow compression on auto-save files
After 0e8e219d71 / efb511a76d, memfile undo step is not used for writing
the autosave file, instead regular file saving function is used (`BLO_write_file`).
With that it is possible to compress the file when `G_FILE_COMPRESS`
flag is set.
As discussed in !132685, always compress auto-save .blend file
irrespective of `USER_FILECOMPRESS`

Pull Request: https://projects.blender.org/blender/blender/pulls/132685
2025-01-25 09:29:39 +01:00
Sean Kim
6e8ab9b04a Cleanup: Minor changes to multires_displacement_smear.cc
* Removes unused headers
* Removes no-op multiplication
* Reduces scope of variables

Pull Request: https://projects.blender.org/blender/blender/pulls/133567
2025-01-25 00:28:34 +01:00
Sean Kim
12583c0f4a Fix #133509: Smear Multires Displacement corrupts mesh
Caused by db73ef0f2f

The displacement smear brush works by evaluating the previous
displacement of a given neighbor vertex to generate a weighted average.
Prior to the linked commit, the mesh-sized `prev_displacement` array
would be initialized to (0.0, 0.0, 0.0) by subtracting the
`limit_surface_co` from itself.

in certain cases, a neighbor vertex value may not be initialized,
causing NaN to get propagated through the mesh.

To fix this, and avoid needing to reintroduce this unnecessary
computation, explicitly initialize `prev_displacement` to an array of
(0.0f, 0.0f, 0.0f).

Pull Request: https://projects.blender.org/blender/blender/pulls/133522
2025-01-24 23:07:20 +01:00
Julian Eisel
f5b1a4625d UI: Allow drawing icons as drag previews, use for dragging assets
Instead of requiring an image buffer to draw a bigger preview image
while dragging, allow passing an icon ID and draw that as preview. This
is also how we draw previews elsewhere. Use this for attaching the asset
previews to draggable buttons.

A small user visible change is that previews from the asset browser will
always draw at the default size (multiplied by the interface scale)
while dragging. Previously it used the same size as the asset browser
preview size, which I don't think was useful really. With small sizes
the preview while dragging got unnecessarily small too, with big sizes
it got in the way.

Needed for #131871.
2025-01-24 22:32:27 +01:00
Julian Eisel
d88e0459d1 Fix: Incorrect type in previous commit
Meant to use a boolean.
2025-01-24 20:53:00 +01:00
Julian Eisel
5055adc1c0 Fix: Preview images didn't load progressively as intended
Custom preview images loaded from disk are supposed to load one by one
in a background thread, but pop up in the UI as they get ready. This
gradual/progressive loading wasn't working correctly, previews would
only show up after all current preview requests were handled. I think
there would still be some progressive loading, since handling a batch of
requests might finish before all requests for the current frame are in.
Now it works as intended, by actually tagging loaded previews.

Mistake in 16ab6111f7.

Noticed while working on #131871.
2025-01-24 20:50:02 +01:00
Julian Eisel
315e7e04a8 UI: Avoid double scaling of preview images, improve filtering
When loading preview images from disk, we'd first scale them to the
standard preview image size (in `icon_copy_rect()`) and then scale them
again to the drawing size when eventually drawing to screen. The first
scaling would happen on the CPU, which is slow, and without filtering.

Now the image is stored in its original size and only scaled when
drawing, which uses scaling on the GPU with mipmaps and bi-linear
filtering. While a bit more blurry, the resulting image has less
artifacts and represents the original image better. Keeping the images
unscaled means memory footprint is bigger, we could cap the size if
necessary.

Noticed while working on #131871. Asset shelf previews would have more
artifacts than before.

See pull request for comparisons.

Pull Request: https://projects.blender.org/blender/blender/pulls/133559
2025-01-24 19:46:33 +01:00
Jacques Lucke
6b09daf1e4 BLI: support building VMutableArray from container
Previously, this was only implemented for `VArray`.

Pull Request: https://projects.blender.org/blender/blender/pulls/133540
2025-01-24 17:49:35 +01:00
Bastien Montagne
9c237af041 Refactor: RNA: add discrete suffix to RNA_pointer_create.
This is a noisy preliminary step to the 'RNA ancestors' change. The
rename helps clearly tell what each `pointer_create` function does.

Pull Request: https://projects.blender.org/blender/blender/pulls/133475
2025-01-24 16:45:32 +01:00
Jacques Lucke
2e1aba03d9 Fix: potential crash when iterating over linked list while freeing elements 2025-01-24 16:30:19 +01:00
Miguel Pozo
956236f7d4 Fix: Draw: Add missing shaders to DRW_subdiv_free 2025-01-24 16:01:48 +01:00
Philipp Oeser
e4c125400f Fix #133055: Some Grease Pencil modifiers ignore "Invert Vertex Group"
The handling of influence vertexgroups was incomplete/inconsistent.
Some prior work was already done in 08539618cd, c452d5d9e8,
782a4c9d85, 0fd3f3c216, 434f94b254, 82ea972834, f6b820ccb7,
00968fe6db .

Now that the inverting is handled consistently, we can move that part
out of specific modifier code an into the generic retrieval function
`greasepencil::get_influence_vertex_weights` -- resulting in all
modifiers using it behaving the same.

There were some modifiers already handling
`GREASE_PENCIL_INFLUENCE_INVERT_VERTEX_GROUP`, however even those still
had one issue: if no vertexgroup was set, invert would still have been
calculated (this issue is also resolved with this PR).

Remaining modifiers that were offering influence vertexgroups (e.g.
Noise) but ignoring it now work correctly.

NOTE: there are still modifiers handling influence vertexgroups outside
of `greasepencil::get_influence_vertex_weights`:
- Armature (has own code for this in
`BKE_armature_deform_coords_with_curves`)
- Shrinkwrap (has own code for this in `shrinkwrapParams_deform`)
- Thickness (this rather special behavior is untouched)

Pull Request: https://projects.blender.org/blender/blender/pulls/133426
2025-01-24 14:47:33 +01:00
Omar Emara
109478d599 Compositor: Delay transformations until realization
This patch delays applying transformations until realization happens on
some other domain.

Currently, transformations are applied immediately at the point of
transform nodes, this is problematic for a few reasons:

- If that result was then realized on some other domain, interpolation
  will have happened two times, at the transform nodes and at the node
  that required realization, causing less than ideal precision issues.
- It is not possible to repeat or extend a rotated result because its
  empty areas will be zero filled, leaving gaps in its extension. So
  this patch is a prerequisite for #132371 if we want full support for
  repetition.
- Doing inverse transformations will introduce interpolation artifacts
  which might be undesirable. Inverse transformations might be used to
  do pixelation for instance, so this change will be undesirable in this
  case. But we decided that this is not a use case that we want to
  support, and we added explicit pixel size control to the pixelate node
  as an alternative.

So this has four implications, two that might be considered bad:

- Transformations will now be higher quality and more precise.
- Repetition and other boundary extension methods will now be possible.
- Downsampling then upsampling will no longer produce pixelated results.
- Realization might happen multiple times with identical results in some
  cases.

The last point not a big issue, since domain realization is not a big
bottleneck in the compositor, and the plan is to move realization into
pixel operations, so it will even be more efficient than it is now.

Pull Request: https://projects.blender.org/blender/blender/pulls/133158
2025-01-24 13:59:55 +01:00
Jeroen Bakker
9db5f61403 Fix: DrawManager: Missing include for draw manager tests
`draw_manager_testing.hh` was needed otherwise the compiler would print
a warning.

Pull Request: https://projects.blender.org/blender/blender/pulls/133538
2025-01-24 12:57:13 +01:00
Laurynas Duburas
71e30bf229 Fix #132370: Grease Pencil: Draw on multiple frames
At the end of stroke drawing appends it to all editable
`greasepencil::Drawing`s if in `GP_USE_MULTI_FRAME_EDITING` mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/133355
2025-01-24 12:50:44 +01:00
Christoph Lendenfeld
e4f34453e3 Refactor: pass Vector instead of ListBase to motion path functions
This changes the `ListBase` argument for certain motion path functions
to `Vector<MPathTarget *>`. (and `Span`)

To better describe what the function is doing,
`animviz_get_object_motionpaths` has been renamed
to `animviz_build_motionpath_targets`.

Since `BLI_freelistN` can no longer be used, I added
`animviz_free_motionpath_targets`.

Note that the Vector is of `MPathTarget *` which
are allocated the C way. Because the `MPathTarget` struct is defined
in the .cc file, that's the only way for it to work atm.
Other refactors may mitigate that in the future, but I wanted to keep
the scope small.

Pull Request: https://projects.blender.org/blender/blender/pulls/133212
2025-01-24 12:43:20 +01:00
Jeroen Bakker
e2dddea124 Fix: Vulkan: Thread safe cache folder
Vulkan shader compiler accesses the cache folder via multiple threads.
GHOST part isn't thread safe and can return and overwrite the returned
cache path. This resulted into crashes when performing background
rendering and failing test cases, loading of incorrect shaders etc.

This PR fixes this to cache the cache folder location in the
VKShaderCompiler, which is loaded via the main thread when the vulkan
backend is initialized.

Pull Request: https://projects.blender.org/blender/blender/pulls/133535
2025-01-24 12:20:43 +01:00
Jacques Lucke
2fda20e1db Fix #132099: crash when using same geometry on objects with different material counts
The core issue was that the geometry batch cache (e.g. `MeshBatchCache` or
`PointCloudBatchCache`) was dependent on the object. This is problematic when
the the same geometry is used with multiple different objects because the cache
can't be consistent with all of them.

Fortunately, the only thing that was retrieved from the object was the number of
material slots, so if that can be avoided we should be fine. We can't just use
the number of material slots stored on the geometry because that may have no
material slots but still has material indices which are overridden on the object
level.

The solution is to take make the number of materials for a geometry only
dependent on the actual `material_index` attribute and not on the number of
available slots. More specifically, we find the maximal referenced material
index and handle that many materials. This number does not depend on how many
material slots there are on the object, but it still allows the object to
override materials slots that the mesh references.

A downside is that the maximum material index has to be computed which often
requires an iteration over the mesh. Fortunately, we can cache that quite easily
and the computation can be done in parallel. Also we are probably able to
eagerly update the material index in many cases when it's set instead of
computing it lazily. That is not implemented in this patch though.

The largest part of the patch is making the maximal material index easily
available on all the geometry types. Besides that, the material API is slightly
replaced and the drawing code now makes use of the updated API.

Pull Request: https://projects.blender.org/blender/blender/pulls/133498
2025-01-24 12:05:25 +01:00
Jeroen Bakker
2feb435780 Fix: Vulkan: Memory allocation on no-rebar capable platforms
Memory areas was requested to be preferable host visible. On some
platforms this would fail to allocate. Best is to not add preferable
host visible for typically large allocations.

This PR also gives the caller the responsibility to set the allocation flags.

Pull Request: https://projects.blender.org/blender/blender/pulls/133528
2025-01-24 11:54:59 +01:00
Brecht Van Lommel
b11316fa3f Fix: Chinese language translation not working after recent refactor
Properly take into account script when searching for language folders.

Pull Request: https://projects.blender.org/blender/blender/pulls/133532
2025-01-24 11:23:36 +01:00
Omar Emara
759a7a08d9 Fix: Conversion shader fails compilation on MacOS
Argument names can't be the same as a push constant name, so rename the
push constant.

Pull Request: https://projects.blender.org/blender/blender/pulls/133531
2025-01-24 11:14:56 +01:00
Pratik Borhade
15e367f31a Fix #133434: No default tool for image editor view mode
Set sample tool as default for `view` mode of image editor.
Also expanded the condition in `toolsystem_key_ensure_check` so default
tool can be obtained inn view ui_mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/133471
2025-01-24 11:04:10 +01:00
Jonas Holzman
b701ba6554 macOS: Fix WITH_GPU_DRAW_TESTS build linking error
The issue was twofold, the `draw_tests` library was missing a link
dependency on `gpu_tests`, and the `gpu_tests` would only be generated
if `WITH_GPU_BACKEND_TESTS` or `WITH_VULKAN_BACKEND` were also ON due
to a superflous condition.

Pull Request: https://projects.blender.org/blender/blender/pulls/133511
2025-01-24 11:00:34 +01:00
Falk David
7dfdf8f8f6 Cleanup: VSE: Rename rna_def_sequence to rna_def_strip 2025-01-24 10:22:55 +01:00
Falk David
1eb39a8689 Grease Pencil: Sculpt Mode Auto-Masking option
This implements all the auto masking options in sculpt mode.

* Stroke: Only affects strokes that are initially under the cursor.
* Layer: Only affect strokes in the same layer as the initial strokes under the cursor.
* Material: Only affect strokes with the same material as the initial strokes under the cursor.
* Active Layer: Only affect strokes in the active layer.
* Active Material: Only affect strokes that use the active material.

The `Active Layer` toggle in the toolbar has been moved to this panel.

Resolves #130022.

Pull Request: https://projects.blender.org/blender/blender/pulls/132986
2025-01-24 10:20:03 +01:00
Omar Emara
b8db212d95 Compositor: Use OCIO luminance for color to float conversion
This patch uses OCIO luminance for implicit conversion from color to
float in the compositor. This is done to match other node systems, and
because luminance is a much better default than the average formula used
before.

Versioning was added to retain average conversion for old files.

Pull Request: https://projects.blender.org/blender/blender/pulls/133206
2025-01-24 09:40:43 +01:00
Pratik Borhade
23ff989dc0 Fix: Grease Pencil: Move use_selection property to new row in redo panel
bca8fc76f9 exposed `use_selection` in redo panel of interpolate
sequence, this resolved #133324. But it has been added to same row
Move this property to new row, so it looks nicer.

Pull Request: https://projects.blender.org/blender/blender/pulls/133520
2025-01-24 08:11:50 +01:00
Pratik Borhade
ad3459fb23 Fix #133519: Regression: Cannot select tools in curves sculpt mode
947330e529 accidently removed enum list of SculptCurves tools.

Pull Request: https://projects.blender.org/blender/blender/pulls/133523
2025-01-24 08:09:20 +01:00
Campbell Barton
8495a6b049 Modifier: add (disabled) assertions to validate modifier input/output
There are times it's not clear when an error is introduced,
this helps narrow it down.
2025-01-24 14:04:02 +11:00
Brecht Van Lommel
222d6b54cf Fix #112689: Copy image to clipboard doesn't use color management
Pull Request: https://projects.blender.org/blender/blender/pulls/133505
2025-01-23 21:41:16 +01:00
Clément Foucault
f8c1154e7f Fix: DRW: Broken compilation because of missing header 2025-01-23 21:30:07 +01:00
Clément Foucault
160d9508fe Fix: Overlay: Broken GPU compilation tests
The clip variation was added to a common create info
which should not be compiled.
2025-01-23 21:30:07 +01:00
Brecht Van Lommel
9b445da803 Fix #81768: Hang after saving render result not as a copy
This would change the image type in image_save_post, which would make the
logic in BKE_image_acquire/release_renderresult mismatched.

Also consistently call BKE_image_release_renderresult when the render result
is null, rather than only doing it half the time.

Pull Request: https://projects.blender.org/blender/blender/pulls/133503
2025-01-23 21:19:40 +01:00
Jacques Lucke
d79e95f19a Fix: viewer node inputs are grayed out
Don't gray out inputs on nodes that don't have any inputs.
In such cases the inputs can't affect the output but they are
still meaningful.
2025-01-23 19:59:30 +01:00
Jacques Lucke
c1e6cb3a0e Fix: input sockets of output nodes are grayed out
Just like the root group output node, those should be treated
as outputs of the node tree and are thus always used.
2025-01-23 19:34:52 +01:00
Brecht Van Lommel
7584ccc28d Fix #125711: Crash saving stereo EXR image from command line
* Ensure valid bit depth is set along with file type
* Guard against invalid inputs in stereo imbuf creation
* Remove some unused code

Thanks Yiming Wu for finding the cause.

Pull Request: https://projects.blender.org/blender/blender/pulls/133499
2025-01-23 19:15:17 +01:00
Clément Foucault
cfd5d9e3ad Fix #132895: Overlay: Dashed/flickering wireframe overlay on solid shading
This add back the NDC offset that was present in the legacy overlay.

But instead of adding a new view for it, we add `ndc_offset_factor`
to `State` to simplify wire offseting

Instead of modifying the projection matrix, we compute the unit
offset and pass it to the shader which choose the appropriate
factor to apply to the vertex position.

The value is put inside `State` so that it can be referenced
easily by multiple overlays.
Later on (once we move the global UBO inside Overlay) we can
move this to a UBO.

This only implements it for wireframe and edit mesh vert and
edges.

Note: that there seems to be some code duplication with the
edit mesh vertex code. That's to be tackled in another commit.

Pull Request: https://projects.blender.org/blender/blender/pulls/133433
2025-01-23 18:08:20 +01:00
Clément Foucault
1ac4651778 Cleanup: DRW: Remove legacy common_view_lib.glsl
No functional changes. Only moving and renaming stuff.

Pull Request: https://projects.blender.org/blender/blender/pulls/131558
2025-01-23 18:06:22 +01:00
Clément Foucault
4938ac7fa5 Fix: Overlay: Alt+B clipping not working in some edit modes
There was several issue making it broken:
- Missing UBO binding
- Missing shader variation
- Missing shader implementation for edit edges clipping
2025-01-23 17:48:46 +01:00
Clément Foucault
bf77aae7b5 Fix: Selection: Edit mesh selection does not honnor alt+B clipping
The clipping plane state was missing from the passes.
2025-01-23 17:48:46 +01:00
Clément Foucault
dcfd87f01c Fix: Overlay: Missing Alt-B clipping frustum overlay
Detected thanks to a GL error.
2025-01-23 17:48:46 +01:00