Commit Graph

145711 Commits

Author SHA1 Message Date
Iliya Katueshenock
ea7d97ae48 Tests: Avoid error in performance tests with lite build
There is no Cycles add-on in a lite build.

Pull Request: https://projects.blender.org/blender/blender/pulls/120442
2025-01-25 21:12:45 +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
Alaska
d2930e6285 Cycles Tests: Enable Principled BSDF OSL tests
The Principled BSDF tests were previously disabled when testing
with OSL as there was a noticeable difference in noise between SVM
and OSL when mixing/layering materials.

This commit enables the Principled BSDF OSL tests, but with a increased
threshold for failure so we can test for major regressions with the
Principled BSDF OSL implementation.

Pull Request: https://projects.blender.org/blender/blender/pulls/133530
2025-01-25 01:57:03 +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
Bastien Montagne
a3d9bdad6b Tests: Add simple script accessing (almost) all RNA properties.
Only runs on factory startup file, so not all possible paths are
covered. But should reduce likeliness of issues like #133551 in the
future.
2025-01-24 18:35:31 +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
Bastien Montagne
e53e06c0d0 Tools; blendfile & blend2json: Add support for ZSTD compressed files! 2025-01-24 15:01:24 +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
Aras Pranckevicius
342235616a Tests: emit more details in import test .txt templates
- Animation keyframes now contain left/right handle information
- More fcurves are emitted
- Material textures emit whether their colorspace is "data"
- More files in fbx test coverage

Pull Request: https://projects.blender.org/blender/blender/pulls/133526
2025-01-24 10:24:33 +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
Alaska
ddd83226b8 Cycles tests: Remove outdated comment
There was a comment in the Cycles test suite blocklist about UDIM
textures rendering incorrectly. 

This has since been fixed (1) so remove the comment from the blocklist.

(1) 82cc0a3eff
2025-01-24 08:28:48 +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
Alaska
56f5ba20f9 Tests: Add a Cycles render test for long distance ray precision
When a ray travels a long distance in Cycles, precision related
artifacts can start to appear.

In most situations these aren't noticeable, but with an orthographic
camera, specifically with HIP-RT, the issue can become
quite noticeable.

This commit adds a test for this issue by placing a orthographic camera
1000m away from a subject.

Relevant bug report: blender/blender#117961
Ref: blender/blender-test-data!44
2025-01-24 06:42:59 +01:00
Alaska
491980abd4 Tests: Add Cycles test for the "bake from multires" options
This commit adds tests for the bake normal and displacement from
multires options available in Cycles.

Ref: blender/blender#123012
Ref: blender/blender-test-data!46
2025-01-24 05:53:12 +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
Alaska
88f444dd4c Tests: Add render test for distant lights with world volumes
Recently a bug was introduced leading to rendering artifacts on some
devices when rendering a world volume in a scene that also contained a
distant light. This has since been fixed (1).

This commit aims to add a test for this specific case so we can detect
these sorts of issues in the future.

(1) blender/blender@58b7543ede

Ref: blender/blender-test-data!48
2025-01-24 03:24:12 +01:00
Brecht Van Lommel
82cc0a3eff Fix #124847: Cycles OSL UDIM wrong extrapolation with negative UV
Pull Request: https://projects.blender.org/blender/blender/pulls/133507
2025-01-23 22:20:52 +01: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
63e2adaa79 Fix #127875: Cycles renders image with single UDIM tile wrong
Properly support this case instead of assuming it's not a UDIM.

Pull Request: https://projects.blender.org/blender/blender/pulls/133504
2025-01-23 21:20:01 +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